forked from LiveCarta/BookConverter
epub converter: prettify <pre>
This commit is contained in:
@@ -384,12 +384,13 @@ def get_tags_between_chapter_marks(first_id, href, html_soup):
|
|||||||
|
|
||||||
def wrap_span_with_table(main_tag, old_tag):
|
def wrap_span_with_table(main_tag, old_tag):
|
||||||
table = main_tag.new_tag("table")
|
table = main_tag.new_tag("table")
|
||||||
table.attrs['border'] = '0'
|
table.attrs['border'] = '1px solid #ccc;'
|
||||||
table.attrs['style'] = 'width:100%;'
|
table.attrs['style'] = 'width:100%;'
|
||||||
tbody = main_tag.new_tag("tbody")
|
tbody = main_tag.new_tag("tbody")
|
||||||
tr = main_tag.new_tag("tr")
|
tr = main_tag.new_tag("tr")
|
||||||
td = main_tag.new_tag("td")
|
td = main_tag.new_tag("td")
|
||||||
td.attrs['bgcolor'] = '#f5f5f5'
|
td.attrs['bgcolor'] = '#f5f5f5'
|
||||||
|
td.attrs['border-radius'] = '4px'
|
||||||
old_tag.wrap(td)
|
old_tag.wrap(td)
|
||||||
td.wrap(tr)
|
td.wrap(tr)
|
||||||
tr.wrap(tbody)
|
tr.wrap(tbody)
|
||||||
@@ -418,7 +419,10 @@ def preprocess_pre_tags(chapter_tag):
|
|||||||
"font-size: 14px; white-space: pre-wrap;"
|
"font-size: 14px; white-space: pre-wrap;"
|
||||||
pre.insert_before(new_tag)
|
pre.insert_before(new_tag)
|
||||||
pre.extract()
|
pre.extract()
|
||||||
wrap_span_with_table(chapter_tag, new_tag)
|
table = wrap_span_with_table(chapter_tag, new_tag)
|
||||||
|
p_for_br = chapter_tag.new_tag("p")
|
||||||
|
p_for_br.string = "\xa0"
|
||||||
|
table.insert_after(p_for_br)
|
||||||
|
|
||||||
|
|
||||||
def preprocess_code_tags(chapter_tag):
|
def preprocess_code_tags(chapter_tag):
|
||||||
|
|||||||
Reference in New Issue
Block a user