Skip to content

Commit d8f4177

Browse files
committed
Change Y1 handling in RIS
It comes from old RIS specification and used to be the "primary date" (I think). Some websites still use it as such (e.g. Wiley), while others use it as "online publication date" (e.g. Taylor and Francis). Since Y1 is not in the current spec, we'll treat it as if it's being used according to the old spec. Other uses will have to adjust on a per-case basis.
1 parent 027f9fb commit d8f4177

File tree

3 files changed

+271
-450
lines changed

3 files changed

+271
-450
lines changed

RIS.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"inRepository": true,
1818
"translatorType": 3,
1919
"browserSupport": "gcsv",
20-
"lastUpdated": "2015-02-12 02:23:27"
20+
"lastUpdated": "2015-02-12 22:44:41"
2121
}
2222

2323
function detectImport() {
@@ -447,7 +447,7 @@ var degenerateImportFieldMap = {
447447
"unsupported/Patent Version Number":['patent'],
448448
accessDate: ["webpage"] //technically access year according to EndNote
449449
},
450-
Y1: fieldMap["PY"]
450+
Y1: fieldMap["DA"] // Old RIS spec
451451
};
452452

453453
/**
@@ -1245,12 +1245,6 @@ function processTag(item, tagValue, risEntry) {
12451245
}
12461246
break;
12471247
//PY is typically less complete than other dates. We'll store it as backup
1248-
case "Y1":
1249-
if (item.backupDate) {
1250-
value = undefined;
1251-
processFields = false;
1252-
break;
1253-
}
12541248
case "PY":
12551249
item.backupDate = {
12561250
field: zField[0],

Taylor and Francis+NEJM.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"inRepository": true,
1010
"translatorType": 4,
1111
"browserSupport": "gcsibv",
12-
"lastUpdated": "2014-12-07 14:59:05"
12+
"lastUpdated": "2015-02-12 22:42:23"
1313
}
1414

1515
/*
@@ -132,6 +132,11 @@ function scrape(doc, url, dois) {
132132
//unfortunately, bibtex is missing some data
133133
//publisher, ISSN/ISBN
134134
ZU.doPost(postUrl, postBody + doi + risFormat, function(text) {
135+
// Y1 is online publication date
136+
if (/^DA\s+-\s+/m.test(text)) {
137+
text = text.replace(/^Y1(\s+-.*)/gm, '');
138+
}
139+
135140
risTrans = Zotero.loadTranslator("import");
136141
risTrans.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
137142
risTrans.setString(text);
@@ -292,7 +297,7 @@ var testCases = [
292297
"libraryCatalog": "Taylor and Francis+NEJM",
293298
"pages": "37-46",
294299
"publicationTitle": "Applied Economics",
295-
"url": "http://www.tandfonline.com/doi/abs/10.1080/00036846.2011.568404",
300+
"url": "http://dx.doi.org/10.1080/00036846.2011.568404",
296301
"volume": "45",
297302
"attachments": [
298303
{
@@ -353,7 +358,7 @@ var testCases = [
353358
"libraryCatalog": "Taylor and Francis+NEJM",
354359
"pages": "1179-1181",
355360
"publicationTitle": "New England Journal of Medicine",
356-
"url": "http://www.nejm.org/doi/full/10.1056/NEJMp1207920",
361+
"url": "http://dx.doi.org/10.1056/NEJMp1207920",
357362
"volume": "367",
358363
"attachments": [
359364
{

0 commit comments

Comments
 (0)