mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
catch missing src in img
This commit is contained in:
parent
3500195290
commit
e7911652ef
1 changed files with 7 additions and 2 deletions
|
@ -296,8 +296,13 @@ def _filterHTML(html):
|
|||
tag.replaceWithChildren()
|
||||
# turn file:/// links into relative ones
|
||||
for tag in doc("img"):
|
||||
if tag['src'].lower().startswith("file://"):
|
||||
tag['src'] = os.path.basename(tag['src'])
|
||||
try:
|
||||
if tag['src'].lower().startswith("file://"):
|
||||
tag['src'] = os.path.basename(tag['src'])
|
||||
except KeyError:
|
||||
# for some bizarre reason, mnemosyne removes src elements
|
||||
# from missing media
|
||||
pass
|
||||
# strip superfluous elements
|
||||
for elem in "html", "head", "body", "meta":
|
||||
for tag in doc(elem):
|
||||
|
|
Loading…
Reference in a new issue