From b6d14d49c14f1d051c39ddb2f84689844914d157 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 31 Dec 2011 16:30:22 +0530 Subject: [PATCH] ... --- src/calibre/ebooks/oeb/parse_utils.py | 2 +- src/calibre/ebooks/pml/input.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/parse_utils.py b/src/calibre/ebooks/oeb/parse_utils.py index 3b50301a5b..712427d457 100644 --- a/src/calibre/ebooks/oeb/parse_utils.py +++ b/src/calibre/ebooks/oeb/parse_utils.py @@ -81,7 +81,7 @@ def node_depth(node): def html5_parse(data, max_nesting_depth=100): import html5lib # html5lib bug: http://code.google.com/p/html5lib/issues/detail?id=195 - data = re.sub(r'<\s*title\s*/\s*>', '', data) + data = re.sub(r'<\s*title\s*[^>]*/\s*>', '', data) data = html5lib.parse(data, treebuilder='lxml').getroot() diff --git a/src/calibre/ebooks/pml/input.py b/src/calibre/ebooks/pml/input.py index 91cd457c27..4d59668b12 100644 --- a/src/calibre/ebooks/pml/input.py +++ b/src/calibre/ebooks/pml/input.py @@ -47,7 +47,8 @@ class PMLInput(InputFormatPlugin): self.log.debug('Converting PML to HTML...') hizer = PML_HTMLizer() html = hizer.parse_pml(pml_stream.read().decode(ienc), html_path) - html_stream.write('</head><body>%s</body></html>' % html.encode('utf-8', 'replace')) + html = '<html><head><title>%s'%html + html_stream.write(html.encode('utf-8', 'replace')) if pclose: pml_stream.close()