create magic comment for persistent macro character recognition, "wmllint: who"
The "recognize" magic comment only covers one scenario; but what about macros that are used in many scenarios? This new magic comment creates dictionary pairs of macros with the characters they are associated with. If this is not yet clear, hopefully the following commits will show the full picture.
This commit is contained in:
parent
7fa157c8ca
commit
21c50ccb2e
1 changed files with 14 additions and 0 deletions
|
@ -649,6 +649,9 @@ notepairs = [
|
|||
("{WEAPON_SPECIAL_STUN}", "{SPECIAL_NOTES_STUN}"),
|
||||
]
|
||||
|
||||
# This dictionary will pair macros with the characters they recall or create,
|
||||
# but must be populated by the magic comment, "#wmllint: who ... is ...".
|
||||
whopairs = {}
|
||||
|
||||
# These are accumulated by sanity_check() and examined by consistency_check()
|
||||
unit_types = []
|
||||
|
@ -1303,6 +1306,17 @@ def global_sanity_check(filename, lines):
|
|||
markcheck = False
|
||||
if "wmllint: markcheck on" in lines[i]:
|
||||
markcheck = True
|
||||
if 'wmllint: who ' in lines[i]:
|
||||
try:
|
||||
fields = lines[i].split("wmllint: who ", 1)[1].split(" is ", 1)
|
||||
if len(fields) == 2:
|
||||
mac = string_strip(fields[0].strip())
|
||||
if whopairs.has_key(mac):
|
||||
whopairs[mac] = whopairs[mac] + ", " + fields[1].strip()
|
||||
else:
|
||||
whopairs.update({mac: fields[1].strip()})
|
||||
except IndexError:
|
||||
pass
|
||||
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