mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
WHen pretty printing the OPF, do not sort the manifest items if there are comments in the manifest, as this would break the link between the comments and the content
This commit is contained in:
parent
91b42705d9
commit
eadb877113
@ -78,7 +78,10 @@ def pretty_opf(root):
|
||||
return (cat, i)
|
||||
|
||||
for manifest in root.xpath('//opf:manifest', namespaces=OPF_NAMESPACES):
|
||||
children = sorted(manifest, key=manifest_key)
|
||||
try:
|
||||
children = sorted(manifest, key=manifest_key)
|
||||
except AttributeError:
|
||||
continue # There are comments so dont sort since that would mess up the comments
|
||||
for x in reversed(children):
|
||||
manifest.insert(0, x)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user