nvda
eb25400f - Filter out markdown linter comments from translations (#19308)

Commit
111 days ago
Filter out markdown linter comments from translations (#19308) Fixes #18982 ### Summary of the issue: Markdown files for our documentation may sometimes contain special markdown linter comments, which are incorrectly being included in content to translate, and in some cases breaking detection of markdown entities such as table rows. For example in userguide.md we have: ``` |None |`--enable-start-on-logon=True|False` |When installing, enable NVDA's [Use NVDA during Windows sign-in](#StartAtWindowsLogon)| <!-- markdownlint-disable-line MD055 MD056 --> ``` This produces a translation unit such as: ``` <unit id="ab362c58-1f2e-4bbc-99aa-85bd37b39689"> <notes> <note appliesTo="source">line: 5978</note> </notes> <segment> <source>|None |`--enable-start-on-logon=True|False` |When installing, enable NVDA's [Use NVDA during Windows sign-in](#StartAtWindowsLogon)| &lt;!-- markdownlint-disable-line MD055 MD056 --&gt;</source> </segment> </unit> ``` * The source string incorrectly contains the markdown linter comment. * The source string has not been correctly processed as a table row (the start and end vertical bars are still present) * There is no prefix and suffix (containing the vertical bars) in the notes. ### Description of user facing changes: None. ### Description of developer facing changes: None. ### Description of development approach: In markdownTranslate.py: * add a regular expression to match these markdown comments. * Add a preprocessMarkdownLines function, which runs this regex on all lines. * All places that read in a markdown file now preprocess all lines with preprocessMarkdownLines, such as generateSkeleton, updateSkeleton, generateXliff, and ensureMarkdownFilesMatch. English auto generated userguide xliff: * manually remove the translation unit that incorrectly contains the markdown linter comment, and also remove its line from the skeleton. The next time that userGuide.md is changed, this translation unit will automatically be replaced with the correct content. ### Testing strategy: * ran `markdownTranslate.py generateXliff -m userguide.md -o test_generated.xliff` and ensured that the translation unit in test_generated.xliff for that table row no longer contains the markdown linter comment. * ran `markdownTranslate.py updateXliff -x userguide.xliff -m userGuide.md -o test_updated.xliff` * again ensured that the translation unit for that table row no longer contained the markdown linter comment. * generated a unified diff of userguide.xliff and test_updated.xliff, and ensured that the only change was the addition of the corrected translation unit, and the replacement of the related line in the skeleton content with the new translation ID for that unit, now with the leading and trailing vertical bars previously missing. ### Known issues with pull request: None known.
Parents
Loading