From bb0e0169eed43198a2930541dc52d13f8c6c0f5f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 23 Dec 2010 12:25:17 -0700 Subject: [PATCH] comments_to_html: Do not process comments that are already HTML --- src/calibre/library/comments.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/library/comments.py b/src/calibre/library/comments.py index 00a6ef55ae..e78b815857 100644 --- a/src/calibre/library/comments.py +++ b/src/calibre/library/comments.py @@ -51,6 +51,10 @@ def comments_to_html(comments): if not isinstance(comments, unicode): comments = comments.decode(preferred_encoding, 'replace') + if comments.startswith('<'): + # Comment is already HTML do not mess with it + return comments + if '<' not in comments: comments = prepare_string_for_xml(comments) parts = [u'

%s

'%x.replace(u'\n', u'
')