forked from LiveCarta/BookConverter
fix converting block quotes
-add border checking -quotes before tables
This commit is contained in:
10
src/book.py
10
src/book.py
@@ -468,12 +468,13 @@ class Book:
|
|||||||
tds = table.find_all("td")
|
tds = table.find_all("td")
|
||||||
if len(trs) == 1 and len(tds) == 1 and tds[0].get('width') == '600':
|
if len(trs) == 1 and len(tds) == 1 and tds[0].get('width') == '600':
|
||||||
td = tds[0]
|
td = tds[0]
|
||||||
|
is_zero_border = 'border: none;' in td.get('style')
|
||||||
paragraphs = td.find_all("p")
|
paragraphs = td.find_all("p")
|
||||||
has_i_tag_or_br = [(p.i, p.br) for p in paragraphs]
|
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
|
has_i_tag_or_br = [x[0] is not None or x[1] is not None
|
||||||
for x in has_i_tag_or_br]
|
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')
|
new_div = BeautifulSoup(features='lxml').new_tag('blockquote')
|
||||||
for p in paragraphs:
|
for p in paragraphs:
|
||||||
new_div.append(p)
|
new_div.append(p)
|
||||||
@@ -757,15 +758,14 @@ class Book:
|
|||||||
self._preprocessing_headings()
|
self._preprocessing_headings()
|
||||||
self._process_paragraph()
|
self._process_paragraph()
|
||||||
self._process_two_columns()
|
self._process_two_columns()
|
||||||
# self._process_quotes()
|
|
||||||
|
self.log('Block quotes processing.')
|
||||||
|
self._process_quotes()
|
||||||
|
|
||||||
self.log('Tables processing.')
|
self.log('Tables processing.')
|
||||||
self._process_tables()
|
self._process_tables()
|
||||||
self.log(f'{self.tables_amount} tables have been processed.')
|
self.log(f'{self.tables_amount} tables have been processed.')
|
||||||
|
|
||||||
self.log('Block quotes processing.')
|
|
||||||
self._process_quotes()
|
|
||||||
|
|
||||||
self.log('Footnotes processing.')
|
self.log('Footnotes processing.')
|
||||||
self._process_footnotes()
|
self._process_footnotes()
|
||||||
self.log(f'{len(self.footnotes)} footnotes have been processed.')
|
self.log(f'{len(self.footnotes)} footnotes have been processed.')
|
||||||
|
|||||||
Reference in New Issue
Block a user