forked from LiveCarta/BookConverter
make heading removal only for hs
This commit is contained in:
@@ -99,11 +99,13 @@ class HtmlEpubProcessor:
|
|||||||
return text
|
return text
|
||||||
|
|
||||||
title_of_chapter: str = title_of_chapter.lower()
|
title_of_chapter: str = title_of_chapter.lower()
|
||||||
title_in_text: List[Tag] = chapter_tag.find_all(lambda tag: title_of_chapter == text_preparing(tag) or \
|
title_in_text: List[Tag] = chapter_tag.find_all(lambda tag: (title_of_chapter in text_preparing(tag) and
|
||||||
(title_of_chapter in text_preparing(tag) and
|
len(text_preparing(tag)) != 0 and
|
||||||
re.findall(r"^h[1-3]$", tag.name or chapter_tag.name)))
|
re.findall(r"^h[1-5]$", tag.name or chapter_tag.name)))
|
||||||
|
|
||||||
text_in_title: List[Tag] = chapter_tag.find_all(lambda tag: (text_preparing(tag) in title_of_chapter))
|
text_in_title: List[Tag] = chapter_tag.find_all(lambda tag: (text_preparing(tag) in title_of_chapter) and
|
||||||
|
len(text_preparing(tag)) != 0 and
|
||||||
|
re.findall(r"^h[1-5]$", tag.name or chapter_tag.name))
|
||||||
if title_in_text:
|
if title_in_text:
|
||||||
self.html_preprocessor._add_span_to_save_ids_for_links(
|
self.html_preprocessor._add_span_to_save_ids_for_links(
|
||||||
title_in_text[-1], chapter_tag)
|
title_in_text[-1], chapter_tag)
|
||||||
|
|||||||
Reference in New Issue
Block a user