mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Metadata jacket: Fix <br> tags in the comments not being rendered correctly when inserting the comments into the jacket page. Fixes #1848327 [Imported metadata is truncated in conversion](https://bugs.launchpad.net/calibre/+bug/1848327)
This commit is contained in:
parent
99ebcf838a
commit
a3f4736b4b
@ -10,8 +10,6 @@ import sys, os, re
|
||||
from xml.sax.saxutils import escape
|
||||
from string import Formatter
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from calibre import guess_type, strftime
|
||||
from calibre.constants import iswindows
|
||||
from calibre.ebooks.oeb.base import XPath, XHTML_NS, XHTML, xml2text, urldefrag, urlnormalize
|
||||
@ -269,7 +267,6 @@ def render_jacket(mi, output_profile,
|
||||
|
||||
comments = mi.comments if mi.comments else alt_comments
|
||||
comments = comments.strip()
|
||||
orig_comments = comments
|
||||
if comments:
|
||||
comments = comments_to_html(comments)
|
||||
|
||||
@ -349,17 +346,10 @@ def render_jacket(mi, output_profile,
|
||||
|
||||
return strip_encoding_declarations(generated_html)
|
||||
|
||||
from calibre.ebooks.oeb.base import RECOVER_PARSER
|
||||
from calibre.ebooks.oeb.polish.parsing import parse
|
||||
raw = generate_html(comments)
|
||||
root = parse(raw, line_numbers=False, force_html5_parse=True)
|
||||
|
||||
try:
|
||||
root = etree.fromstring(generate_html(comments), parser=RECOVER_PARSER)
|
||||
except:
|
||||
try:
|
||||
root = etree.fromstring(generate_html(escape(orig_comments)),
|
||||
parser=RECOVER_PARSER)
|
||||
except:
|
||||
root = etree.fromstring(generate_html(''),
|
||||
parser=RECOVER_PARSER)
|
||||
if rescale_fonts:
|
||||
# We ensure that the conversion pipeline will set the font sizes for
|
||||
# text in the jacket to the same size as the font sizes for the rest of
|
||||
|
Loading…
x
Reference in New Issue
Block a user