Skip to content

Commit

Permalink
wmllint: handle HelpWML markup correctly while spellchecking
Browse files Browse the repository at this point in the history
This fixes bug #22780, as well as several false positives when checking the /data/core/editor/help.cfg file.
  • Loading branch information
Elvish-Hunter committed Jun 10, 2016
1 parent d5fdc95 commit 2b3d54d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions data/tools/wmllint
Expand Up @@ -2626,9 +2626,10 @@ def inner_spellcheck(nav, value, spelldict):
value = value.replace(old, new)

if '<' in value:
value = re.sub("<ref>.*< ref>", "", value)
value = re.sub("<[^>]+>text='([^']*)'<[^>]+>", r"\1", value)
value = re.sub("<[0-9,]+>", "", value)
# remove HelpWML markup and extract its text content where needed
value = re.sub(r"<(ref|format)>.*?text='(.*?)'.*?< \1>", r"\2", value)
value = re.sub(r"<(jump|img)>.*?< \1>", "", value)
value = re.sub(r"<(italic|bold|header)>text='(.*?)'< \1>", r"\2", value)
# Fold continued lines
value = re.sub(r'" *\+\s*_? *"', "", value)
# It would be nice to use pyenchant's tokenizer here, but we can't
Expand Down

0 comments on commit 2b3d54d

Please sign in to comment.