mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 08:55:07 +02:00
MOBI output: Set the document type by the publication type in the document metadata
This commit is contained in:
parent
45366b0df5
commit
6ad3575579
1 changed files with 7 additions and 2 deletions
|
|
@ -1831,7 +1831,7 @@ def _add_structured_ctoc_node(self, node, ctoc, title=None):
|
|||
# Add the klass of this node
|
||||
ctoc_name_map['klass'] = node.klass
|
||||
|
||||
if node.klass == 'chapter' :
|
||||
if node.klass == 'chapter':
|
||||
# Add title offset to name map
|
||||
ctoc_name_map['titleOffset'] = ctoc.tell()
|
||||
ctoc.write(decint(len(t), DECINT_FORWARD)+t)
|
||||
|
|
@ -1980,7 +1980,12 @@ def _generate_ctoc(self):
|
|||
elif self._periodicalCount and self._sectionCount == 1 :
|
||||
mobiType = 0x102
|
||||
elif self._periodicalCount and self._sectionCount > 1 :
|
||||
mobiType = 0x103 # Could also be 0x101 - need cli switch
|
||||
pt = None
|
||||
if self._oeb.metadata.publication_type:
|
||||
x = self._oeb.metadata.publication_type[0].split(':')
|
||||
if len(x) > 1:
|
||||
pt = x[1]
|
||||
mobiType = {'newspaper':0x101}.get(pt, 0x103)
|
||||
else :
|
||||
raise NotImplementedError('_generate_ctoc: Unrecognized document structured')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue