This commit is contained in:
Kovid Goyal 2010-11-05 10:14:27 -06:00
commit 0051b04bfd

View File

@ -102,7 +102,7 @@ class HTMLOutput(OutputFormatPlugin):
self.opts = opts self.opts = opts
meta = EasyMeta(oeb_book.metadata) meta = EasyMeta(oeb_book.metadata)
tempdir = PersistentTemporaryDirectory() tempdir = os.path.realpath(PersistentTemporaryDirectory())
output_file = os.path.join(tempdir, output_file = os.path.join(tempdir,
basename(re.sub(r'\.zip', '', output_path)+'.html')) basename(re.sub(r'\.zip', '', output_path)+'.html'))
output_dir = re.sub(r'\.html', '', output_file)+'_files' output_dir = re.sub(r'\.html', '', output_file)+'_files'
@ -151,6 +151,7 @@ class HTMLOutput(OutputFormatPlugin):
head_content = etree.tostring(head, pretty_print=True, encoding='utf-8') head_content = etree.tostring(head, pretty_print=True, encoding='utf-8')
head_content = re.sub(r'\<\/?head.*\>', '', head_content) head_content = re.sub(r'\<\/?head.*\>', '', head_content)
head_content = re.sub(re.compile(r'\<style.*\/style\>', re.M|re.S), '', head_content) head_content = re.sub(re.compile(r'\<style.*\/style\>', re.M|re.S), '', head_content)
head_content = re.sub(r'<(title)([^>]*)/>', r'<\1\2></\1>', head_content)
# get & clean HTML <BODY>-data # get & clean HTML <BODY>-data
body = root.xpath('//h:body', namespaces={'h': 'http://www.w3.org/1999/xhtml'})[0] body = root.xpath('//h:body', namespaces={'h': 'http://www.w3.org/1999/xhtml'})[0]