mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-03-23 01:47:53 -04:00
Implement #4214 (Sorting MANIFEST files in ePUB conversion)
This commit is contained in:
parent
1c1b73d312
commit
4b413dfef3
@ -1206,8 +1206,12 @@ class Manifest(object):
|
||||
return elem
|
||||
|
||||
def to_opf2(self, parent=None):
|
||||
|
||||
def sort(x, y):
|
||||
return cmp(x.href, y.href)
|
||||
|
||||
elem = element(parent, OPF('manifest'))
|
||||
for item in self.items:
|
||||
for item in sorted(self.items, cmp=sort):
|
||||
media_type = item.media_type
|
||||
if media_type in OEB_DOCS:
|
||||
media_type = XHTML_MIME
|
||||
@ -1435,7 +1439,6 @@ class Guide(object):
|
||||
return elem
|
||||
|
||||
|
||||
# TODO: This needs beefing up to support the interface of toc.TOC
|
||||
class TOC(object):
|
||||
"""Represents a hierarchical table of contents or navigation tree for
|
||||
accessing arbitrary semantic sections within an OEB data model book.
|
||||
|
||||
@ -167,7 +167,7 @@ class FlowSplitter(object):
|
||||
self.csp_counter = 0
|
||||
|
||||
base, ext = os.path.splitext(self.base)
|
||||
self.base = base.replace('%', '%%')+'_split_%d'+ext
|
||||
self.base = base.replace('%', '%%')+'_split_%.3d'+ext
|
||||
|
||||
self.trees = [self.item.data.getroottree()]
|
||||
self.splitting_on_page_breaks = True
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user