forked from LiveCarta/BookConverter
[LAW-3447] fix big intervas in paragraphs
This commit is contained in:
@@ -399,6 +399,13 @@ class Book:
|
|||||||
paragraphs = self.body_tag.find_all('p')
|
paragraphs = self.body_tag.find_all('p')
|
||||||
|
|
||||||
for p in paragraphs:
|
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')
|
align = p.get('align')
|
||||||
style = p.get('style')
|
style = p.get('style')
|
||||||
|
|
||||||
@@ -772,7 +779,7 @@ class Book:
|
|||||||
il_tag.attrs.update(il_tag.p.attrs)
|
il_tag.attrs.update(il_tag.p.attrs)
|
||||||
il_tag.p.unwrap()
|
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__)))
|
folder_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
file_path = pathlib.Path(os.path.join(folder_path, file_name))
|
file_path = pathlib.Path(os.path.join(folder_path, file_name))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user