possibly half-baked fix for wmllint complaining...

...about unknown [event]id=something
This commit is contained in:
Anonymissimus 2012-08-19 22:42:11 +00:00
parent b7ccb8091b
commit 890b6d0b3b

View file

@ -1156,6 +1156,10 @@ def global_sanity_check(filename, lines):
in_remove_sound_source = False
in_message = False
in_option = False
#last index is true: we're currently directly in an [event]
#this avoids complaints about unknown [event]id=something, but keeps the check
#in case some [filter]id= comes in this [event]
directly_in_event = []
ignoreable = False
preamble_seen = False
sentence_end = re.compile("(?<=[.!?;:]) +")
@ -1184,6 +1188,13 @@ def global_sanity_check(filename, lines):
subtag_depth += 1
if "[/" in lines[i]:
subtag_depth -= 1
if "[event]" in lines[i]:
directly_in_event.append(True)
elif re.search(r"\[[a-z]", lines[i]):
directly_in_event.append(False)
elif "[/" in lines[i]:
if len(directly_in_event) > 0:
directly_in_event.pop()
# Ordinary subtag flags begin here
if "[trait]" in lines[i]:
in_trait = True
@ -1309,7 +1320,7 @@ def global_sanity_check(filename, lines):
present.append(value)
elif value and value[0] in ("$", "{"):
continue
elif preamble_seen and subtag_depth > 0 and not ignore_id and not in_object and not in_cfg and not in_facet and not in_sound_source and not in_remove_sound_source and not in_stage and not in_goal and not in_set_menu_item:
elif preamble_seen and subtag_depth > 0 and not ignore_id and not in_object and not in_cfg and not in_facet and not in_sound_source and not in_remove_sound_source and not in_stage and not in_goal and not in_set_menu_item and not directly_in_event[-1]:
ids = value.split(",")
for j in range(len(ids)):
# removal of leading whitespace of items in comma-separated lists