forked from LiveCarta/BookConverter
epub converter: add not added files to toc
This commit is contained in:
@@ -61,6 +61,7 @@ class EpubPostprocessor:
|
|||||||
self.build_adjacency_list_from_spine()
|
self.build_adjacency_list_from_spine()
|
||||||
not_added = [x for x in self.href2soup_html if x not in self.added_to_toc_hrefs]
|
not_added = [x for x in self.href2soup_html if x not in self.added_to_toc_hrefs]
|
||||||
self.logger.log(f'Html documents not added to TOC: {not_added}.')
|
self.logger.log(f'Html documents not added to TOC: {not_added}.')
|
||||||
|
self.add_not_added_files_to_adjacency_list(not_added)
|
||||||
# read anchored blocks, split html into separate block
|
# read anchored blocks, split html into separate block
|
||||||
self.unwrap_all_html_soup() # used only after parsed toc, ids from toc needed
|
self.unwrap_all_html_soup() # used only after parsed toc, ids from toc needed
|
||||||
self.process_internal_links()
|
self.process_internal_links()
|
||||||
@@ -183,6 +184,11 @@ class EpubPostprocessor:
|
|||||||
self.adjacency_list[-1].append(node)
|
self.adjacency_list[-1].append(node)
|
||||||
self.added_to_toc_hrefs.add(node.href)
|
self.added_to_toc_hrefs.add(node.href)
|
||||||
|
|
||||||
|
def add_not_added_files_to_adjacency_list(self, not_added):
|
||||||
|
for i, file in enumerate(not_added):
|
||||||
|
node = NavPoint(Section(f'To check #{i}, filename: {file}', file))
|
||||||
|
self.adjacency_list[-1].append(node)
|
||||||
|
|
||||||
def unwrap_all_html_soup(self):
|
def unwrap_all_html_soup(self):
|
||||||
# mark
|
# mark
|
||||||
for href in self.href2soup_html:
|
for href in self.href2soup_html:
|
||||||
|
|||||||
Reference in New Issue
Block a user