forked from LiveCarta/BookConverter
add fixes for quotes
This commit is contained in:
14
src/book.py
14
src/book.py
@@ -376,10 +376,7 @@ class Book:
|
|||||||
if margin_left and margin_right and margin_top and margin_bottom and \
|
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_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':
|
margin_top.group(1) == '0.14' and margin_bottom.group(1) == '0.11':
|
||||||
blockquote = BeautifulSoup(features='lxml').new_tag('blockquote')
|
p.wrap(BeautifulSoup(features='lxml').new_tag('blockquote'))
|
||||||
blockquote.append(BeautifulSoup(features='lxml').new_tag('p'))
|
|
||||||
else:
|
|
||||||
blockquote = None
|
|
||||||
|
|
||||||
p.attrs = {}
|
p.attrs = {}
|
||||||
style = ''
|
style = ''
|
||||||
@@ -394,11 +391,6 @@ class Book:
|
|||||||
if style:
|
if style:
|
||||||
p.attrs['style'] = 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):
|
def _process_two_columns(self):
|
||||||
"""
|
"""
|
||||||
Function to process paragraphs which has two columns layout.
|
Function to process paragraphs which has two columns layout.
|
||||||
@@ -799,8 +791,8 @@ class Book:
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
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, 'html/0/quote.html'))
|
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.json'))
|
out_path = pathlib.Path(os.path.join(folder_path, 'json/quote_img.json'))
|
||||||
|
|
||||||
logging_format = '%(asctime)s - %(levelname)s - %(message)s'
|
logging_format = '%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user