From f3a16b5e009972f1bea65ca01aac38af6576543e Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 23 Mar 2007 14:29:47 +0000 Subject: [PATCH] - fix issues with subsequent author substitute - fix comma before "and" with two authors in MLA style citations --- chrome/content/zotero/xpcom/cite.js | 26 ++++++++++++++++---------- scrapers.sql | 8 ++++---- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index 7590dd47d..be870adb2 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -359,20 +359,28 @@ Zotero.CSL.prototype.preprocessItems = function(items) { // disambiguate items after preprocessing and sorting var usedCitations = new Array(); - var lastAuthor; + var lastAuthors; for(var i in items) { var item = items[i]; - var formattedString = new Zotero.CSL.FormattedString(this, "disambiguate"); - this._getFieldValue("author", this._getFieldDefaults("author"), item, - formattedString, this._bib); - var author = formattedString.get(); - // handle subsequent author substitutes - if(lastAuthor == author) { - item._csl.subsequentAuthorSubstitute = true; + Zotero.debug(item.getField("title")); + if(item._csl.authors.length && lastAuthors) { + var authorsAreSame = true; + for(var i=item._csl.authors.length-1; i>=0; i--) { + Zotero.debug(i); + if(!lastAuthors[i] || + lastAuthors[i].firstName != item._csl.authors[i].firstName || + lastAuthors[i].lastName != item._csl.authors[i].lastName || + lastAuthors[i].creatorType != item._csl.authors[i].creatorType) { + authorsAreSame = false; + break; + } + } + if(authorsAreSame) item._csl.subsequentAuthorSubstitute = true; } + lastAuthors = item._csl.authors; // handle (2006a) disambiguation for author-date styles if(this.class == "author-date") { @@ -409,8 +417,6 @@ Zotero.CSL.prototype.preprocessItems = function(items) { usedCitations[year] = item; } - lastAuthor = author; - // add numbers to each item._csl.number = i; } diff --git a/scrapers.sql b/scrapers.sql index e615feb2f..f315e0a16 100644 --- a/scrapers.sql +++ b/scrapers.sql @@ -1,4 +1,4 @@ --- 201 +-- 202 -- ***** 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-22 23:26:24')); +REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-03-23 14:45: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) { @@ -11390,7 +11390,7 @@ REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-note-bibli '); -REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/mla.csl', '2006-10-23 00:21:00', 'Modern Language Association', +REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/mla.csl', '2007-03-23 14:45:00', 'Modern Language Association', '