mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 05:07:10 -05:00
strip superfluous spans from 1.2 upgrade
This commit is contained in:
parent
e610eeeb42
commit
fca4ef7c00
1 changed files with 6 additions and 3 deletions
|
|
@ -465,9 +465,12 @@ order by ordinal""", mid)):
|
|||
t[k] = re.sub("(^|[^{]){{([^{}]+)?}}", repl, t[k])
|
||||
# then strip extra {}s from other fields
|
||||
t[k] = t[k].replace("{{{", "{{").replace("}}}", "}}")
|
||||
if "{{{" in t[k]:
|
||||
print t[k]
|
||||
raise Exception()
|
||||
# remove superfluous formatting from 1.0 -> 1.2 upgrade
|
||||
t[k] = re.sub("font-size: ?20px;?", "", t[k])
|
||||
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
|
||||
if t['bg'].lower() == "#ffffff":
|
||||
# a bit more intuitive default
|
||||
|
|
|
|||
Loading…
Reference in a new issue