commit 5142f759b76220ff70db5d49970dc315339ca136
parent 2c33533c98aaa9305bb5a5534591439f2b45338b
Author: Matt Burton <mcburton@gmail.com>
Date: Tue, 1 Sep 2009 21:25:21 +0000
fixing pubmed, regex change and loop fix
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/translators/PubMed Central.js b/translators/PubMed Central.js
@@ -27,7 +27,7 @@ function doWeb(doc, url) {
volume:"volume",
doi:"DOI",
fulltext_html_url:"url"
- }
+ };
var URIs = new Array();
var items = new Object();
if (doc.title.indexOf("PMC Results") != -1) {
@@ -50,8 +50,7 @@ function doWeb(doc, url) {
} else {
URIs.push(url);
}
- for each (var link in URIs) {
- Zotero.Utilities.HTTP.doGet(link, function(text) {
+ Zotero.Utilities.HTTP.doGet(URIs, function(text) {
var tags = new Object();
var meta = text.match(/<meta[^>]*>/gi);
for (var i in meta) {
@@ -75,7 +74,7 @@ function doWeb(doc, url) {
}
newItem.url = tags["fulltext_html_url"];
if (!newItem.url) newItem.url = tags["abstract_html_url"];
- newItem.extra = text.match(/PMC\d+/)[0];
+ newItem.extra = "PMCID:" + text.match(/PMCID: <\/span>(\d+)/)[1];
newItem.journalAbbreviation = text.match(/span class=\"citation-abbreviation\">([^<]+)</)[1];
newItem.pages = text.match(/span class=\"citation-flpages\">([^<]+)</)[1].replace(/[\.:\s]/g, "");
@@ -86,7 +85,7 @@ function doWeb(doc, url) {
}
if (abstract) newItem.abstractNote = abstract;
newItem.complete();
- });
- }
+ }, function(){ Zotero.done();}
+ );
Zotero.wait();
}
\ No newline at end of file