Moving default XML namespace declaration inside CSL objects -- this breaks CSL generation, as far as I can tell, but having the default namespace in the global scope makes dealing with E4X elsewhere very annoying

Creating a follow-up ticket to fix CSL generation
This commit is contained in:
Dan Stillman 2008-06-02 21:30:01 +00:00
parent 392c968315
commit 4d03dd8d43
2 changed files with 17 additions and 5 deletions

View File

@ -25,9 +25,9 @@
* this class handles pulling the CSL file and item data out of the database, * this class handles pulling the CSL file and item data out of the database,
* while CSL, below, handles the actual generation of the bibliography * while CSL, below, handles the actual generation of the bibliography
*/ */
default xml namespace = "http://purl.org/net/xbiblio/csl";
Zotero.Cite = new function() { Zotero.Cite = new function() {
default xml namespace = "http://purl.org/net/xbiblio/csl";
var _lastCSL = null; var _lastCSL = null;
var _lastStyle = null; var _lastStyle = null;
@ -277,6 +277,8 @@ Zotero.Cite.MIMEHandler.StreamListener.prototype.onStopRequest = function(channe
* want to use the Scholar data model, but does want to use CSL in JavaScript * want to use the Scholar data model, but does want to use CSL in JavaScript
*/ */
Zotero.CSL = function(csl) { Zotero.CSL = function(csl) {
default xml namespace = "http://purl.org/net/xbiblio/csl";
this._csl = new XML(Zotero.CSL.Global.cleanXML(csl)); this._csl = new XML(Zotero.CSL.Global.cleanXML(csl));
// initialize CSL // initialize CSL
@ -1547,6 +1549,7 @@ Zotero.CSL.Global = new function() {
this.cleanXML = cleanXML; this.cleanXML = cleanXML;
this.parseLocales = parseLocales; this.parseLocales = parseLocales;
default xml namespace = "http://purl.org/net/xbiblio/csl";
this.ns = "http://purl.org/net/xbiblio/csl"; this.ns = "http://purl.org/net/xbiblio/csl";
this.__defineGetter__("locale", function() { this.__defineGetter__("locale", function() {
@ -1890,6 +1893,8 @@ Zotero.CSL.Citation.prototype.clone = function() {
* with "_") are implemented. * with "_") are implemented.
*/ */
Zotero.CSL.Item = function(item) { Zotero.CSL.Item = function(item) {
default xml namespace = "http://purl.org/net/xbiblio/csl";
if(item instanceof Zotero.Item) { if(item instanceof Zotero.Item) {
this.zoteroItem = item; this.zoteroItem = item;
} else if(parseInt(item, 10) == item) { } else if(parseInt(item, 10) == item) {
@ -2339,6 +2344,8 @@ Zotero.CSL.Item.Name.prototype.getNameVariable = function(variable) {
* in an item wrapper. * in an item wrapper.
*/ */
Zotero.CSL.ItemSet = function(items, csl) { Zotero.CSL.ItemSet = function(items, csl) {
default xml namespace = "http://purl.org/net/xbiblio/csl";
this.csl = csl; this.csl = csl;
this.citation = csl._csl.citation; this.citation = csl._csl.citation;
@ -2714,6 +2721,8 @@ Zotero.CSL.ItemSet.prototype._copyDisambiguation = function(fromItem, toItem) {
} }
Zotero.CSL.FormattedString = function(context, format, delimiter, subsequent) { Zotero.CSL.FormattedString = function(context, format, delimiter, subsequent) {
default xml namespace = "http://purl.org/net/xbiblio/csl";
this.context = context; this.context = context;
this.option = context ? context.option : new XMLList(); this.option = context ? context.option : new XMLList();
this.format = format; this.format = format;
@ -3036,6 +3045,8 @@ Zotero.CSL.FormattedString.prototype.clone = function(delimiter) {
* Implementation of FormattedString for sort purposes. * Implementation of FormattedString for sort purposes.
*/ */
Zotero.CSL.SortString = function() { Zotero.CSL.SortString = function() {
default xml namespace = "http://purl.org/net/xbiblio/csl";
this.format = "Sort"; this.format = "Sort";
this.string = []; this.string = [];
} }

View File

@ -25,7 +25,6 @@
* this class handles pulling the CSL file and item data out of the database, * this class handles pulling the CSL file and item data out of the database,
* while CSL, below, handles the actual generation of the bibliography * while CSL, below, handles the actual generation of the bibliography
*/ */
default xml namespace = "http://purl.org/net/xbiblio/csl";
/* /*
* CSL: a class for creating bibliographies from CSL files * CSL: a class for creating bibliographies from CSL files
@ -33,6 +32,8 @@ default xml namespace = "http://purl.org/net/xbiblio/csl";
* want to use the Scholar data model, but does want to use CSL in JavaScript * want to use the Scholar data model, but does want to use CSL in JavaScript
*/ */
Zotero.CSL.Compat = function(csl) { Zotero.CSL.Compat = function(csl) {
default xml namespace = "http://purl.org/net/xbiblio/csl";
this._csl = new XML(Zotero.CSL.Compat.Global.cleanXML(csl)); this._csl = new XML(Zotero.CSL.Compat.Global.cleanXML(csl));
// initialize CSL // initialize CSL
@ -69,6 +70,8 @@ Zotero.CSL.Compat = function(csl) {
Zotero.CSL.Compat.Global = new function() { Zotero.CSL.Compat.Global = new function() {
default xml namespace = "http://purl.org/net/xbiblio/csl";
// for elements that inherit defaults from each other // for elements that inherit defaults from each other
this.inherit = { this.inherit = {
author:"contributor", author:"contributor",
@ -125,8 +128,6 @@ Zotero.CSL.Compat.Global = new function() {
} }
}; };
this.ns = "http://purl.org/net/xbiblio/csl"; this.ns = "http://purl.org/net/xbiblio/csl";
/* /*