{ "translatorID":"3f50aaac-7acc-4350-acd0-59cb77faf620", "translatorType":2, "label":"Wikipedia Citation Templates", "creator":"Simon Kornblith", "target":"txt", "minVersion":"1.0.0b4.r1", "maxVersion":"", "priority":100, "displayOptions":{"exportCharset":"UTF-8"}, "browserSupport":"gcs", "inRepository":true, "lastUpdated":"2013-01-12 8:00:26" } var fieldMap = { edition:"edition", publisher:"publisher", doi:"DOI", isbn:"ISBN", issn:"ISSN", conference:"conferenceName", volume:"volume", issue:"issue", pages:"pages", number:"episodeNumber" }; var typeMap = { book:"Cite book", bookSection:"Cite book", journalArticle:"Cite journal", magazineArticle:"Cite news", newspaperArticle:"Cite news", thesis:"Cite paper", letter:"Cite", manuscript:"Cite book", interview:"Cite interview", film:"Cite video", artwork:"Cite", webpage:"Cite web", report:"Cite conference", bill:"Cite", hearing:"Cite", patent:"Cite", statute:"Cite", email:"Cite email", map:"Cite", blogPost:"Cite web", instantMessage:"Cite", forumPost:"Cite web", audioRecording:"Cite", presentation:"Cite paper", videoRecording:"Cite video", tvBroadcast:"Cite episode", radioBroadcast:"Cite episode", podcast:"Cite podcast", computerProgram:"Cite", conferencePaper:"Cite conference", document:"Cite", encyclopediaArticle:"Cite encyclopedia", dictionaryEntry:"Cite encyclopedia" }; function formatAuthors(authors, useTypes) { var text = ""; for each(var author in authors) { text += ", "+author.firstName; if(author.firstName && author.lastName) text += " "; text += author.lastName; if(useTypes) text += " ("+Zotero.Utilities.getLocalizedCreatorType(author.creatorType)+")"; } return text.substr(2); } function formatFirstAuthor(authors, useTypes) { var firstCreator = authors.shift(); var field = firstCreator.lastName; if(firstCreator.lastName && firstCreator.firstName) field += ", "; field += firstCreator.firstName; if(useTypes) field += " ("+Zotero.Utilities.getLocalizedCreatorType(firstCreator.creatorType)+")"; return field; } function formatDate(date) { var date = date.substr(0, date.indexOf(" ")); if(date.substr(4, 3) == "-00") { date = date.substr(0, 4); } else if(date.substr(7, 3) == "-00") { date = date.substr(0, 7); } return date; } function doExport() { var first = true; while(item = Zotero.nextItem()) { // determine type var type = typeMap[item.itemType]; if(!type) type = "Cite"; var properties = new Object(); for(var wikiField in fieldMap) { var zoteroField = fieldMap[wikiField]; if(item[zoteroField]) properties[wikiField] = item[zoteroField]; } if(item.creators && item.creators.length) { if(type == "Cite episode") { // now add additional creators properties.credits = formatAuthors(item.creators, true); } else if(type == "Cite video") { properties.people = ""; // make first creator first, last properties.people = formatFirstAuthor(item.creators, true); // now add additional creators if(item.creators.length) properties.people += ", "+formatAuthors(item.creators, true); // use type if(item.type) { properties.medium = item.type; } } else if(type == "Cite email") { // get rid of non-authors for(var i=0; i