forked from LiveCarta/BookConverter
epub converter: add internal links processing 6a
This commit is contained in:
@@ -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']):
|
||||
|
||||
Reference in New Issue
Block a user