From e5d96395490890c2bcf069ee55dfd1e1659a78b2 Mon Sep 17 00:00:00 2001 From: Elena Razlogova Date: Wed, 28 Nov 2007 16:44:58 +0000 Subject: [PATCH] Addresses #842, Mappings required --- .../zotero/locale/csl/locales-en-US.xml | 4 ++ chrome/content/zotero/xpcom/cite.js | 23 ++++++---- chrome/content/zotero/xpcom/cite_compat.js | 42 +++++++++++++------ 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/chrome/content/zotero/locale/csl/locales-en-US.xml b/chrome/content/zotero/locale/csl/locales-en-US.xml index 987d35036..1ffc4f611 100644 --- a/chrome/content/zotero/locale/csl/locales-en-US.xml +++ b/chrome/content/zotero/locale/csl/locales-en-US.xml @@ -12,6 +12,8 @@ n.d. and et al. + interview + letter @@ -129,6 +131,8 @@ edited by translated by + to + interview by ed diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index 2a01d75dd..6ded9a60e 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -309,6 +309,8 @@ Zotero.CSL._dateVariables = { Zotero.CSL._namesVariables = { "editor":true, "translator":true, + "recipient":true, + "interviewer":true, "author":true } @@ -1765,7 +1767,7 @@ Zotero.CSL.Item._zoteroFieldMap = { "title":"title", "container-title":"publicationTitle", "collection-title":["seriesTitle", "series"], - "publisher":"publisher", + "publisher":["publisher", "distributor"], "publisher-place":"place", "page":"pages", "volume":"volume", @@ -1773,6 +1775,11 @@ Zotero.CSL.Item._zoteroFieldMap = { "number-of-volumes":"numberOfVolumes", "edition":"edition", "genre":"type", + "medium":"medium", + "archive":"repository", + "archive_location":"archiveLocation", + "event":"meetingName", + "event-place":"place", "abstract":"abstractNote", "URL":"url", "DOI":"DOI", @@ -1843,7 +1850,7 @@ Zotero.CSL.Item._optionalTypeMap = { film:"motion_picture", artwork:"graphic", webpage:"webpage", - report:"paper-conference", // ?? + report:"book", // ?? bill:"bill", case:"legal_case", hearing:"bill", // ?? @@ -1870,10 +1877,10 @@ Zotero.CSL.Item._fallbackTypeMap = { journalArticle:"article", magazineArticle:"article", newspaperArticle:"article", - thesis:"book", + thesis:"article", letter:"article", - manuscript:"book", - interview:"book", + manuscript:"article", + interview:"article", film:"book", artwork:"book", webpage:"article", @@ -1888,9 +1895,9 @@ Zotero.CSL.Item._fallbackTypeMap = { blogPost:"article", instantMessage:"article", forumPost:"article", - audioRecording:"article", + audioRecording:"book", presentation:"article", - videoRecording:"article", + videoRecording:"book", tvBroadcast:"article", radioBroadcast:"article", podcast:"article", @@ -2159,6 +2166,8 @@ Zotero.CSL.ItemSet.prototype.resort = function() { var names = this.items[i].getNames("author"); if(!names) names = this.items[i].getNames("editor"); if(!names) names = this.items[i].getNames("translator"); + if(!names) names = this.items[i].getNames("recipient"); + if(!names) names = this.items[i].getNames("interviewer"); if(!names) continue; namesByItem[i] = names; } diff --git a/chrome/content/zotero/xpcom/cite_compat.js b/chrome/content/zotero/xpcom/cite_compat.js index ecadb4045..955c97b0f 100644 --- a/chrome/content/zotero/xpcom/cite_compat.js +++ b/chrome/content/zotero/xpcom/cite_compat.js @@ -74,6 +74,8 @@ Zotero.CSL.Compat.Global = new function() { author:"contributor", editor:"contributor", translator:"contributor", + recipient:"contributor", + interviewer:"contributor", pages:"locator", volume:"locator", issue:"locator", @@ -92,7 +94,7 @@ Zotero.CSL.Compat.Global = new function() { "graphic":"article", "interview":"article", "legal case":"article", - "manuscript":"book", + "manuscript":"article", "map":"article", "motion picture":"book", "musical score":"article", @@ -103,7 +105,7 @@ Zotero.CSL.Compat.Global = new function() { "report":"book", "song":"article", "speech":"article", - "thesis":"book", + "thesis":"article", "treaty":"article", "webpage":"article", } @@ -401,11 +403,13 @@ Zotero.CSL.Compat.ItemSet.prototype.resort = function() { item._csl = new Object(); item._csl.dateModified = dateModified; - // separate item into authors, editors, translators + // separate item into authors, editors, translators, recipients, interviewers var creators = this.csl._separateItemCreators(item); item._csl.authors = creators[0]; item._csl.editors = creators[1]; item._csl.translators = creators[2]; + item._csl.recipients = creators[3]; + item._csl.interviewers = creators[4]; // parse date item._csl.date = Zotero.CSL.Compat.prototype._processDate(this.csl._getField(item, "date")); @@ -1284,6 +1288,10 @@ Zotero.CSL.Compat.prototype._getFieldValue = function(name, element, item, forma dataAppended = formattedString.concat(this._processCreators(name, element, item._csl.editors, formattedString.format, bibCitElement, position), element); } else if(name == "translator") { dataAppended = formattedString.concat(this._processCreators(name, element, item._csl.translators, formattedString.format, bibCitElement, position), element); + } else if(name == "recipient") { + dataAppended = formattedString.concat(this._processCreators(name, element, item._csl.recipients, formattedString.format, bibCitElement, position), element); + } else if(name == "interviewer") { + dataAppended = formattedString.concat(this._processCreators(name, element, item._csl.interviewers, formattedString.format, bibCitElement, position), element); } else if(name == "titles") { var data = new Zotero.CSL.Compat.FormattedString(this, formattedString.format); @@ -1865,22 +1873,22 @@ Zotero.CSL.Compat.FormattedString.prototype.appendDate = function(date, element) magazineArticle:"article-magazine", newspaperArticle:"article-newspaper", thesis:"thesis", - letter:"personal communication", + letter:"personal_communication", manuscript:"manuscript", interview:"interview", film:"motion picture", artwork:"graphic", webpage:"webpage", - report:"paper-conference", // ?? + report:"book", // ?? bill:"bill", case:"legal case", hearing:"bill", // ?? patent:"patent", statute:"bill", // ?? - email:"personal communication", + email:"personal_communication", map:"map", blogPost:"webpage", - instantMessage:"personal communication", + instantMessage:"personal_communication", forumPost:"webpage", audioRecording:"song", // ?? presentation:"paper-conference", @@ -1899,8 +1907,8 @@ Zotero.CSL.Compat.Global.fallbackTypeMappings = { newspaperArticle:"article", thesis:"book", letter:"article", - manuscript:"book", - interview:"book", + manuscript:"article", + interview:"article", film:"book", artwork:"book", webpage:"article", @@ -1915,9 +1923,9 @@ Zotero.CSL.Compat.Global.fallbackTypeMappings = { blogPost:"article", instantMessage:"article", forumPost:"article", - audioRecording:"article", + audioRecording:"book", presentation:"article", - videoRecording:"article", + videoRecording:"book", tvBroadcast:"article", radioBroadcast:"article", podcast:"article", @@ -1948,16 +1956,20 @@ Zotero.CSL.Compat.prototype._getTypeFromItem = function(item) { } /* - * separate creators object into authors, editors, and translators + * separate creators object into authors, editors, translators, recipients, and interviewers */ Zotero.CSL.Compat.prototype._separateItemCreators = function(item) { var authors = new Array(); var editors = new Array(); var translators = new Array(); + var recipients = new Array(); + var interviewers = new Array(); var authorID = Zotero.CreatorTypes.getPrimaryIDForType(item.getType()); var editorID = Zotero.CreatorTypes.getID("editor"); var translatorID = Zotero.CreatorTypes.getID("translator"); + var recipientID = Zotero.CreatorTypes.getID("recipient"); + var interviewerID = Zotero.CreatorTypes.getID("interviewer"); var creators = item.getCreators(); for each(var creator in creators) { @@ -1965,13 +1977,17 @@ Zotero.CSL.Compat.prototype._separateItemCreators = function(item) { editors.push(creator); } else if(creator.creatorTypeID == translatorID) { translators.push(creator); + } else if(creator.creatorTypeID == recipientID) { + recipients.push(creator); + } else if(creator.creatorTypeID == interviewerID) { + interviewers.push(creator); } else if(creator.creatorTypeID == authorID) { // TODO: do we just ignore contributors? authors.push(creator); } } - return [authors, editors, translators]; + return [authors, editors, translators, recipients, interviewers]; } /*