MOBI Input:Fix #1921 (Mobi to Epub conversion)

This commit is contained in:
Kovid Goyal 2009-02-27 09:36:11 -08:00
parent 39e35cf677
commit 6a786fcba4

View file

@ -5,7 +5,7 @@
Read data from .mobi files
'''
import sys, struct, os, cStringIO, re
import sys, struct, os, cStringIO, re, functools
try:
from PIL import Image as PILImage
@ -186,7 +186,9 @@ def extract_content(self, output_dir=os.getcwdu()):
self.processed_html = self.processed_html.decode(self.book_header.codec, 'ignore')
for pat in ENCODING_PATS:
self.processed_html = pat.sub('', self.processed_html)
self.processed_html = re.sub(r'&(\S+?);', entity_to_unicode,
e2u = functools.partial(entity_to_unicode,
exceptions=['lt', 'gt', 'amp', 'apos', 'quot'])
self.processed_html = re.sub(r'&(\S+?);', e2u,
self.processed_html)
self.extract_images(processed_records, output_dir)
self.replace_page_breaks()