mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
CHM Input: Another workaround for a Microsoft mess. Fixes #763336 (Private bug)
This commit is contained in:
parent
73ef5b9991
commit
5d44a60fda
@ -52,6 +52,9 @@ class CHMInput(InputFormatPlugin):
|
|||||||
|
|
||||||
metadata = get_metadata_from_reader(self._chm_reader)
|
metadata = get_metadata_from_reader(self._chm_reader)
|
||||||
self._chm_reader.CloseCHM()
|
self._chm_reader.CloseCHM()
|
||||||
|
#print tdir
|
||||||
|
#from calibre import ipython
|
||||||
|
#ipython()
|
||||||
|
|
||||||
odi = options.debug_pipeline
|
odi = options.debug_pipeline
|
||||||
options.debug_pipeline = None
|
options.debug_pipeline = None
|
||||||
|
@ -147,7 +147,8 @@ class CHMReader(CHMFile):
|
|||||||
if self.hhc_path == '.hhc' and self.hhc_path not in files:
|
if self.hhc_path == '.hhc' and self.hhc_path not in files:
|
||||||
from calibre import walk
|
from calibre import walk
|
||||||
for x in walk(output_dir):
|
for x in walk(output_dir):
|
||||||
if os.path.basename(x).lower() in ('index.htm', 'index.html'):
|
if os.path.basename(x).lower() in ('index.htm', 'index.html',
|
||||||
|
'contents.htm', 'contents.html'):
|
||||||
self.hhc_path = os.path.relpath(x, output_dir)
|
self.hhc_path = os.path.relpath(x, output_dir)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ from calibre.translations.dynamic import translate
|
|||||||
from calibre.ebooks.chardet import xml_to_unicode
|
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
|
||||||
from calibre import isbytestring
|
from calibre import isbytestring, as_unicode
|
||||||
|
|
||||||
RECOVER_PARSER = etree.XMLParser(recover=True, no_network=True)
|
RECOVER_PARSER = etree.XMLParser(recover=True, no_network=True)
|
||||||
|
|
||||||
@ -643,7 +643,7 @@ class Metadata(object):
|
|||||||
return unicode(self.value).encode('ascii', 'xmlcharrefreplace')
|
return unicode(self.value).encode('ascii', 'xmlcharrefreplace')
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return unicode(self.value)
|
return as_unicode(self.value)
|
||||||
|
|
||||||
def to_opf1(self, dcmeta=None, xmeta=None, nsrmap={}):
|
def to_opf1(self, dcmeta=None, xmeta=None, nsrmap={}):
|
||||||
attrib = {}
|
attrib = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user