- Adding Sopheak's TVNZ translator.

- Adding reference book support to CrossRef
	per http://forums.zotero.org/discussion/12942
- Changing authorship of NZ Herald to match usual standard.
- Adding support for patent issue dates in RIS import and export
	discussed somewhere; patch has been laying about for some time
This commit is contained in:
Avram Lyon 2010-08-09 00:08:23 +00:00
parent 9aa227db6b
commit f672b05d89
4 changed files with 296 additions and 7 deletions

View file

@ -197,7 +197,6 @@ function processTag(item, tag, value) {
// the secondary date field can mean two things, a secondary date, or an
// invalid EndNote-style date. let's see which one this is.
// patent: application (filing) date -- do not append to date field
// for now. Zotero needs a filing date field added to make use of this.
var dateParts = value.split("/");
if(dateParts.length != 4 && item.itemType != "patent") {
// an invalid date and not a patent.
@ -207,6 +206,29 @@ function processTag(item, tag, value) {
value += " " + item.date;
}
item.date = value;
} else if (item.itemType == "patent") {
// Date-handling code copied from above
if(dateParts.length == 1) {
// technically, if there's only one date part, the file isn't valid
// RIS, but EndNote writes this, so we have to too
// Nick: RIS spec example records also only contain a single part
// even though it says the slashes are not optional (?)
item.filingDate = value;
} else {
// in the case that we have a year and other data, format that way
var month = parseInt(dateParts[1]);
if(month) {
month--;
} else {
month = undefined;
}
item.filingDate = Zotero.Utilities.formatDate({year:dateParts[0],
month:month,
day:dateParts[2],
part:dateParts[3]});
}
}
// ToDo: Handle correctly formatted Y2 fields (secondary date)
} else if(tag == "N1" || tag == "AB") {
@ -243,6 +265,7 @@ function processTag(item, tag, value) {
}
} else if(tag == "SN") {
// ISSN/ISBN - just add both
// TODO We should be able to tell these apart
if(!item.ISBN) {
item.ISBN = value;
}
@ -479,6 +502,28 @@ function doExport() {
}
addTag("PY", string);
}
// filingDate (patents)
if(item.filingDate) {
var date = Zotero.Utilities.strToDate(item.filingDate);
var string = date.year+"/";
if(date.month != undefined) {
// deal with javascript months
date.month++;
if(date.month < 10) string += "0";
string += date.month;
}
string += "/";
if(date.day != undefined) {
if(date.day < 10) string += "0";
string += date.day;
}
string += "/";
if(date.part != undefined) {
string += date.part;
}
addTag("Y2", string);
}
// notes
if(Zotero.getOption("exportNotes")) {
@ -524,4 +569,4 @@ function doExport() {
Zotero.write("ER - \r\n\r\n");
}
}
}