mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-31 00:55:39 +01: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
1 changed files with 4 additions and 1 deletions
|
|
@ -78,7 +78,10 @@ def manifest_key(x):
|
|||
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…
Reference in a new issue