[LAW-3447] fix big intervas in paragraphs

This commit is contained in:
shirshasa
2020-06-24 16:23:13 +03:00
parent 93dd40250f
commit acfb5654ea

View File

@@ -399,6 +399,13 @@ class Book:
paragraphs = self.body_tag.find_all('p')
for p in paragraphs:
# libra converts some \n into <p> with 2 </br>
# there we remove 1 unnecessary <br>
brs = p.find_all('br')
text = p.text
if brs and text == '\n\n' and len(brs) == 2:
brs[0].decompose()
align = p.get('align')
style = p.get('style')
@@ -772,7 +779,7 @@ class Book:
il_tag.attrs.update(il_tag.p.attrs)
il_tag.p.unwrap()
def write_html_from_list(self, file_name='url_test.html'):
def write_html_from_list(self, file_name='json/url_test.html'):
folder_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
file_path = pathlib.Path(os.path.join(folder_path, file_name))