mirror of
https://github.com/yihong0618/bilingual_book_maker.git
synced 2025-06-05 19:15:34 +00:00
[bugfix] Fix the wrong typesetting of the generated temporary files (#124)
This commit is contained in:
parent
b25c4ca873
commit
83afab371c
@ -125,21 +125,16 @@ class EPUBBookLoader(BaseBookLoader):
|
|||||||
raise Exception("can not load resume file")
|
raise Exception("can not load resume file")
|
||||||
|
|
||||||
def _save_temp_book(self):
|
def _save_temp_book(self):
|
||||||
origin_book_temp = epub.read_epub(
|
origin_book_temp = epub.read_epub(self.epub_name)
|
||||||
self.epub_name
|
|
||||||
) # we need a new instance for temp save
|
|
||||||
new_temp_book = self._make_new_book(origin_book_temp)
|
new_temp_book = self._make_new_book(origin_book_temp)
|
||||||
p_to_save_len = len(self.p_to_save)
|
p_to_save_len = len(self.p_to_save)
|
||||||
|
trans_taglist = self.translate_tags.split(",")
|
||||||
index = 0
|
index = 0
|
||||||
try:
|
try:
|
||||||
for item in self.origin_book.get_items():
|
for item in origin_book_temp.get_items():
|
||||||
if item.get_type() == ITEM_DOCUMENT:
|
if item.get_type() == ITEM_DOCUMENT:
|
||||||
soup = (
|
soup = bs(item.content, "html.parser")
|
||||||
bs(item.content, "xml")
|
p_list = soup.findAll(trans_taglist)
|
||||||
if item.file_name.endswith(".xhtml")
|
|
||||||
else bs(item.content, "html.parser")
|
|
||||||
)
|
|
||||||
p_list = soup.findAll("p")
|
|
||||||
for p in p_list:
|
for p in p_list:
|
||||||
if not p.text or self._is_special_text(p.text):
|
if not p.text or self._is_special_text(p.text):
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user