This commit is contained in:
Svitin Egor
2025-03-27 10:33:00 +03:00
parent 4121508536
commit e16c23d1ac

View File

@@ -173,6 +173,7 @@ class EpubConverter:
None None
updated soups with styles from css updated soups with styles from css
""" """
for html_href in self.html_href2html_body_soup: for html_href in self.html_href2html_body_soup:
if self.html_href2css_href.get(html_href): if self.html_href2css_href.get(html_href):
css = "" css = ""
@@ -297,15 +298,15 @@ class EpubConverter:
for i in self.html_href2subchapters_ids[html_href]: for i in self.html_href2subchapters_ids[html_href]:
tag = soup.find(id=i) tag = soup.find(id=i)
# in order not to lose tags in verification of same level in chapter # in order not to lose tags in verification of same level in chapter
parent_tags = tag.find_parents(['body', 'p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'header']) parent_tags = tag.find_parents(['body', 'p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5'])
parent_tag = parent_tags[-1] if parent_tags else tag parent_tag = parent_tags[-1] if parent_tags else tag
new_unique_id = self.create_unique_id(html_href, '') new_unique_id = self.create_unique_id(html_href, '')
parent_tag.insert_after(self.create_new_anchor_span_start_page(soup, new_unique_id)) parent_tag.insert_after(self.create_new_anchor_span_start_page(soup, new_unique_id))
self.internal_anchors.add(new_unique_id) self.internal_anchors.add(new_unique_id)
span = soup.find('span', {"role": "doc-pagebreak"}) #span = soup.find('span', {"role": "doc-pagebreak"})
if (span): #if (span):
parent_tag.insert_after(span) # parent_tag.insert_after(span)
tmp_tag = soup.new_tag("lc_tmp") tmp_tag = soup.new_tag("lc_tmp")
tmp_tag.attrs["class"] = "converter-chapter-mark" tmp_tag.attrs["class"] = "converter-chapter-mark"