Trans: Handling of conferencePaper and bookSection in RIS, also

handling of numPages. See http://forums.zotero.org/discussion/15376
and other discussion.
This commit is contained in:
Avram Lyon 2010-11-30 22:04:27 +00:00
parent 070c8eb7a5
commit 24fc8d1292

View File

@ -40,6 +40,16 @@ var fieldMap = {
M3:"DOI" M3:"DOI"
}; };
var bookSectionFieldMap = {
ID:"itemID",
T1:"title",
T3:"series",
T2:"bookTitle",
CY:"place",
JA:"journalAbbreviation",
M3:"DOI"
};
var inputFieldMap = { var inputFieldMap = {
TI:"title", TI:"title",
CT:"title", CT:"title",
@ -250,6 +260,9 @@ function processTag(item, tag, value) {
// start page // start page
if(!item.pages) { if(!item.pages) {
item.pages = value; item.pages = value;
// EndNote uses SP without EP for number of pages
// Save as numPages only if there were no previous pages tags
if (item.itemType == "book") item.numPages = value;
} else if(item.pages[0] == "-") { // already have ending page } else if(item.pages[0] == "-") { // already have ending page
item.pages = value + item.pages; item.pages = value + item.pages;
} else { // multiple ranges? hey, it's a possibility } else { // multiple ranges? hey, it's a possibility
@ -262,6 +275,9 @@ function processTag(item, tag, value) {
item.pages = value; item.pages = value;
} else if(value != item.pages) { } else if(value != item.pages) {
item.pages += "-"+value; item.pages += "-"+value;
// EndNote uses SP without EP for number of pages
// Here, clear numPages if we have an EP != SP
if (item.itemType == "book") item.numPages = undefined;
} }
} }
} else if(tag == "SN") { } else if(tag == "SN") {
@ -441,9 +457,15 @@ function doExport() {
addTag("TY", typeMap[item.itemType] ? typeMap[item.itemType] : "GEN"); addTag("TY", typeMap[item.itemType] ? typeMap[item.itemType] : "GEN");
// use field map // use field map
if (item.itemType == "bookSection" || item.itemType == "conferencePaper") {
for(var j in bookSectionFieldMap) {
if(item[bookSectionFieldMap[j]]) addTag(j, item[bookSectionFieldMap[j]]);
}
} else {
for(var j in fieldMap) { for(var j in fieldMap) {
if(item[fieldMap[j]]) addTag(j, item[fieldMap[j]]); if(item[fieldMap[j]]) addTag(j, item[fieldMap[j]]);
} }
}
// creators // creators
for(var j in item.creators) { for(var j in item.creators) {
@ -458,7 +480,11 @@ function doExport() {
risTag = "A2"; risTag = "A2";
} }
addTag(risTag, item.creators[j].lastName+","+item.creators[j].firstName); var names = [];
if (item.creators[j].lastName) names.push(item.creators[j].lastName);
if (item.creators[j].firstName) names.push(item.creators[j].firstName);
addTag(risTag, names.join(","));
} }
// assignee (patent) // assignee (patent)