diff --git a/fanficfare/epubutils.py b/fanficfare/epubutils.py index 1cd88ce2..804f3bce 100644 --- a/fanficfare/epubutils.py +++ b/fanficfare/epubutils.py @@ -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 diff --git a/fanficfare/writers/writer_epub.py b/fanficfare/writers/writer_epub.py index 43645717..4d0fea3a 100644 --- a/fanficfare/writers/writer_epub.py +++ b/fanficfare/writers/writer_epub.py @@ -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