diff --git a/chrome/content/zotero/xpcom/quickCopy.js b/chrome/content/zotero/xpcom/quickCopy.js
index 22daf86f20..767ebce3f0 100644
--- a/chrome/content/zotero/xpcom/quickCopy.js
+++ b/chrome/content/zotero/xpcom/quickCopy.js
@@ -165,31 +165,185 @@ Zotero.QuickCopy = new function() {
// If all notes, export full content
if (allNotes) {
var content = [];
- for (var i=0; i;
- for (var i=0; i{content[i]}
;
- p.@style = 'white-space: pre-wrap';
- html.p += p;
+ XML.prettyPrinting = false;
+ XML.ignoreWhitespace = false;
+ var htmlXML = ;
+ for (var i=0; i' + noteContent + '');
+ }
+ catch (e) {
+ Zotero.debug(e);
+ Zotero.debug("Couldn't parse note as HTML -- try as CDATA", 2);
+ try {
+ var noteDiv = new XML('');
+ }
+ catch (e) {
+ Zotero.debug("Skipping note", 2);
+ continue;
+ }
+ }
+
+ htmlXML.div += noteDiv;
}
- html = html.toXMLString();
+ // Raw HTML output
+ var html = htmlXML.toXMLString();
+
+ var textXML = htmlXML.copy();
+
+ //
+ // Text-only adjustments
+ //
+
+ if (Zotero.Prefs.get('export.quickCopy.quoteBlockquotes.plainText')) {
+ // Add quotes around blockquote paragraphs
+ var nodes = textXML..blockquote;
+ for (var i in nodes) {
+ for (var j=0, len=nodes[i].p.length(); j=Fx3.5
+ else {
+ text = Zotero.Utilities.prototype.trim()
+ }
+
+ //
+ // Adjustments for the HTML copied to the clipboard
+ //
+
+ // Everything seems to like margin-left better than padding-left
+ var p = htmlXML..p;
+ for (var i in p) {
+ var children = p[i].children();
+ if (p[i].@style.toString().indexOf("padding-left") != -1) {
+ p[i].@style = p[i].@style.toString().replace("padding-left", "margin-left");
+ }
+ }
+
+ // Add quotes around blockquote paragraphs
+ if (Zotero.Prefs.get('export.quickCopy.quoteBlockquotes.richText')) {
+ var nodes = htmlXML..blockquote;
+ for (var i in nodes) {
+ for (var j=0, len=nodes[i].p.length(); j"
+ + "p { margin-top:.1pt;margin-right:0in;margin-bottom:.1pt;margin-left:0in; line-height: 200%; }"
+ + "li { margin-top:.1pt;margin-right:0in;margin-bottom:.1pt;margin-left:0in; line-height: 200%; }"
+ + "blockquote p { margin-left: 11px; margin-right: 11px }"
+ + ""
+ + "\n"
+ + htmlXML.toXMLString();
+ }
+ else {
+ var copyHTML = htmlXML.toXMLString();
+ }
- // Don't copy HTML, since we don't have rich-text notes and
- // copying HTML on Windows just loses newlines (due to
- // unsupported white-space: pre-wrap in Word and OO).
- /*
var content = {
- text: contentType == "html" ? html : content.join('\n\n\n'),
- html: html
- };
- */
- var content = {
- text: contentType == "html" ? html : content.join('\n\n\n')
+ text: contentType == "html" ? html : text,
+ html: copyHTML
};
return content;