From 8e0fb42c18ee784a5053a28a1502f8059b3319ce Mon Sep 17 00:00:00 2001 From: shirshasa Date: Wed, 7 Jul 2021 13:19:43 +0300 Subject: [PATCH] epub converter: prettify

---
 src/html_epub_preprocessor.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/html_epub_preprocessor.py b/src/html_epub_preprocessor.py
index c70d966..ff50c4c 100644
--- a/src/html_epub_preprocessor.py
+++ b/src/html_epub_preprocessor.py
@@ -384,12 +384,13 @@ def get_tags_between_chapter_marks(first_id, href, html_soup):
 
 def wrap_span_with_table(main_tag, old_tag):
     table = main_tag.new_tag("table")
-    table.attrs['border'] = '0'
+    table.attrs['border'] = '1px solid #ccc;'
     table.attrs['style'] = 'width:100%;'
     tbody = main_tag.new_tag("tbody")
     tr = main_tag.new_tag("tr")
     td = main_tag.new_tag("td")
     td.attrs['bgcolor'] = '#f5f5f5'
+    td.attrs['border-radius'] = '4px'
     old_tag.wrap(td)
     td.wrap(tr)
     tr.wrap(tbody)
@@ -418,7 +419,10 @@ def preprocess_pre_tags(chapter_tag):
                                  "font-size: 14px; white-space: pre-wrap;"
         pre.insert_before(new_tag)
         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):