forked from LiveCarta/BookConverter
Add attr replacer & svg -> img
This commit is contained in:
@@ -589,13 +589,6 @@ class EpubConverter:
|
||||
content: BeautifulSoup = self.href_chapter_id2soup_html[(nav_point.href, nav_point.id)] \
|
||||
if nav_point.id else self.html_href2html_body_soup[nav_point.href]
|
||||
|
||||
self.book_image_src_path2aws_path = update_images_src_links(content,
|
||||
self.img_href2img_bytes,
|
||||
path_to_html=nav_point.href,
|
||||
access=self.access,
|
||||
path2aws_path=self.book_image_src_path2aws_path,
|
||||
book_id=Path(self.file_path).stem)
|
||||
|
||||
indent = " " * lvl
|
||||
self.logger.log(indent + f"Chapter: {title} is processing.")
|
||||
is_chapter = lvl <= LiveCartaConfig.SUPPORTED_LEVELS
|
||||
@@ -604,6 +597,13 @@ class EpubConverter:
|
||||
self.logger.log(indent + "Process content.")
|
||||
content_preprocessed = self.html_processor.prepare_content(title_preprocessed, content,
|
||||
remove_title_from_chapter=is_chapter)
|
||||
|
||||
self.book_image_src_path2aws_path = update_images_src_links(content_preprocessed,
|
||||
self.img_href2img_bytes,
|
||||
path_to_html=nav_point.href,
|
||||
access=self.access,
|
||||
path2aws_path=self.book_image_src_path2aws_path,
|
||||
book_id=Path(self.file_path).stem)
|
||||
sub_nodes = []
|
||||
# warning! not EpubHtmlItems won't be added to chapter
|
||||
# if it doesn't have subchapters
|
||||
@@ -612,7 +612,7 @@ class EpubConverter:
|
||||
sub_chapter_item = self.html_node_to_livecarta_chapter_item(
|
||||
sub_node, lvl + 1)
|
||||
sub_nodes.append(sub_chapter_item)
|
||||
return ChapterItem(title_preprocessed, content_preprocessed, sub_nodes)
|
||||
return ChapterItem(title_preprocessed, str(content_preprocessed), sub_nodes)
|
||||
|
||||
def convert_to_dict(self) -> dict:
|
||||
"""Function which convert list of html nodes to appropriate json structure"""
|
||||
|
||||
Reference in New Issue
Block a user