mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont use str(soup)
This commit is contained in:
parent
19d4a453e8
commit
2fc337d779
@ -144,7 +144,7 @@ class CHMReader(CHMFile):
|
|||||||
import shutil
|
import shutil
|
||||||
shutil.copytree(output_dir, os.path.join(debug_dump, 'debug_dump'))
|
shutil.copytree(output_dir, os.path.join(debug_dump, 'debug_dump'))
|
||||||
for lpath in html_files:
|
for lpath in html_files:
|
||||||
with open(lpath, 'r+b') as f:
|
with lopen(lpath, 'r+b') as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
data = self._reformat(data, lpath)
|
data = self._reformat(data, lpath)
|
||||||
if isinstance(data, unicode_type):
|
if isinstance(data, unicode_type):
|
||||||
@ -262,7 +262,7 @@ class CHMReader(CHMFile):
|
|||||||
pass
|
pass
|
||||||
# do not prettify, it would reformat the <pre> tags!
|
# do not prettify, it would reformat the <pre> tags!
|
||||||
try:
|
try:
|
||||||
ans = str(soup)
|
ans = soup.decode_contents()
|
||||||
self.re_encoded_files.add(os.path.abspath(htmlpath))
|
self.re_encoded_files.add(os.path.abspath(htmlpath))
|
||||||
return ans
|
return ans
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user