Amazon metadata download: Fix paragraphs in the comments being merged. Fixes #1959659 [Metadata download: preserve paragraph tags in comments](https://bugs.launchpad.net/calibre/+bug/1959659)

This commit is contained in:
Kovid Goyal 2022-02-03 13:21:38 +05:30
parent 68b08f4a6a
commit 00d4459071
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 3 deletions

View File

@ -143,7 +143,7 @@ def merge_comments(one, two):
def sanitize_comments_html(html):
from calibre.ebooks.markdown import Markdown
text = html2text(html)
text = html2text(html, single_line_break=False)
md = Markdown()
html = md.convert(text)
return html

View File

@ -2,7 +2,7 @@
# License: GPLv3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
def html2text(html):
def html2text(html, single_line_break=True):
from html2text import HTML2Text
import re
if isinstance(html, bytes):
@ -15,7 +15,7 @@ def html2text(html):
h2t = HTML2Text()
h2t.default_image_alt = _('Unnamed image')
h2t.body_width = 0
h2t.single_line_break = True
h2t.single_line_break = single_line_break
h2t.emphasis_mark = '*'
return h2t.handle(html)