Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yihong0618 authored Mar 13, 2023
1 parent f0b226f commit 20b4d59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion book_maker/loader/epub_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def load_state(self):
raise Exception("can not load resume file")

def _save_temp_book(self):
# TODO refactor this logic
origin_book_temp = epub.read_epub(self.epub_name)
new_temp_book = self._make_new_book(origin_book_temp)
p_to_save_len = len(self.p_to_save)
Expand All @@ -154,6 +155,8 @@ def _save_temp_book(self):
if item.get_type() == ITEM_DOCUMENT:
soup = bs(item.content, "html.parser")
p_list = soup.findAll(trans_taglist)
if self.allow_navigable_strings:
p_list.extend(soup.findAll(text=True))
for p in p_list:
if not p.text or self._is_special_text(p.text):
continue
Expand All @@ -162,7 +165,6 @@ def _save_temp_book(self):
if index < p_to_save_len:
new_p = copy(p)
new_p.string = self.p_to_save[index]
print(new_p.string)
p.insert_after(new_p)
index += 1
else:
Expand Down

0 comments on commit 20b4d59

Please sign in to comment.