Handle lit files with the ampersand character in the names of constituent files.

This commit is contained in:
Kovid Goyal 2008-01-14 21:31:11 +00:00
parent 32f2e3c03d
commit 88055d3e7b
2 changed files with 4 additions and 3 deletions

View File

@ -250,7 +250,6 @@ class HTMLConverter(object):
paths = [os.path.abspath(path) for path in paths]
while len(paths) > 0 and self.link_level <= self.link_levels:
for path in paths:
if path in self.processed_files:
@ -347,6 +346,8 @@ class HTMLConverter(object):
self.file_name = os.path.basename(path)
self.logger.info('Processing %s', path if self.verbose else self.file_name)
upath = path.encode('utf-8') if isinstance(path, unicode) else path
if not os.path.exists(upath):
upath = upath.replace('&', '%26') #convertlit replaces & with %26 in file names
raw = open(upath, 'rb').read()
soup = self.preprocess(raw)
self.logger.info('\tConverting to BBeB...')

View File

@ -65,7 +65,7 @@ def process_file(path, options, logger=None):
if opf:
path = opf[0]
opf = OPFReader(path)
htmlfile = opf.spine.items().next().href
htmlfile = opf.spine.items().next().href.replace('&', '%26') #convertlit replaces & with %26
options.opf = path
else:
l = glob.glob(os.path.join(tdir, '*toc*.htm*'))