diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 39d0be740a..2a8b9306c8 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -750,7 +750,7 @@ var Zotero_File_Interface = new function() { var clipboardService = Components.classes["@mozilla.org/widget/clipboard;1"]. getService(Components.interfaces.nsIClipboard); style = Zotero.Styles.get(style); - var cslEngine = style.getCiteProc(locale); + var cslEngine = style.getCiteProc(locale, 'html'); if (asCitations) { cslEngine.updateItems(items.map(item => item.id)); @@ -779,11 +779,13 @@ var Zotero_File_Interface = new function() { else { // Generate engine again to work around citeproc-js problem: // https://github.com/zotero/zotero/commit/4a475ff3 - cslEngine = style.getCiteProc(locale); - output = Zotero.Cite.makeFormattedBibliographyOrCitationList(cslEngine, items, "text"); + cslEngine.free(); + cslEngine = style.getCiteProc(locale, 'text'); + output = Zotero.Cite.makeFormattedBibliographyOrCitationList(cslEngine, items, 'text'); } } - + cslEngine.free(); + var str = Components.classes["@mozilla.org/supports-string;1"]. createInstance(Components.interfaces.nsISupportsString); str.data = output; @@ -831,7 +833,7 @@ var Zotero_File_Interface = new function() { } else { var style = Zotero.Styles.get(io.style); - var cslEngine = style.getCiteProc(locale); + var cslEngine = style.getCiteProc(locale, format); var bibliography = Zotero.Cite.makeFormattedBibliographyOrCitationList(cslEngine, items, format, io.mode === "citations"); } diff --git a/chrome/content/zotero/rtfScan.jsx b/chrome/content/zotero/rtfScan.jsx index c0b3c099cd..c8b2b71e99 100644 --- a/chrome/content/zotero/rtfScan.jsx +++ b/chrome/content/zotero/rtfScan.jsx @@ -465,8 +465,7 @@ var Zotero_RTFScan = new function() { // load style and create ItemSet with all items var zStyle = Zotero.Styles.get(document.getElementById("style-listbox").value) var locale = document.getElementById("locale-menu").value; - var style = zStyle.getCiteProc(locale); - style.setOutputFormat("rtf"); + var style = zStyle.getCiteProc(locale, 'rtf'); var isNote = zStyle.class == "note"; // create citations @@ -563,6 +562,8 @@ var Zotero_RTFScan = new function() { } } } + + cslEngine.free(); Zotero.File.putContents(outputFile, contents); diff --git a/chrome/content/zotero/tools/csledit.js b/chrome/content/zotero/tools/csledit.js index b787d46b2e..abb618b2ea 100644 --- a/chrome/content/zotero/tools/csledit.js +++ b/chrome/content/zotero/tools/csledit.js @@ -173,7 +173,7 @@ var Zotero_CSL_Editor = new function() { var selectedLocale = document.getElementById("locale-menu").value; var styleEngine; try { - styleEngine = style.getCiteProc(style.locale || selectedLocale); + styleEngine = style.getCiteProc(style.locale || selectedLocale, 'html'); } catch(e) { iframe.contentDocument.documentElement.innerHTML = '
' + Zotero.getString('styles.editor.warning.parseError') + '
'+e+'
'; throw e; @@ -231,7 +231,7 @@ var Zotero_CSL_Editor = new function() { iframe.contentDocument.documentElement.innerHTML = '
' + Zotero.getString('styles.editor.warning.renderError') + '
'+e+'
'; throw e; } - editor.styleEngine = styleEngine; + styleEngine.free(); } diff --git a/chrome/content/zotero/tools/csledit.xul b/chrome/content/zotero/tools/csledit.xul index bb08bca9a4..29428e7d66 100644 --- a/chrome/content/zotero/tools/csledit.xul +++ b/chrome/content/zotero/tools/csledit.xul @@ -35,6 +35,7 @@ id="csl-edit" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="Zotero_CSL_Editor.init();" + onunload="Zotero_CSL_Editor.onUnload()" title="&styles.editor;">