mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 11:14:02 +02: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
1 changed files with 6 additions and 3 deletions
|
|
@ -391,9 +391,12 @@ def format_opf(self):
|
|||
remove = set()
|
||||
for child in mdata:
|
||||
child.tail = '\n '
|
||||
if (child.get('name', '').startswith('calibre:') and
|
||||
child.get('content', '').strip() in {'{}', ''}):
|
||||
remove.add(child)
|
||||
try:
|
||||
if (child.get('name', '').startswith('calibre:') and
|
||||
child.get('content', '').strip() in {'{}', ''}):
|
||||
remove.add(child)
|
||||
except AttributeError:
|
||||
continue # Happens for XML comments
|
||||
for child in remove: mdata.remove(child)
|
||||
if len(mdata) > 0:
|
||||
mdata[-1].tail = '\n '
|
||||
|
|
|
|||
Loading…
Reference in a new issue