forked from LiveCarta/BookConverter
epub converter: small fix
This commit is contained in:
@@ -285,7 +285,7 @@ class EpubConverter:
|
|||||||
|
|
||||||
del internal_link_tag.attrs['href']
|
del internal_link_tag.attrs['href']
|
||||||
|
|
||||||
# 2.a) process anchor which is a an element in xhtml file
|
# 2.b) process anchor which is a an element in xhtml file
|
||||||
internal_link_reg2 = re.compile(r'(^.+\.(html|xhtml)\#.+)|(^\#.+)')
|
internal_link_reg2 = re.compile(r'(^.+\.(html|xhtml)\#.+)|(^\#.+)')
|
||||||
for toc_href in self.added_to_toc_hrefs:
|
for toc_href in self.added_to_toc_hrefs:
|
||||||
soup = self.href2soup_html[toc_href]
|
soup = self.href2soup_html[toc_href]
|
||||||
@@ -304,7 +304,8 @@ class EpubConverter:
|
|||||||
|
|
||||||
if anchor_tags:
|
if anchor_tags:
|
||||||
if len(anchor_tags) > 1:
|
if len(anchor_tags) > 1:
|
||||||
self.logger.log(f'Warning in {toc_href}: multiple anchors: {len(anchor_tags)} found.'
|
self.logger.log(f'Warning in {toc_href}: multiple anchors: {len(anchor_tags)} found.\n'
|
||||||
|
f'{anchor_tags}\n'
|
||||||
f' While processing {internal_link_tag}')
|
f' While processing {internal_link_tag}')
|
||||||
|
|
||||||
anchor_tag = anchor_tags[0]
|
anchor_tag = anchor_tags[0]
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ def unwrap_structural_tags(body_tag):
|
|||||||
|
|
||||||
for s in body_tag.find_all("figure"):
|
for s in body_tag.find_all("figure"):
|
||||||
s.name = 'p'
|
s.name = 'p'
|
||||||
s.attrs['style'] = "text-align: center;"
|
s.attrs['style'] = "text-align: center;" # to center image inside this tag
|
||||||
|
|
||||||
for s in body_tag.find_all("figcaption"):
|
for s in body_tag.find_all("figcaption"):
|
||||||
_add_span_to_save_ids_for_links(s)
|
_add_span_to_save_ids_for_links(s)
|
||||||
@@ -493,6 +493,7 @@ def _prepare_formatted(text):
|
|||||||
text = text.replace(">", "\x3E")
|
text = text.replace(">", "\x3E")
|
||||||
text = text.replace('\t', "\xa0 \xa0 ") #
|
text = text.replace('\t', "\xa0 \xa0 ") #
|
||||||
text = text.replace(' ', "\xa0")
|
text = text.replace(' ', "\xa0")
|
||||||
|
text = text.replace('𝑓', "\xf0\x9d\x91\x93")
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -132,8 +132,8 @@ class BookSolver:
|
|||||||
self.logger_object.log(f'End of the conversion to LawCarta format. Check {self.output_path}.')
|
self.logger_object.log(f'End of the conversion to LawCarta format. Check {self.output_path}.')
|
||||||
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
self.status_wrapper.set_error()
|
||||||
self.logger_object.log('Error has occurred while conversion.', logging.ERROR)
|
self.logger_object.log('Error has occurred while conversion.', logging.ERROR)
|
||||||
self.logger_object.log_error_to_main_log(str(exc))
|
self.logger_object.log_error_to_main_log(str(exc))
|
||||||
self.status_wrapper.set_error()
|
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user