Convert 'letter=' tags.
This commit is contained in:
parent
48db8be50e
commit
a78e29de14
1 changed files with 30 additions and 29 deletions
|
@ -652,9 +652,9 @@ if __name__ == '__main__':
|
|||
for step in fileconversions:
|
||||
for (old, new) in step:
|
||||
transformed = old.sub(new, transformed)
|
||||
# Handle terrain_liked=, terrain=, valid_terrain=
|
||||
# Handle terrain_liked=, terrain=, valid_terrain=, letter=
|
||||
spaceless = transformed.replace(" ", "").replace("\t", "")
|
||||
if spaceless and spaceless[0] != "#" and ("terrain_liked=" in spaceless or "terrain=" in spaceless):
|
||||
if spaceless and spaceless[0] != "#" and ("terrain_liked=" in spaceless or "terrain=" in spaceless or 'letter=' in spaceless):
|
||||
(key, pre, value, post) = parse_attribute(transformed)
|
||||
# We have to cope with the following cases...
|
||||
# Old style:
|
||||
|
@ -688,34 +688,35 @@ if __name__ == '__main__':
|
|||
if not oldstyle and not newstyle:
|
||||
print "%s, line %d: leaving ambiguous terrain value %s alone." \
|
||||
% (filename, lineno+1, value)
|
||||
elif newstyle:
|
||||
if len(value) == 2:
|
||||
# 1.3.1 to 1.3.2 conversion
|
||||
for (old, new) in conversion2.items():
|
||||
transformed = old.sub(new, transformed)
|
||||
else: # oldstyle
|
||||
# 1.2.x to 1.3.2 conversions
|
||||
newterrains = ""
|
||||
inmacro = False
|
||||
for c in value:
|
||||
if not inmacro:
|
||||
if c == '{':
|
||||
inmacro = True
|
||||
newterrains += c
|
||||
elif c == ',':
|
||||
pass
|
||||
elif c.isspace():
|
||||
else:
|
||||
if oldstyle:
|
||||
# 1.2.x to 1.3.2 conversions
|
||||
newterrains = ""
|
||||
inmacro = False
|
||||
for c in value:
|
||||
if not inmacro:
|
||||
if c == '{':
|
||||
inmacro = True
|
||||
newterrains += c
|
||||
elif c == ',':
|
||||
pass
|
||||
elif c.isspace():
|
||||
newterrains += c
|
||||
elif c in conversion1:
|
||||
newterrains += conversion1[c] + ","
|
||||
else:
|
||||
print "%s, line %d: custom terrain %s ignored." \
|
||||
% (filename, lineno+1, c)
|
||||
else: # inmacro == True
|
||||
if c == '}':
|
||||
inmacro = False
|
||||
newterrains += c
|
||||
elif c in conversion1:
|
||||
newterrains += conversion1[c] + ","
|
||||
else:
|
||||
print "%s, line %d: custom terrain %s ignored." \
|
||||
% (filename, lineno+1, c)
|
||||
else: # inmacro == True
|
||||
if c == '}':
|
||||
inmacro = False
|
||||
newterrains += c
|
||||
transformed = pre + newterrains[:-1] + post
|
||||
transformed = pre + newterrains[:-1] + post
|
||||
if newstyle:
|
||||
if len(value) == 2:
|
||||
# 1.3.1 to 1.3.2 conversion
|
||||
for (old, new) in conversion2.items():
|
||||
transformed = old.sub(new, transformed)
|
||||
# Report the changes
|
||||
if verbose > 0 and transformed != line:
|
||||
msg = "%s, line %d: %s -> %s" % \
|
||||
|
|
Loading…
Add table
Reference in a new issue