Fix #6097 (Changing from lrf file to mobi)

This commit is contained in:
Kovid Goyal 2010-07-09 09:45:14 -06:00
parent 961b76ce6d
commit f2c6baf630
4 changed files with 5 additions and 3 deletions

View File

@ -367,7 +367,7 @@ class LRFInput(InputFormatPlugin):
xml = d.to_xml(write_files=True) xml = d.to_xml(write_files=True)
if options.verbose > 2: if options.verbose > 2:
open('lrs.xml', 'wb').write(xml.encode('utf-8')) 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) doc = etree.fromstring(xml, parser=parser)
char_button_map = {} char_button_map = {}
for x in doc.xpath('//CharButton[@refobj]'): for x in doc.xpath('//CharButton[@refobj]'):

View File

@ -870,7 +870,7 @@ class Text(LRFStream):
open_containers = collections.deque() open_containers = collections.deque()
for c in self.content: for c in self.content:
if isinstance(c, basestring): if isinstance(c, basestring):
s += prepare_string_for_xml(c) s += prepare_string_for_xml(c).replace('\0', '')
elif c is None: elif c is None:
if open_containers: if open_containers:
p = open_containers.pop() p = open_containers.pop()

View File

@ -26,7 +26,7 @@ from calibre.ebooks.chardet import xml_to_unicode
from calibre.ebooks.oeb.entitydefs import ENTITYDEFS from calibre.ebooks.oeb.entitydefs import ENTITYDEFS
from calibre.ebooks.conversion.preprocess import CSSPreProcessor 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' XML_NS = 'http://www.w3.org/XML/1998/namespace'
XHTML_NS = 'http://www.w3.org/1999/xhtml' XHTML_NS = 'http://www.w3.org/1999/xhtml'

View File

@ -221,6 +221,8 @@ def fetch_scheduled_recipe(arg):
if lf.get('base_font_size', 0.0) != 0.0: if lf.get('base_font_size', 0.0) != 0.0:
recs.append(('base_font_size', lf['base_font_size'], recs.append(('base_font_size', lf['base_font_size'],
OptionRecommendation.HIGH)) OptionRecommendation.HIGH))
recs.append(('keep_ligatures', lf['keep_ligatures'],
OptionRecommendation.HIGH))
lr = load_defaults('lrf_output') lr = load_defaults('lrf_output')
if lr.get('header', False): if lr.get('header', False):