From 5d4159690ffdeea9c723d85b501139931ee97fcb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 21 Oct 2008 18:15:16 -0700 Subject: [PATCH] Fix #1184 (Error CSSStyleDeclaration: Unexpected token) --- src/calibre/ebooks/html.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/html.py b/src/calibre/ebooks/html.py index a1ec03a16e..02e6a1b580 100644 --- a/src/calibre/ebooks/html.py +++ b/src/calibre/ebooks/html.py @@ -151,7 +151,7 @@ class HTMLFile(object): HTML_PAT = re.compile(r'<\s*html', re.IGNORECASE) TITLE_PAT = re.compile('([^<>]+)', re.IGNORECASE) LINK_PAT = re.compile( - r'<\s*a\s+.*?href\s*=\s*(?:(?:"(?P[^"]+)")|(?:\'(?P[^\']+)\')|(?P[^\s]+))', + r'<\s*a\s+.*?href\s*=\s*(?:(?:"(?P[^"]+)")|(?:\'(?P[^\']+)\')|(?P[^\s>]+))', re.DOTALL|re.IGNORECASE) def __init__(self, path_to_html_file, level, encoding, verbose, referrer=None): @@ -487,7 +487,7 @@ class Parser(PreProcessor, LoggingInterface): os.makedirs(tdir) with open(os.path.join(tdir, '%s-%s.html'%\ (os.path.basename(self.htmlfile.path), name)), 'wb') as f: - f.write(tostring(self.root, encoding='utf-8')) + f.write(tostring(self.root)) self.log_debug(_('Written processed HTML to ')+f.name)