mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
MOBI Output: Have the href of the periodical class TOC node point to the top of the first spine element
This commit is contained in:
parent
4158655b62
commit
01a3782676
@ -76,6 +76,7 @@ class MOBIOutput(OutputFormatPlugin):
|
|||||||
from calibre.ebooks.oeb.base import TOC
|
from calibre.ebooks.oeb.base import TOC
|
||||||
toc = self.oeb.toc
|
toc = self.oeb.toc
|
||||||
if toc and toc[0].klass != 'periodical':
|
if toc and toc[0].klass != 'periodical':
|
||||||
|
start_href = self.oeb.spine[0].href
|
||||||
self.log('Converting TOC for MOBI periodical indexing...')
|
self.log('Converting TOC for MOBI periodical indexing...')
|
||||||
articles = {}
|
articles = {}
|
||||||
if toc.depth < 3:
|
if toc.depth < 3:
|
||||||
@ -92,7 +93,7 @@ class MOBIOutput(OutputFormatPlugin):
|
|||||||
a.klass = 'article'
|
a.klass = 'article'
|
||||||
articles[id(sec)].append(a)
|
articles[id(sec)].append(a)
|
||||||
sec.nodes.remove(a)
|
sec.nodes.remove(a)
|
||||||
root = TOC(klass='periodical',
|
root = TOC(klass='periodical', href=start_href,
|
||||||
title=unicode(self.oeb.metadata.title[0]))
|
title=unicode(self.oeb.metadata.title[0]))
|
||||||
for s in sections:
|
for s in sections:
|
||||||
if articles[id(s)]:
|
if articles[id(s)]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user