From 4d03dd8d43caee6ba29e202be7edbcaefadac4ce Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 2 Jun 2008 21:30:01 +0000 Subject: [PATCH] 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 --- chrome/content/zotero/xpcom/cite.js | 15 +++++++++++++-- chrome/content/zotero/xpcom/cite_compat.js | 7 ++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index 7d8d2a298..8049e5cf8 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -25,9 +25,9 @@ * this class handles pulling the CSL file and item data out of the database, * while CSL, below, handles the actual generation of the bibliography */ -default xml namespace = "http://purl.org/net/xbiblio/csl"; - Zotero.Cite = new function() { + default xml namespace = "http://purl.org/net/xbiblio/csl"; + var _lastCSL = 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 */ Zotero.CSL = function(csl) { + default xml namespace = "http://purl.org/net/xbiblio/csl"; + this._csl = new XML(Zotero.CSL.Global.cleanXML(csl)); // initialize CSL @@ -1547,6 +1549,7 @@ Zotero.CSL.Global = new function() { this.cleanXML = cleanXML; this.parseLocales = parseLocales; + default xml namespace = "http://purl.org/net/xbiblio/csl"; this.ns = "http://purl.org/net/xbiblio/csl"; this.__defineGetter__("locale", function() { @@ -1890,6 +1893,8 @@ Zotero.CSL.Citation.prototype.clone = function() { * with "_") are implemented. */ Zotero.CSL.Item = function(item) { + default xml namespace = "http://purl.org/net/xbiblio/csl"; + if(item instanceof Zotero.Item) { this.zoteroItem = item; } else if(parseInt(item, 10) == item) { @@ -2339,6 +2344,8 @@ Zotero.CSL.Item.Name.prototype.getNameVariable = function(variable) { * in an item wrapper. */ Zotero.CSL.ItemSet = function(items, csl) { + default xml namespace = "http://purl.org/net/xbiblio/csl"; + this.csl = csl; 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) { + default xml namespace = "http://purl.org/net/xbiblio/csl"; + this.context = context; this.option = context ? context.option : new XMLList(); this.format = format; @@ -3036,6 +3045,8 @@ Zotero.CSL.FormattedString.prototype.clone = function(delimiter) { * Implementation of FormattedString for sort purposes. */ Zotero.CSL.SortString = function() { + default xml namespace = "http://purl.org/net/xbiblio/csl"; + this.format = "Sort"; this.string = []; } diff --git a/chrome/content/zotero/xpcom/cite_compat.js b/chrome/content/zotero/xpcom/cite_compat.js index a3e34d072..6c1662491 100644 --- a/chrome/content/zotero/xpcom/cite_compat.js +++ b/chrome/content/zotero/xpcom/cite_compat.js @@ -25,7 +25,6 @@ * this class handles pulling the CSL file and item data out of the database, * 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 @@ -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 */ Zotero.CSL.Compat = function(csl) { + default xml namespace = "http://purl.org/net/xbiblio/csl"; + this._csl = new XML(Zotero.CSL.Compat.Global.cleanXML(csl)); // initialize CSL @@ -69,6 +70,8 @@ Zotero.CSL.Compat = function(csl) { Zotero.CSL.Compat.Global = new function() { + default xml namespace = "http://purl.org/net/xbiblio/csl"; + // for elements that inherit defaults from each other this.inherit = { author:"contributor", @@ -125,8 +128,6 @@ Zotero.CSL.Compat.Global = new function() { } }; - - this.ns = "http://purl.org/net/xbiblio/csl"; /*