www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit d8171f775cd96f1e313bb46a3ba49f7b518f858a
parent bdebc8dffaa6ca8833495fefe9c11d0a634d7a71
Author: Simon Kornblith <simon@simonster.com>
Date:   Tue, 29 Aug 2006 17:29:35 +0000

closes #223, citing the same item multiple times should produce only one bibliography entry


Diffstat:
MZotero.dot.dmg | 0
Mchrome/chromeFiles/content/scholar/xpcom/cite.js | 29+++++++++++++++++++----------
Mscrapers.sql | 10+++++++---
3 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/Zotero.dot.dmg b/Zotero.dot.dmg Binary files differ. diff --git a/chrome/chromeFiles/content/scholar/xpcom/cite.js b/chrome/chromeFiles/content/scholar/xpcom/cite.js @@ -108,9 +108,19 @@ CSL = function(csl) { * set items - convert to array and pre-process */ CSL.prototype.setItems = function(items) { + // create a serialized string of all of the unique items var serializedItemString = ""; + + this._items = items; + this._uniqueItems = new Array(); + var existingItems = new Object(); for each(var item in items) { - serializedItemString += item.getID()+","; + var itemID = item.getID(); + if(!existingItems[itemID]) { + existingItems[itemID] = true; + this._uniqueItems.push(item); + serializedItemString += itemID+","; + } } Scholar.debug("CSL: items set to "+serializedItemString); @@ -118,7 +128,6 @@ CSL.prototype.setItems = function(items) { if(serializedItemString != this._serializedItemString) { // only re-process if there are new items this._serializedItemString = serializedItemString; - this._items = items; this._preprocessItems(); } } @@ -192,8 +201,8 @@ CSL.prototype.createBibliography = function(format) { output += "\r\n"; } - for(var i in this._items) { - var item = this._items[i]; + for(var i in this._uniqueItems) { + var item = this._uniqueItems[i]; var string = this._getCitation(item, format, this._bib); @@ -991,8 +1000,8 @@ CSL.prototype._lpad = function(string, pad, length) { */ CSL.prototype._preprocessItems = function() { // get data necessary to generate citations before sorting - for(var i in this._items) { - var item = this._items[i]; + for(var i in this._uniqueItems) { + var item = this._uniqueItems[i]; if(!item._csl) { // namespace everything in item._csl so there's no chance of overlap @@ -1016,9 +1025,9 @@ CSL.prototype._preprocessItems = function() { // sort by sort order if(this._bib.sortOrder) { - Scholar.debug("CSL: sorting this._items"); + Scholar.debug("CSL: sorting items"); var me = this; - this._items.sort(function(a, b) { + this._uniqueItems.sort(function(a, b) { return me._compareItem(a, b); }); } @@ -1027,8 +1036,8 @@ CSL.prototype._preprocessItems = function() { var usedCitations = new Array(); var lastAuthor; - for(var i in this._items) { - var item = this._items[i]; + for(var i in this._uniqueItems) { + var item = this._uniqueItems[i]; var author = this._getFieldValue("author", this._getFieldDefaults("author"), diff --git a/scrapers.sql b/scrapers.sql @@ -5930,15 +5930,19 @@ REPLACE INTO "csl" VALUES('http://purl.org/net/xbiblio/csl/styles/apa.csl', '200 <name>Simon Kornblith</name> <email>simon@simonster.com</email> </contributor> - <updated>2006-08-19T17:12:00-05:00</updated> + <contributor> + <name>Johan Kool</name> + <email>johankool@users.sourceforge.net</email> + </contributor> + <updated>2006-08-24T16:30:00+01:00</updated> </info> <defaults> <contributor name-as-sort-order="no"> - <name and="symbol" initialize-with="."/> + <name and="symbol" initialize-with="." delimiter=", "/> <label term-set="roles-short" prefix=", " text-transform="capitalize" suffix="."/> </contributor> <author name-as-sort-order="all"> - <name and="symbol" sort-separator=", " initialize-with="."/> + <name and="symbol" sort-separator=", " initialize-with="." delimiter=", "/> <label term-set="roles-short" prefix=" (" suffix=".)" text-transform="capitalize"/> <substitute> <choose>