diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 3e53d00c3..6463d3803 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -509,16 +509,9 @@ var Zotero_File_Interface = new function() { return; } else { - if (io.mode == 'citation') { - var csl = Zotero.Styles.get(format).csl; - csl.updateItems([item.id for each(item in items)]); - var citation = {citationItems:[{id:item.id} for each(item in items)], properties:{}}; - var bibliography = csl.previewCitationCluster(citation, [], [], "html"); - } - else { - var style = Zotero.Styles.get(io.style); - var bibliography = Zotero.Cite.makeFormattedBibliographyOrCitationList(style, items, format); - } + var style = Zotero.Styles.get(io.style); + var bibliography = Zotero.Cite.makeFormattedBibliographyOrCitationList(style, + items, format, io.mode === "citation"); } } catch(e) { window.alert(Zotero.getString("fileInterface.bibliographyGenerationError")); diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index eb2c2a35c..cc5c5c762 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -191,14 +191,18 @@ Zotero.Cite.getBibliographyFormatParameters = function(bib) { * @param {Zotero.Style} style The style to use * @param {Zotero.Item[]} items An array of items * @param {String} format The format of the output + * @param {Boolean} asCitationList Whether to return a list of formatted citations even if + * the style defines a bibliography */ -Zotero.Cite.makeFormattedBibliographyOrCitationList = function(style, items, format) { +Zotero.Cite.makeFormattedBibliographyOrCitationList = function(style, items, format, asCitationList) { var cslEngine = style.csl; cslEngine.setOutputFormat(format); cslEngine.updateItems([item.id for each(item in items)]); - var bibliography = Zotero.Cite.makeFormattedBibliography(cslEngine, format); - if(bibliography) return bibliography; + if(!asCitationList) { + var bibliography = Zotero.Cite.makeFormattedBibliography(cslEngine, format); + if(bibliography) return bibliography; + } var styleClass = style.class; var citations = [cslEngine.appendCitationCluster({"citationItems":[{"id":item.id}], "properties":{}}, true)[0][1]