diff --git a/src/html_epub_preprocessor.py b/src/html_epub_preprocessor.py index d226fe5..744ed08 100644 --- a/src/html_epub_preprocessor.py +++ b/src/html_epub_preprocessor.py @@ -114,6 +114,7 @@ def _process_lists(body_tag): def clean_headings_content(content: Tag, title: str): + title = title.lower() for child in content.contents: if isinstance(child, NavigableString): text = child @@ -122,6 +123,7 @@ def clean_headings_content(content: Tag, title: str): if text and re.sub(r'([\n\t\xa0])', '', text): text = re.sub(r'([\n\t\xa0])', ' ', text) text = re.sub(r' +', ' ', text).strip() + text = text.lower() if title == text: child.extract() elif (title in text) and (child.name in ['h1', 'h2', 'h3']):