epub converter: add not added files to toc

This commit is contained in:
shirshasa
2021-07-06 09:36:01 +03:00
parent dbacea7453
commit ee1d87ad8c

View File

@@ -61,6 +61,7 @@ class EpubPostprocessor:
self.build_adjacency_list_from_spine()
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.add_not_added_files_to_adjacency_list(not_added)
# read anchored blocks, split html into separate block
self.unwrap_all_html_soup() # used only after parsed toc, ids from toc needed
self.process_internal_links()
@@ -183,6 +184,11 @@ class EpubPostprocessor:
self.adjacency_list[-1].append(node)
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):
# mark
for href in self.href2soup_html: