From fd4cd28545131b76ac67d5bf518586f3e9532bfd Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 23 Mar 2007 19:12:17 +0000 Subject: [PATCH] closes #483, Improve Chicago Manual of Style date/publisher/place handling --- chrome/content/zotero/xpcom/cite.js | 39 ++++-- chrome/locale/en-US/zotero/locales.xml | 2 +- scrapers.sql | 183 +++++++++++++++---------- 3 files changed, 134 insertions(+), 90 deletions(-) diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index 1d6d74170..202878676 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -990,21 +990,32 @@ Zotero.CSL.prototype._serializeElement = function(name, element) { Zotero.CSL.prototype._compareItem = function(a, b, opt) { for(var i in this._bib.sortOrder) { var sortElement = this._bib.sortOrder[i]; - var formattedStringA = new Zotero.CSL.FormattedString(this, "compare"); - var formattedStringB = new Zotero.CSL.FormattedString(this, "compare"); - this._getFieldValue(sortElement.name, sortElement, a, - formattedStringA, this._bib); - this._getFieldValue(sortElement.name, sortElement, b, - formattedStringB, this._bib); - - var aValue = formattedStringA.get().toLowerCase(); - var bValue = formattedStringB.get().toLowerCase(); - - if(bValue > aValue) { - return -1; - } else if(bValue < aValue) { - return 1; + if(sortElement.name == "date") { + var bDate = b.getField("date"); + var aDate = a.getField("date"); + if(bDate > aDate) { + return -1; + } else if(bDate < aDate) { + return 1; + } + } else { + var formattedStringA = new Zotero.CSL.FormattedString(this, "compare"); + var formattedStringB = new Zotero.CSL.FormattedString(this, "compare"); + + this._getFieldValue(sortElement.name, sortElement, a, + formattedStringA, this._bib); + this._getFieldValue(sortElement.name, sortElement, b, + formattedStringB, this._bib); + + var aValue = formattedStringA.get().toLowerCase(); + var bValue = formattedStringB.get().toLowerCase(); + + if(bValue > aValue) { + return -1; + } else if(bValue < aValue) { + return 1; + } } } diff --git a/chrome/locale/en-US/zotero/locales.xml b/chrome/locale/en-US/zotero/locales.xml index a3c9126f1..e05da05d6 100644 --- a/chrome/locale/en-US/zotero/locales.xml +++ b/chrome/locale/en-US/zotero/locales.xml @@ -8,7 +8,7 @@ from forthcoming References - nd + n.d. and et al. diff --git a/scrapers.sql b/scrapers.sql index f315e0a16..b9d0dabd4 100644 --- a/scrapers.sql +++ b/scrapers.sql @@ -1,4 +1,4 @@ --- 202 +-- 203 -- ***** BEGIN LICENSE BLOCK ***** -- @@ -22,7 +22,7 @@ -- Set the following timestamp to the most recent scraper update date -REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-03-23 14:45:00')); +REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-03-23 19:25:00')); REPLACE INTO translators VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '1.0.0b4.r1', '', '2007-03-21 15:26:54', '1', '100', '4', 'Amazon.com', 'Sean Takats', '^https?://(?:www\.)?amazon', 'function detectWeb(doc, url) { @@ -10760,7 +10760,7 @@ function doExport() { } }'); -REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/apa.csl', '2006-12-11 15:57:00', 'American Psychological Association', +REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/apa.csl', '2007-03-23 19:25:00', 'American Psychological Association', ' '); -REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-author-date.csl', '2006-12-20 03:33:00', 'Chicago Manual of Style (Author-Date)', +REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-author-date.csl', '2007-03-23 19:25:00', 'Chicago Manual of Style (Author-Date)', ' '); -REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/chicago-note.csl', '2006-12-20 04:20:00', 'Chicago Manual of Style (Note without Bibliography)', +REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/chicago-note.csl', '2007-03-23 19:25:00', 'Chicago Manual of Style (Note without Bibliography)', ' '); -REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-note-bibliography.csl', '2006-12-20 03:57:00', 'Chicago Manual of Style (Note with Bibliography)', +REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-note-bibliography.csl', '2007-03-23 19:25:00', 'Chicago Manual of Style (Note with Bibliography)', ' '); -REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/mla.csl', '2007-03-23 14:45:00', 'Modern Language Association', +REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/mla.csl', '2007-03-23 19:25:00', 'Modern Language Association', '