From 0f3d320a06ed3016e8d827afd5d6f6d7839e6a28 Mon Sep 17 00:00:00 2001 From: Avram Lyon Date: Mon, 4 Apr 2011 04:41:23 +0000 Subject: [PATCH] Trans: Make Informaworld a better citizen about populating the URL field --- translators/Informaworld.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/translators/Informaworld.js b/translators/Informaworld.js index b86c37759..4fff6c9b4 100644 --- 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(); });