Properly conditionalize another conversion.

This commit is contained in:
Eric S. Raymond 2008-02-01 23:12:38 +00:00
parent d43d693c7c
commit b527bc665b

View file

@ -1603,10 +1603,13 @@ def translator(filename, mapxforms, textxform):
(newdata, 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]|while])\s*\[or]([\w\W]*?)\[/or]\s*",
r"\1\2", filetext);
if upconvert:
# WML syntax changed in 1.3.5. The transformation cannot
# conveniently be done line-by-line.
transformed = re.sub(r"(if]|while])\s*\[or]([\w\W]*?)\[/or]\s*",
r"\1\2", filetext);
else:
transformed = filetext
# Return None if the transformation functions made no changes.
if modified or hacked or transformed != filetext:
return transformed