add fixes for quotes

This commit is contained in:
Jeniamakarchik
2020-04-16 13:26:19 +03:00
parent d8352224aa
commit ab5ce00a6a

View File

@@ -376,10 +376,7 @@ class Book:
if margin_left and margin_right and margin_top and margin_bottom and \
margin_left.group(1) == '0.6' and margin_right.group(1) == '0.6' and \
margin_top.group(1) == '0.14' and margin_bottom.group(1) == '0.11':
blockquote = BeautifulSoup(features='lxml').new_tag('blockquote')
blockquote.append(BeautifulSoup(features='lxml').new_tag('p'))
else:
blockquote = None
p.wrap(BeautifulSoup(features='lxml').new_tag('blockquote'))
p.attrs = {}
style = ''
@@ -394,11 +391,6 @@ class Book:
if style:
p.attrs['style'] = style
if blockquote:
blockquote.p.attrs = p.attrs
blockquote.p.string = p.text
p.replace_with(blockquote)
def _process_two_columns(self):
"""
Function to process paragraphs which has two columns layout.
@@ -799,8 +791,8 @@ class Book:
if __name__ == "__main__":
folder_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
file_path = pathlib.Path(os.path.join(folder_path, 'html/0/quote.html'))
out_path = pathlib.Path(os.path.join(folder_path, 'json/quote.json'))
file_path = pathlib.Path(os.path.join(folder_path, 'html/0/quote_img.html'))
out_path = pathlib.Path(os.path.join(folder_path, 'json/quote_img.json'))
logging_format = '%(asctime)s - %(levelname)s - %(message)s'