diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py
index 4593957d03..71599805cf 100644
--- a/src/calibre/gui2/comments_editor.py
+++ b/src/calibre/gui2/comments_editor.py
@@ -225,11 +225,12 @@ def cleanup_qt_markup(root):
# }}}
-def fix_html(original_html, original_txt):
+def fix_html(original_html, original_txt, remove_comments=True):
raw = original_html
raw = xml_to_unicode(raw, strip_encoding_pats=True, resolve_entities=True)[0]
- comments_pat = re.compile(r'', re.DOTALL)
- raw = comments_pat.sub('', raw)
+ if remove_comments:
+ comments_pat = re.compile(r'', re.DOTALL)
+ raw = comments_pat.sub('', raw)
if not original_txt and ')()', r'\2\1', html, count=1)
+ ans.setHtml(html)
return ans
def contextMenuEvent(self, ev):
@@ -1255,6 +1266,6 @@ if __name__ == '__main__':
w.html = '''
Test blockquote
He hadn't
set out to have an affair,
much less a long-term, devoted one.
hello''' - w.html = '
Testing a link.
\xa0
ss
Testing a link.
\xa0
ss