- fix issues with subsequent author substitute

- fix comma before "and" with two authors in MLA style citations
This commit is contained in:
Simon Kornblith 2007-03-23 14:29:47 +00:00
parent 0042dde43d
commit f3a16b5e00
2 changed files with 20 additions and 14 deletions

View File

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

View File

@ -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
</bibliography>
</style>');
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',
'<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="../schema/trunk/csl.rnc" type="compact"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="author" xml:lang="en">
@ -11453,7 +11453,7 @@ REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/mla.csl', '2006-
<layout>
<item>
<author form="short">
<name and="text" sort-separator=", " delimiter=", " delimiter-precedes-last="always"/>
<name and="text" sort-separator=", " delimiter=", "/>
</author>
<locator prefix=" "/>
</item>