epub converter: add internal links processing 6a

This commit is contained in:
shirshasa
2021-05-28 08:22:29 +03:00
parent b00317149d
commit 515f1ef8bd

View File

@@ -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']):