diff --git a/chrome/content/zotero/xpcom/report.js b/chrome/content/zotero/xpcom/report.js
index 77a20c47c..dc6817049 100644
--- a/chrome/content/zotero/xpcom/report.js
+++ b/chrome/content/zotero/xpcom/report.js
@@ -27,6 +27,9 @@
Zotero.Report = {};
Zotero.Report.HTML = new function () {
+ let domParser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
+ .createInstance(Components.interfaces.nsIDOMParser);
+
this.listGenerator = function* (items, combineChildItems) {
yield '\n'
+ '\n'
@@ -67,25 +70,13 @@ Zotero.Report.HTML = new function () {
if (obj['note']) {
content += '\n\t\t\t';
- // If not valid XML, display notes with entities encoded
- var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
- .createInstance(Components.interfaces.nsIDOMParser);
- var doc = parser.parseFromString('
'
+ let doc = domParser.parseFromString('
'
+ obj.note
- // isn't valid in HTML
- .replace(/ /g, " ")
// Strip control characters (for notes that were
// added before item.setNote() started doing this)
.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, "")
- + '
', "application/xml");
- if (doc.documentElement.tagName == 'parsererror') {
- Zotero.debug(doc.documentElement.textContent, 2);
- content += '
' + escapeXML(obj.note) + '
\n';
- }
- // Otherwise render markup normally
- else {
- content += obj.note + '\n';
- }
+ + '
', "text/html");
+ content += doc.body.innerHTML + '\n';
}
}
@@ -101,24 +92,13 @@ Zotero.Report.HTML = new function () {
for (let note of obj.reportChildren.notes) {
content += '\t\t\t\t\t\n';
- // If not valid XML, display notes with entities encoded
- var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
- .createInstance(Components.interfaces.nsIDOMParser);
- var doc = parser.parseFromString(''
+ let doc = domParser.parseFromString('
'
+ note.note
- .replace(/ /g, " ")
// Strip control characters (for notes that were
// added before item.setNote() started doing this)
.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, "")
- + '
', "application/xml");
- if (doc.documentElement.tagName == 'parsererror') {
- Zotero.debug(doc.documentElement.textContent, 2);
- content += '
' + escapeXML(note.note) + '
\n';
- }
- // Otherwise render markup normally
- else {
- content += note.note + '\n';
- }
+ + '
', "text/html");
+ content += doc.body.innerHTML + '\n';
// Child note tags
content += _generateTagsList(note);