Remove some id declarations that (a) confuse wmllint,
...and (b) are ignored by the WML engine.
This commit is contained in:
parent
a9dfe44dba
commit
b769ebbb41
6 changed files with 30 additions and 33 deletions
|
@ -51,6 +51,8 @@
|
|||
[event]
|
||||
name=start
|
||||
# Fix 11242, remove Owaec and Dacyn from recall list for the duration of the duel
|
||||
# wmllint: recognize Owaec
|
||||
# wmllint: recognize Dacyn
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=Owaec
|
||||
|
|
|
@ -291,7 +291,6 @@
|
|||
x,y=31,18
|
||||
[/filter]
|
||||
[message]
|
||||
id=fire_hot
|
||||
speaker=unit
|
||||
message= _ "Ow! Fire hot! No step in fire!"
|
||||
[/message]
|
||||
|
|
|
@ -7,11 +7,9 @@
|
|||
|
||||
[generator]
|
||||
[settings]
|
||||
id=4_Gathering_Materials
|
||||
name= _ "Gathering Materials"
|
||||
{TURNS 40 37 34}
|
||||
victory_when_enemies_defeated=no
|
||||
next_scenario=4t_The_Jeweler
|
||||
|
||||
{SCENARIO_MUSIC underground.ogg}
|
||||
|
||||
|
|
|
@ -429,7 +429,6 @@
|
|||
speaker=Deoran
|
||||
message= _ "Hmm...I have to consider this..."
|
||||
[option]
|
||||
id=accept_bandits
|
||||
message= _ "Very well. All men must unite against the undead."
|
||||
[command]
|
||||
[music]
|
||||
|
@ -566,7 +565,6 @@
|
|||
[/option]
|
||||
|
||||
[option]
|
||||
id=reject_bandits
|
||||
message= _ "Your crimes are too great. You will fall with the rest of the foul undead!"
|
||||
[command]
|
||||
[music]
|
||||
|
|
|
@ -404,7 +404,6 @@
|
|||
speaker=Arne
|
||||
message= _ "I am the one to decide."
|
||||
[option]
|
||||
id=get_heavy_inf
|
||||
message= _ "Oh, all right then. Come along with us."
|
||||
[command]
|
||||
[message]
|
||||
|
@ -417,7 +416,6 @@
|
|||
[/command]
|
||||
[/option]
|
||||
[option]
|
||||
id=fast_gold
|
||||
message= _ "I am sorry. We have not the time to spare."
|
||||
[command]
|
||||
[message]
|
||||
|
|
|
@ -797,30 +797,39 @@ def sanity_check(filename, lines):
|
|||
m = re.match('# *wmllint: usage of "([^"]*)" is +(.*)', lines[i])
|
||||
if m:
|
||||
usage[m.group(1)] = m.group(2).strip()
|
||||
# Consistency-check the description attributes in [side], [unit], [recall],
|
||||
# Consistency-check the id= attributes in [side], [unit], [recall],
|
||||
# and [message] scopes, also correctness-check translation marks and look
|
||||
# for double spaces at end of sentence.
|
||||
unmodified = copy.copy(lines)
|
||||
present = []
|
||||
in_scenario = False
|
||||
in_person = False
|
||||
in_objective = False
|
||||
in_trait = False
|
||||
ignore_id = False
|
||||
in_object = False
|
||||
ignoreable = False
|
||||
preamble_seen = False
|
||||
sentence_end = re.compile("(?<=[.!?;:]) +")
|
||||
for i in range(len(lines)):
|
||||
if '[' in lines[i]:
|
||||
preamble_seen = True
|
||||
if "[scenario]" in lines[i]:
|
||||
in_scenario = True
|
||||
preamble_seen = False
|
||||
elif "[/scenario]" in lines[i]:
|
||||
in_scenario = False
|
||||
elif "[objective]" in lines[i]:
|
||||
in_objective = True
|
||||
elif "[/objective]" in lines[i]:
|
||||
in_objective = False
|
||||
elif "[trait]" in lines[i]:
|
||||
in_trait = True
|
||||
elif "[/trait]" in lines[i]:
|
||||
in_trait = False
|
||||
elif "[object]" in lines[i]:
|
||||
in_object = True
|
||||
elif "[/object]" in lines[i]:
|
||||
in_object = False
|
||||
elif "[label]" in lines[i] or "[chamber]" in lines[i] or "[time]" in lines[i]:
|
||||
ignore_id = True
|
||||
elif "[/label]" in lines[i] or "[/chamber]" in lines[i] or "[/time]" in lines[i]:
|
||||
ignore_id = False
|
||||
elif "[kill]" in lines[i] or "[effect]" in lines[i] or "[move_unit_fake]" in lines[i] or "[scroll_to_unit]" in lines[i]:
|
||||
ignoreable = True
|
||||
elif "[/kill]" in lines[i] or "[/effect]" in lines[i] or "[/move_unit_fake]" in lines[i] or "[/scroll_to_unit]" in lines[i]:
|
||||
|
@ -858,7 +867,7 @@ def sanity_check(filename, lines):
|
|||
pass
|
||||
elif key == 'name': # FIXME: check this someday
|
||||
pass
|
||||
elif key in ("message", "user_description", "story", "note", "text", "summary", "caption", "label", "unit_description", "cannot_use_message", "set_description") and not value.startswith("$"):
|
||||
elif key in ("message", "description", "user_description", "story", "note", "text", "summary", "caption", "label", "unit_description", "cannot_use_message", "set_description") and not value.startswith("$"):
|
||||
if not has_tr_mark:
|
||||
print '"%s", line %d: %s needs translation mark' \
|
||||
% (filename, i+1, key)
|
||||
|
@ -869,26 +878,19 @@ def sanity_check(filename, lines):
|
|||
% (filename, i+1)
|
||||
if not stringfreeze:
|
||||
lines[i] = sentence_end.sub(" ", lines[i])
|
||||
elif key == "description":
|
||||
if (in_trait or in_objective) and not has_tr_mark:
|
||||
print '"%s", line %d: description in [objectives] needs translation mark' \
|
||||
% (filename, i+1)
|
||||
lines[i] = sentence_end.sub(" ", lines[i])
|
||||
elif not (in_trait or in_objective) and has_tr_mark:
|
||||
print '"%s", line %d: description should not have translation mark' \
|
||||
% (filename, i+1)
|
||||
else:
|
||||
if key == "id":
|
||||
if in_person:
|
||||
present.append(value)
|
||||
elif value in ('narrator', 'unit', 'second_unit') or value[0] in ("$", "{"):
|
||||
continue
|
||||
elif preamble_seen and not ignore_id and not in_object and not value in present:
|
||||
print '"%s", line %d: unknown \'%s\' referred to by id' \
|
||||
% (filename, i+1, value)
|
||||
if has_tr_mark:
|
||||
print '"%s", line %d: %s should not have a translation mark' \
|
||||
% (filename, i+1, key)
|
||||
lines[i] = lines[i].replace("_", "", 1)
|
||||
if in_person:
|
||||
present.append(value)
|
||||
elif value in ('narrator', 'unit', 'second_unit') or value[0] in ("$", "{"):
|
||||
continue
|
||||
elif not in_objective and value not in present:
|
||||
print '"%s", line %d: unknown \'%s\' referred to by description' \
|
||||
% (filename, i+1, value)
|
||||
elif has_tr_mark:
|
||||
print '"%s", line %d: %s should not have a translation mark' \
|
||||
% (filename, i+1, key)
|
||||
lines[i] = lines[i].replace("_", "", 1)
|
||||
except TypeError:
|
||||
pass
|
||||
# Check for textdomain strings; should be exactly one, on line 1
|
||||
|
|
Loading…
Add table
Reference in a new issue