From acfb5654eafaf821d0ab9fb5f301bd682f0f4674 Mon Sep 17 00:00:00 2001 From: shirshasa Date: Wed, 24 Jun 2020 16:23:13 +0300 Subject: [PATCH] [LAW-3447] fix big intervas in paragraphs --- src/book.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/book.py b/src/book.py index 78aecbb..87f0802 100644 --- a/src/book.py +++ b/src/book.py @@ -399,6 +399,13 @@ class Book: paragraphs = self.body_tag.find_all('p') for p in paragraphs: + # libra converts some \n into

with 2
+ # there we remove 1 unnecessary
+ 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))