From f2c6baf630ad989bd4a3f686879a5d94037b9ee0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 9 Jul 2010 09:45:14 -0600 Subject: [PATCH] Fix #6097 (Changing from lrf file to mobi) --- src/calibre/ebooks/lrf/input.py | 2 +- src/calibre/ebooks/lrf/objects.py | 2 +- src/calibre/ebooks/oeb/base.py | 2 +- src/calibre/gui2/tools.py | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/lrf/input.py b/src/calibre/ebooks/lrf/input.py index e9e6c502ec..256ab6fdf2 100644 --- a/src/calibre/ebooks/lrf/input.py +++ b/src/calibre/ebooks/lrf/input.py @@ -367,7 +367,7 @@ class LRFInput(InputFormatPlugin): xml = d.to_xml(write_files=True) if options.verbose > 2: open('lrs.xml', 'wb').write(xml.encode('utf-8')) - parser = etree.XMLParser(recover=True, no_network=True, huge_tree=True) + parser = etree.XMLParser(no_network=True, huge_tree=True) doc = etree.fromstring(xml, parser=parser) char_button_map = {} for x in doc.xpath('//CharButton[@refobj]'): diff --git a/src/calibre/ebooks/lrf/objects.py b/src/calibre/ebooks/lrf/objects.py index 8f69e94013..9f0dd4211c 100644 --- a/src/calibre/ebooks/lrf/objects.py +++ b/src/calibre/ebooks/lrf/objects.py @@ -870,7 +870,7 @@ class Text(LRFStream): open_containers = collections.deque() for c in self.content: if isinstance(c, basestring): - s += prepare_string_for_xml(c) + s += prepare_string_for_xml(c).replace('\0', '') elif c is None: if open_containers: p = open_containers.pop() diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index f48b6f8f51..b5f61db3ac 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -26,7 +26,7 @@ from calibre.ebooks.chardet import xml_to_unicode from calibre.ebooks.oeb.entitydefs import ENTITYDEFS from calibre.ebooks.conversion.preprocess import CSSPreProcessor -RECOVER_PARSER = etree.XMLParser(recover=True, no_network=True, huge_tree=True) +RECOVER_PARSER = etree.XMLParser(recover=True, no_network=True) XML_NS = 'http://www.w3.org/XML/1998/namespace' XHTML_NS = 'http://www.w3.org/1999/xhtml' diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index 1f58f85383..9680b616e3 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -221,6 +221,8 @@ def fetch_scheduled_recipe(arg): if lf.get('base_font_size', 0.0) != 0.0: recs.append(('base_font_size', lf['base_font_size'], OptionRecommendation.HIGH)) + recs.append(('keep_ligatures', lf['keep_ligatures'], + OptionRecommendation.HIGH)) lr = load_defaults('lrf_output') if lr.get('header', False):