epub converter: add internal links processing 7

-figure
-links without id
- img width, height
This commit is contained in:
shirshasa
2021-05-28 15:41:33 +03:00
parent 515f1ef8bd
commit cbc163d973
2 changed files with 40 additions and 0 deletions

View File

@@ -53,6 +53,10 @@ def update_src_links_in_images(body_tag: Tag,
new_folder = save_image_locally(path_to_img_from_root, img_content, 'book_id')
img.attrs['src'] = str(new_folder)
if img.attrs.get('width'):
del img.attrs['width']
if img.attrs.get('height'):
del img.attrs['height']
return path2aws_path
@@ -269,6 +273,14 @@ def unwrap_structural_tags(body_tag):
_add_span_to_save_ids_for_links(s)
s.unwrap()
for s in body_tag.find_all("figure"):
s.name = 'p'
s.attrs['style'] = "text-align: center;"
for s in body_tag.find_all("figcaption"):
_add_span_to_save_ids_for_links(s)
s.unwrap()
for s in body_tag.find_all("aside"):
s.name = 'blockquote'