From 115ecd588226f516764ffe06e377c608163db418 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 23 Dec 2010 12:08:34 -0700 Subject: [PATCH] comments editor: Fixbug that caused loss of comments text if it is entered/pasted as a single paragraph --- src/calibre/gui2/comments_editor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index 3886fd81f1..5d91492875 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -224,8 +224,11 @@ class EditorWidget(QWebView): # {{{ elems = [] for body in root.xpath('//body'): + if body.text: + elems.append('

%s

'%body.text) elems += [html.tostring(x, encoding=unicode) for x in body if - x.tag != 'script'] + x.tag not in ('script', 'style')] + if len(elems) > 1: ans = u'
%s
'%(u''.join(elems)) else: