fix cslpreview.xul

This commit is contained in:
Simon Kornblith 2011-03-25 03:56:45 +00:00
parent 87bf3f21e4
commit fafc7e9994
2 changed files with 14 additions and 7 deletions

View File

@ -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>';
}

View File

@ -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();