';
+ return;
+ }
+ var progressWin = new Zotero.ProgressWindow();
+ // XXX needs its own string really!
+ progressWin.changeHeadline(Zotero.getString("pane.items.menu.createBib.multiple"));
+ var icon = 'chrome://zotero/skin/treeitem-attachment-file.png';
+ progressWin.addLines(document.title, icon);
+ progressWin.show();
+ progressWin.startCloseTimer();
+ var f = function() {
+ var styles = Zotero.Styles.getAll();
+ // XXX needs its own string really for the title!
+ var str = '';
+ for each(var style in styles) {
+ if (style.source) {
+ continue;
+ }
+ Zotero.debug("Generate Bib for " + style.title);
+ var cite = generateBibliography(style);
+ if (cite) {
+ str += '
' + style.title + '
';
+ str += cite;
+ str += '';
+ }
+ }
+
+ str += '';
+ iframe.contentDocument.documentElement.innerHTML = str;
+ };
+ // Give progress window time to appear
+ setTimeout(f, 100);
+ }
+
+ function generateBibliography(style) {
+ var iframe = document.getElementById('zotero-csl-preview-box');
+
+ var items = Zotero.getActiveZoteroPane().getSelectedItems();
+ if (items.length === 0) {
+ return '';
+ }
+
+ var citationFormat = document.getElementById("citation-format").selectedItem.value;
+ if (citationFormat != "all" && citationFormat != style.categories) {
+ Zotero.debug("CSL IGNORE: citation format is " + style.categories);
+ return '';
+ }
+ var styleEngine = style.getCiteProc();
+
+ // Generate multiple citations
+ var citations = styleEngine.previewCitationCluster(
+ {"citationItems":[{"id":item.id} for each(item in items)], "properties":{}},
+ [], [], "html");
+
+ // Generate bibliography
+ var bibliography = '';
+ if(style.hasBibliography) {
+ styleEngine.updateItems([item.id for each(item in items)]);
+ bibliography = Zotero.Cite.makeFormattedBibliography(styleEngine, "html");
+ }
+
+ return '
' + citations + '
' + bibliography;
+ }
+
+
+}();
diff --git a/chrome/content/zotero/tools/cslpreview.xul b/chrome/content/zotero/tools/cslpreview.xul
index 49f29c7ce..0b984577a 100644
--- a/chrome/content/zotero/tools/cslpreview.xul
+++ b/chrome/content/zotero/tools/cslpreview.xul
@@ -27,120 +27,37 @@
+ %cslpreviewDTD;
+ %zoteroDTD;
+]>
+
+ title="&styles.preview;">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
diff --git a/chrome/locale/en-US/zotero/csledit.dtd b/chrome/locale/en-US/zotero/csledit.dtd
new file mode 100644
index 000000000..3d55e217f
--- /dev/null
+++ b/chrome/locale/en-US/zotero/csledit.dtd
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/chrome/locale/en-US/zotero/cslpreview.dtd b/chrome/locale/en-US/zotero/cslpreview.dtd
new file mode 100644
index 000000000..457b70e19
--- /dev/null
+++ b/chrome/locale/en-US/zotero/cslpreview.dtd
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/chrome/locale/en-US/zotero/preferences.dtd b/chrome/locale/en-US/zotero/preferences.dtd
index 5ae63cf0d..b26eca6d1 100644
--- a/chrome/locale/en-US/zotero/preferences.dtd
+++ b/chrome/locale/en-US/zotero/preferences.dtd
@@ -204,6 +204,6 @@
-
-
-
\ No newline at end of file
+
+
+
diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd
index 98cfc269b..4c509ec00 100644
--- a/chrome/locale/en-US/zotero/zotero.dtd
+++ b/chrome/locale/en-US/zotero/zotero.dtd
@@ -6,6 +6,8 @@
+
+
@@ -288,5 +290,3 @@
-
-
diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties
index f34b9579e..b9b025eea 100644
--- a/chrome/locale/en-US/zotero/zotero.properties
+++ b/chrome/locale/en-US/zotero/zotero.properties
@@ -968,3 +968,12 @@ firstRunGuidance.quickFormat = Type a title or author to search for a reference.
firstRunGuidance.quickFormatMac = Type a title or author to search for a reference.\n\nAfter you've made your selection, click the bubble or press Cmd-\u2193 to add page numbers, prefixes, or suffixes. You can also include a page number along with your search terms to add it directly.\n\nYou can edit citations directly in the word processor document.
firstRunGuidance.toolbarButton.new = Click here to open Zotero, or use the %S keyboard shortcut.
firstRunGuidance.toolbarButton.upgrade = The Zotero icon can now be found in the Firefox toolbar. Click the icon to open Zotero, or use the %S keyboard shortcut.
+
+styles.bibliography = Bibliography
+styles.editor.save = Save Citation Style
+styles.editor.warning.noItems = No items selected in Zotero.
+styles.editor.warning.parseError = Error parsing style:
+styles.editor.warning.renderError = Error generating citations and bibliography:
+styles.editor.output.individualCitations = Individual Citations
+styles.editor.output.singleCitation = Single Citation (with position "first")
+styles.preview.instructions = Select one or more items in Zotero and click the "Refresh" button to see how these items are rendered by the installed CSL citation styles.