diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index 486f28174..f74585250 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -141,7 +141,7 @@ Zotero.Cite = { if(!co) continue; output.push(' ", ">", "g")+ - '"/>\n'); + '">\n'); } catch(e) { Zotero.logError(e); } @@ -173,105 +173,95 @@ Zotero.Cite = { if(lineSpacing == NaN) throw "Invalid linespacing"; var str; - try { - var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"] - .createInstance(Components.interfaces.nsIDOMParser), - doc = parser.parseFromString(html, "application/xml"); - - var leftMarginDivs = Zotero.Utilities.xpath(doc, '//div[@class="csl-left-margin"]'), - multiField = !!leftMarginDivs.length, - clearEntries = multiField; - - // One of the characters is usually a period, so we can adjust this down a bit - maxOffset = Math.max(1, maxOffset - 2); - - // Force a minimum line height - if(lineSpacing <= 1.35) lineSpacing = 1.35; - - var style = doc.documentElement.getAttribute("style"); - if(!style) style = ""; - style += "line-height: " + lineSpacing + "; "; - - if(hangingIndent) { - if (multiField && !secondFieldAlign) { - throw ("second-field-align=false and hangingindent=true combination is not currently supported"); - } - // If only one field, apply hanging indent on root - else if (!multiField) { - style += "padding-left: " + hangingIndent + "em; text-indent:-" + hangingIndent + "em;"; - } + var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"] + .createInstance(Components.interfaces.nsIDOMParser), + doc = parser.parseFromString(html, "text/html"); + + var leftMarginDivs = Zotero.Utilities.xpath(doc, '//div[@class="csl-left-margin"]'), + multiField = !!leftMarginDivs.length, + clearEntries = multiField; + + // One of the characters is usually a period, so we can adjust this down a bit + maxOffset = Math.max(1, maxOffset - 2); + + // Force a minimum line height + if(lineSpacing <= 1.35) lineSpacing = 1.35; + + var style = doc.documentElement.getAttribute("style"); + if(!style) style = ""; + style += "line-height: " + lineSpacing + "; "; + + if(hangingIndent) { + if (multiField && !secondFieldAlign) { + throw ("second-field-align=false and hangingindent=true combination is not currently supported"); } - - if(style) doc.documentElement.setAttribute("style", style); - - // csl-entry - var divs = Zotero.Utilities.xpath(doc, '//div[@class="csl-entry"]'); - for(var i=0, n=divs.length; i