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):
|
def clean_headings_content(content: Tag, title: str):
|
||||||
|
title = title.lower()
|
||||||
for child in content.contents:
|
for child in content.contents:
|
||||||
if isinstance(child, NavigableString):
|
if isinstance(child, NavigableString):
|
||||||
text = child
|
text = child
|
||||||
@@ -122,6 +123,7 @@ def clean_headings_content(content: Tag, title: str):
|
|||||||
if text and re.sub(r'([\n\t\xa0])', '', text):
|
if text and re.sub(r'([\n\t\xa0])', '', text):
|
||||||
text = re.sub(r'([\n\t\xa0])', ' ', text)
|
text = re.sub(r'([\n\t\xa0])', ' ', text)
|
||||||
text = re.sub(r' +', ' ', text).strip()
|
text = re.sub(r' +', ' ', text).strip()
|
||||||
|
text = text.lower()
|
||||||
if title == text:
|
if title == text:
|
||||||
child.extract()
|
child.extract()
|
||||||
elif (title in text) and (child.name in ['h1', 'h2', 'h3']):
|
elif (title in text) and (child.name in ['h1', 'h2', 'h3']):
|
||||||
|
|||||||
Reference in New Issue
Block a user