From 78fae037c95e6af3d061113d4c370a4d0985a393 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 11 Jun 2021 16:40:15 +0530 Subject: [PATCH] Conversion: Fix the smarten punctuation option not applying to inserted jacket page --- src/calibre/ebooks/oeb/transforms/jacket.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/transforms/jacket.py b/src/calibre/ebooks/oeb/transforms/jacket.py index ee116f4bad..f20953f3c6 100644 --- a/src/calibre/ebooks/oeb/transforms/jacket.py +++ b/src/calibre/ebooks/oeb/transforms/jacket.py @@ -127,7 +127,7 @@ class Jacket(Base): root = render_jacket(mi, self.opts.output_profile, alt_title=title, alt_tags=tags, alt_authors=authors, - alt_comments=comments, rescale_fonts=True) + alt_comments=comments, rescale_fonts=True, smarten_punctuation=self.opts.smarten_punctuation) id, href = self.oeb.manifest.generate('calibre_jacket', 'jacket.xhtml') jacket = self.oeb.manifest.add(id, href, guess_type(href)[0], data=root) @@ -260,7 +260,7 @@ class Identifiers: def render_jacket(mi, output_profile, alt_title=_('Unknown'), alt_tags=[], alt_comments='', - alt_publisher='', rescale_fonts=False, alt_authors=None): + alt_publisher='', rescale_fonts=False, alt_authors=None, smarten_punctuation=False): css = P('jacket/stylesheet.css', data=True).decode('utf-8') template = P('jacket/template.xhtml', data=True).decode('utf-8') @@ -385,6 +385,9 @@ def render_jacket(mi, output_profile, from calibre.ebooks.oeb.polish.parsing import parse raw = generate_html(comments) + if smarten_punctuation: + from calibre.ebooks.conversion.preprocess import smarten_punctuation as sp + raw = sp(raw) root = parse(raw, line_numbers=False, force_html5_parse=True) if rescale_fonts: