mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-30 18:35:38 +01:00
Infrastructure for internal ToC entries per article
This commit is contained in:
parent
547cc40f8c
commit
bc634e02bd
2 changed files with 6 additions and 1 deletions
|
|
@ -34,6 +34,7 @@ def __init__(self, id, title, url, author, summary, published, content):
|
|||
self.url = url
|
||||
self.author = author
|
||||
self.toc_thumbnail = None
|
||||
self.internal_toc_entries = ()
|
||||
if author and not isinstance(author, unicode_type):
|
||||
author = author.decode('utf-8', 'replace')
|
||||
if summary and not isinstance(summary, unicode_type):
|
||||
|
|
|
|||
|
|
@ -1522,10 +1522,14 @@ def feed_index(num, parent):
|
|||
arelpath = '%sindex.html'%adir
|
||||
for curl in self.canonicalize_internal_url(a.orig_url, is_link=False):
|
||||
aumap[curl].add(arelpath)
|
||||
parent.add_item(arelpath, None,
|
||||
article_toc_entry = parent.add_item(arelpath, None,
|
||||
a.title if a.title else _('Untitled article'),
|
||||
play_order=po, author=auth,
|
||||
description=desc, toc_thumbnail=tt)
|
||||
for entry in a.internal_toc_entries:
|
||||
self.play_order_counter += 1
|
||||
po += 1
|
||||
article_toc_entry.add_item(arelpath, entry['anchor'], entry['title'], play_order=po)
|
||||
last = os.path.join(self.output_dir, ('%sindex.html'%adir).replace('/', os.sep))
|
||||
for sp in a.sub_pages:
|
||||
prefix = os.path.commonprefix([opf_path, sp])
|
||||
|
|
|
|||
Loading…
Reference in a new issue