mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Infrastructure for internal ToC entries per article
This commit is contained in:
parent
547cc40f8c
commit
bc634e02bd
@ -34,6 +34,7 @@ class Article(object):
|
||||
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 @@ class BasicNewsRecipe(Recipe):
|
||||
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…
x
Reference in New Issue
Block a user