mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Book polishing: Do not error out when polishing epub files that have XML comments in their OPF metadata section.
This commit is contained in:
parent
ebf4068ebc
commit
ac5d96f7f3
@ -391,9 +391,12 @@ class Container(object):
|
|||||||
remove = set()
|
remove = set()
|
||||||
for child in mdata:
|
for child in mdata:
|
||||||
child.tail = '\n '
|
child.tail = '\n '
|
||||||
if (child.get('name', '').startswith('calibre:') and
|
try:
|
||||||
child.get('content', '').strip() in {'{}', ''}):
|
if (child.get('name', '').startswith('calibre:') and
|
||||||
remove.add(child)
|
child.get('content', '').strip() in {'{}', ''}):
|
||||||
|
remove.add(child)
|
||||||
|
except AttributeError:
|
||||||
|
continue # Happens for XML comments
|
||||||
for child in remove: mdata.remove(child)
|
for child in remove: mdata.remove(child)
|
||||||
if len(mdata) > 0:
|
if len(mdata) > 0:
|
||||||
mdata[-1].tail = '\n '
|
mdata[-1].tail = '\n '
|
||||||
|
Loading…
x
Reference in New Issue
Block a user