fix converting block quotes

-add border checking
-quotes before tables
This commit is contained in:
shirshasa
2020-05-27 11:54:05 +03:00
parent c335561b26
commit 35b8e9563c

View File

@@ -468,12 +468,13 @@ class Book:
tds = table.find_all("td")
if len(trs) == 1 and len(tds) == 1 and tds[0].get('width') == '600':
td = tds[0]
is_zero_border = 'border: none;' in td.get('style')
paragraphs = td.find_all("p")
has_i_tag_or_br = [(p.i, p.br) for p in paragraphs]
has_i_tag_or_br = [x[0] is not None or x[1] is not None
for x in has_i_tag_or_br]
if all(has_i_tag_or_br):
if all(has_i_tag_or_br) and is_zero_border:
new_div = BeautifulSoup(features='lxml').new_tag('blockquote')
for p in paragraphs:
new_div.append(p)
@@ -757,15 +758,14 @@ class Book:
self._preprocessing_headings()
self._process_paragraph()
self._process_two_columns()
# self._process_quotes()
self.log('Block quotes processing.')
self._process_quotes()
self.log('Tables processing.')
self._process_tables()
self.log(f'{self.tables_amount} tables have been processed.')
self.log('Block quotes processing.')
self._process_quotes()
self.log('Footnotes processing.')
self._process_footnotes()
self.log(f'{len(self.footnotes)} footnotes have been processed.')