recognize characters from "wmllint: who" macros and append to present
Now that we see how the whopairs are recognized, we can see that the magic comment accepts a comma-separated list, for macros that deal with more than one character. We also see that if it is necessary to remove a character who leaves the party, this can be done with another entry prefixed by double minuses.
This commit is contained in:
parent
21c50ccb2e
commit
56be5f2f6b
1 changed files with 13 additions and 0 deletions
|
@ -1317,6 +1317,19 @@ def global_sanity_check(filename, lines):
|
|||
whopairs.update({mac: fields[1].strip()})
|
||||
except IndexError:
|
||||
pass
|
||||
if lines[i].lstrip().startswith('{'):
|
||||
# Recognize macro pairings from "wmllint: who" magic
|
||||
# comments.
|
||||
for mac in whopairs.keys():
|
||||
if mac in lines[i]:
|
||||
for who in whopairs[mac].split(","):
|
||||
if who.strip().startswith("--"):
|
||||
try:
|
||||
present.remove(who.replace('--', '', 1).strip())
|
||||
except:
|
||||
ValueError
|
||||
else:
|
||||
present.append(who.strip())
|
||||
m = re.search("# *wmllint: recognize +(.*)", lines[i])
|
||||
if m:
|
||||
present.append(string_strip(m.group(1)).strip())
|
||||
|
|
Loading…
Add table
Reference in a new issue