strip superfluous spans from 1.2 upgrade

This commit is contained in:
Damien Elmes 2011-12-18 07:23:26 +09:00
parent e610eeeb42
commit fca4ef7c00

View file

@ -465,9 +465,12 @@ order by ordinal""", mid)):
t[k] = re.sub("(^|[^{]){{([^{}]+)?}}", repl, t[k]) t[k] = re.sub("(^|[^{]){{([^{}]+)?}}", repl, t[k])
# then strip extra {}s from other fields # then strip extra {}s from other fields
t[k] = t[k].replace("{{{", "{{").replace("}}}", "}}") t[k] = t[k].replace("{{{", "{{").replace("}}}", "}}")
if "{{{" in t[k]: # remove superfluous formatting from 1.0 -> 1.2 upgrade
print t[k] t[k] = re.sub("font-size: ?20px;?", "", t[k])
raise Exception() t[k] = re.sub("(?i)font-family: ?arial;?", "", t[k])
t[k] = re.sub("color: ?#000(000)?;?", "", t[k])
t[k] = re.sub("white-space: ?pre-wrap;?", "", t[k])
t[k] = re.sub('<span style=" *">(.+?)</span>', '\\1', t[k])
# adjust css # adjust css
if t['bg'].lower() == "#ffffff": if t['bg'].lower() == "#ffffff":
# a bit more intuitive default # a bit more intuitive default