commit fafc7e999427dacf15268e38ad793a81a7f68129
parent 87bf3f21e46b87fc077597a218db6ac69004a76b
Author: Simon Kornblith <simon@simonster.com>
Date: Fri, 25 Mar 2011 03:56:45 +0000
fix cslpreview.xul
Diffstat:
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/chrome/content/zotero/tools/cslpreview.xul b/chrome/content/zotero/tools/cslpreview.xul
@@ -111,9 +111,8 @@
Zotero.debug("CSL IGNORE IN-TEXT one");
return '';
}
- var xmlinfo = style.csl._csl.info;
var terms = new Object();
- for each(var cat in xmlinfo.category.@term) {
+ for each(var cat in style.categories) {
Zotero.debug("TERM is " + cat.toString());
terms[cat.toString()] = true;
}
@@ -125,15 +124,22 @@
Zotero.debug("CSL IGNORE this AD");
return '';
}
- var itemSet = style.csl.createItemSet(items);
+ var styleEngine = style.csl;
// Generate multiple citations
- var citation = style.csl.createCitation(itemSet.items);
- var citations = style.csl.formatCitation(citation, "HTML");
+ var citations = styleEngine.previewCitationCluster(
+ {"citationItems":[{"id":item.id} for each(item in items)], "properties":{}},
+ [], [], "html");
// Generate bibliography
- var bibliography = '<p>' + style.csl.formatBibliography(itemSet, "HTML");
- return '<div style="white-space: pre-wrap">' +
+ if(!style.hasBibliography) {
+ var bibliography = '';
+ } else {
+ styleEngine.updateItems([item.id for each(item in items)]);
+ var bibliography = '<p>' + Zotero.Cite.makeFormattedBibliography(styleEngine, "html");
+ }
+
+ return '<div>' +
citations + bibliography + '</div>';
}
diff --git a/chrome/content/zotero/xpcom/style.js b/chrome/content/zotero/xpcom/style.js
@@ -366,6 +366,7 @@ Zotero.Style = function(arg) {
this.styleID = xml.info.id.toString();
this.title = xml.info.title.toString();
this.updated = xml.info.updated.toString().replace(/(.+)T([^\+]+)\+?.*/, "$1 $2");
+ this.categories = [category.@term.toString() for each(category in xml.info) if(category.@term.length())];
this._class = xml.@class.toString();
this._hasBibliography = !!xml.bibliography.length();
this._version = xml.@version.toString();