Fix for UnNew not working correctly with double quotes in chapter titles. May need to update-always existing epubs.

This commit is contained in:
Jim Miller
2015-09-28 23:36:27 -05:00
parent a2491be351
commit 63eed56f23
2 changed files with 9 additions and 6 deletions
+3 -3
View File
@@ -265,20 +265,20 @@ def reset_orig_chapters_epub(inputio,outfile):
chapterorigtitle = None
tag = soup.find('meta',{'name':'chapterorigtitle'})
if tag:
chapterorigtitle = tag['content']
chapterorigtitle = tag['content'].replace('"','"')
# toctitle is separate for add_chapter_numbers:toconly users.
chaptertoctitle = None
tag = soup.find('meta',{'name':'chaptertoctitle'})
if tag:
chaptertoctitle = tag['content']
chaptertoctitle = tag['content'].replace('"','"')
elif chapterorigtitle:
chaptertoctitle = chapterorigtitle
chaptertitle = None
tag = soup.find('meta',{'name':'chaptertitle'})
if tag:
chaptertitle = tag['content']
chaptertitle = tag['content'].replace('"','"')
if chaptertitle and chapterorigtitle and chapterorigtitle != chaptertitle:
origdata = data
+6 -3
View File
@@ -658,11 +658,14 @@ div { margin: 0pt; padding: 0pt; }
if chap.html:
logger.debug('Writing chapter text for: %s' % chap.title)
vals={'url':removeEntities(chap.url),
'chapter':chap.title,
'origchapter':chap.origtitle,
'tocchapter':chap.toctitle,
'chapter':removeEntities(chap.title),
'origchapter':removeEntities(chap.origtitle),
'tocchapter':removeEntities(chap.toctitle),
'index':"%04d"%(index+1),
'number':index+1}
# escape double quotes in all vals.
for k,v in vals.items():
if isinstance(v,basestring): vals[k]=v.replace('"','"')
fullhtml = CHAPTER_START.substitute(vals) + \
chap.html + CHAPTER_END.substitute(vals)
# ffnet(& maybe others) gives the whole chapter text