Change processing of Section|Part Chapters

This commit is contained in:
Kiryl
2022-07-14 19:09:33 +03:00
parent e1f06ba884
commit 55372561cd

View File

@@ -255,7 +255,7 @@ class EpubConverter:
sub_nodes = []
for elem in second:
if ("section" in first.title.lower() or "part" in first.title.lower()) and lvl == 1:
if (bool(re.search('^section$|^part$', first.title.lower()))) and lvl == 1:
self.offset_sub_nodes.append(
self.build_adjacency_list_from_toc(elem, lvl))
else:
@@ -634,7 +634,7 @@ class EpubConverter:
if __name__ == "__main__":
epub_file_path = "../../epub/9781614382264.epub"
epub_file_path = "../../epub/9780763774134.epub"
logger_object = BookLogger(
name="epub", book_id=epub_file_path.split("/")[-1])