Sapient's transformation might actually work this time.

This commit is contained in:
Eric S. Raymond 2007-07-25 02:51:34 +00:00
parent 370d925489
commit 90aa31e949

View file

@ -651,9 +651,15 @@ def translator(filename, mapxforms, textxform):
modified_maps[filename] = modified
# OK, now perform WML rewrites
hacked = hack_syntax(filename, newdata)
# Run everything together
filetext = "".join(newdata)
# WML syntax changed in 1.3.5. The transformation cannot
# conveniently be done line-by-line.
transformed = re.sub(r"if]\s*\[or]([\w\W]*?)\[/or]\s*",
r"if]\1", filetext);
# Return None if the transformation functions made no changes.
if modified or hacked:
return "".join(newdata)
if modified or hacked or transformed != filetext:
return transformed
else:
return None
@ -859,9 +865,6 @@ if __name__ == '__main__':
# 1.3.1 to 1.3.2 conversion
for (old, new) in conversion2.items():
transformed = old.sub(new, transformed)
# WML syntax changed in 1.3.5
transformed = re.sub(r"if]\s*\[or]([\w\W]*?)\[/or]\s*",
r"if]\1", transformed);
# Report the changes
if verbose > 0 and transformed != line:
msg = "%s, line %d: %s -> %s" % \