commit 0f3d320a06ed3016e8d827afd5d6f6d7839e6a28
parent d0ff59cdd9aab9f2ccce55b03f22fc746fe88749
Author: Avram Lyon <ajlyon@gmail.com>
Date: Mon, 4 Apr 2011 04:41:23 +0000
Trans: Make Informaworld a better citizen about populating the URL field
Diffstat:
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/translators/Informaworld.js b/translators/Informaworld.js
@@ -8,7 +8,7 @@
"priority":100,
"inRepository":true,
"translatorType":4,
- "lastUpdated":"2010-09-28 06:45:00"
+ "lastUpdated":"2011-04-04 06:45:00"
}
/* Test URLs
@@ -33,7 +33,8 @@ function detectWeb(doc, url) {
return "bookSection";
}
} else {
- return "book";
+ // Default to journal article
+ return "journalArticle";
}
} else if (url.indexOf("content=g") != -1 ||
doc.evaluate('//div[@id="browse"]//tbody/tr/td[2]/a[2]', doc, null, XPathResult.ANY_TYPE, null).iterateNext() ||
@@ -155,6 +156,19 @@ function doWeb(doc, url) {
if (set.doi) {
item.DOI = set.doi;
}
+
+ // Remove the existing attachment that the RIS translator gives us
+ item.attachments = [];
+
+ // Make URLs into DOIs if needed
+ if (item.url.match(/10\..*/) && !item.DOI) {
+ item.DOI = item.url.match(/10\..*/)[0];
+ item.url = "";
+ } else {
+ // Otherwise make a _link_ and remove the URL from the item
+ item.attachments.push({url:item.url, title:"Informaworld Link", snapshot:false});
+ item.url = "";
+ }
item.attachments.push({url:set.pdfurl, title:item.title, mimeType:'application/pdf'});
item.complete();
});