wmllint: rewrite test of permitted tags in [part]
The tags are now tested directly, rather than as a parent of a key. The old test was probably not missing tags like the test for illegal child of [if] did, because [part] could be anywhere in ancestors. Anyway, [part] rarely contains other tags.
This commit is contained in:
parent
b68feb74f4
commit
20bc51302e
1 changed files with 5 additions and 2 deletions
|
@ -945,8 +945,11 @@ def local_sanity_check(filename, nav, key, prefix, value, comment):
|
|||
if m and not m.group(1):
|
||||
print errlead + 'translatability mark before non-string'
|
||||
# Most tags are not allowed with [part]
|
||||
if "[part]" in ancestors and parent not in ("[part]", "[image]", "[insert_tag]", "[if]", "[then]", "[else]", "[switch]", "[case]", "[variable]", "[deprecated_message]") and not parent.startswith("#"):
|
||||
print errlead + '%s not permitted within [part] tag' % parent
|
||||
if ("[part]" in ancestors or parent == "[part]") and isOpener(nav.element) and \
|
||||
nav.element not in ("[part]", "[image]", "[insert_tag]",
|
||||
"[if]", "[then]", "[else]", "[switch]", "[case]",
|
||||
"[variable]", "[deprecated_message]"):
|
||||
print errlead + '%s not permitted within [part] tag' % nav.element
|
||||
# Most tags are not permitted inside [if]
|
||||
if (len(ancestors) >= 1 and parent == "[if]") or \
|
||||
(len(ancestors) >= 2 and parent == "#ifdef" and ancestors[-1] == "[if]"):
|
||||
|
|
Loading…
Add table
Reference in a new issue