From 9422182b03d4ed1b382784ece5ee45306ef06f30 Mon Sep 17 00:00:00 2001 From: Kiryl Date: Thu, 23 Jun 2022 12:59:37 +0300 Subject: [PATCH] Fix error with Navigable String doesn't have name --- src/epub_converter/html_epub_preprocessor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/epub_converter/html_epub_preprocessor.py b/src/epub_converter/html_epub_preprocessor.py index 87c98c9..793247c 100644 --- a/src/epub_converter/html_epub_preprocessor.py +++ b/src/epub_converter/html_epub_preprocessor.py @@ -132,7 +132,8 @@ def _remove_headings_content(content_tag, title_of_chapter: str): text = re.sub(r"[\s\xa0]", " ", text).lower() text = text.strip() # delete extra spaces if title_of_chapter == text or \ - (title_of_chapter in text and re.findall(r"^h[1-3]$", tag.name)): + (title_of_chapter in text and + re.findall(r"^h[1-3]$", tag.name or content_tag.name)): _add_span_to_save_ids_for_links(tag, content_tag) tag.extract() elif not isinstance(tag, NavigableString):