Adding himura's patches and fixed author handling code.
This commit is contained in:
parent
d08bc12b69
commit
4189fe618e
1 changed files with 26 additions and 16 deletions
|
@ -8,13 +8,13 @@
|
|||
"maxVersion":"",
|
||||
"priority":100,
|
||||
"inRepository":true,
|
||||
"lastUpdated":"2009-01-08 08:19:07"
|
||||
"lastUpdated":"2009-12-31 08:19:07"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
if (doc.title.match(/search result/) || doc.title.match(/Table of Contents/)) {
|
||||
return "multiple";
|
||||
} else if (url.match(/getarticle\?/)) {
|
||||
} else if (url.match(/getarticle\?/) || url.match(/link\?/)) {
|
||||
return "journalArticle";
|
||||
}
|
||||
}
|
||||
|
@ -47,27 +47,37 @@ function doWeb(doc, url) {
|
|||
}
|
||||
Zotero.Utilities.processDocuments(arts, function(doc) {
|
||||
var item = new Zotero.Item("journalArticle");
|
||||
item.ISSN = '0033-068X';
|
||||
item.title = Zotero.Utilities.trimInternal(doc.evaluate('//h2[@class="title"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
if (doc.evaluate('//h2[@class="subtitle"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
|
||||
item.title = item.title + ": " + Zotero.Utilities.trimInternal(doc.evaluate('//h2[@class="subtitle"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
}
|
||||
item.abstractNote = Zotero.Utilities.trimInternal(doc.evaluate('//p[@class="abstract"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var authors = Zotero.Utilities.unescapeHTML(Zotero.Utilities.trimInternal(doc.evaluate('/html/body/p[@class="author"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent));
|
||||
authors = authors.replace(/[*()]+/g, "").split(/(,\s+|\band\b)/);
|
||||
for each (var aut in authors) {
|
||||
if (!aut.match(/(,|and)/)) {
|
||||
item.creators.push(Zotero.Utilities.cleanAuthor(aut, "author"));
|
||||
}
|
||||
var authors = doc.evaluate("//p[@class='author']/a", doc, null, XPathResult.ANY_TYPE, null);
|
||||
var aut;
|
||||
while(aut = authors.iterateNext()) {
|
||||
item.creators.push(Zotero.Utilities.cleanAuthor(aut.textContent, "author"));
|
||||
}
|
||||
var info = Zotero.Utilities.trimInternal(doc.evaluate('//h4[@class="info"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
info = info.match(/Vol\.\s+(\d+)\s+No\.\s+(\d+)\s+\((\d+)\)\s+pp\.\s+([\d-]+)\s+URL\s+:\s+(.*)\s+DOI\s+:\s+(.*)$/);
|
||||
item.volume = info[1];
|
||||
item.issue = info[2];
|
||||
item.date = info[3];
|
||||
item.pages = info[4];
|
||||
item.url = info[5];
|
||||
item.DOI = info[6];
|
||||
if (m = info.match(/Vol\.\s+(\d+)\s+No\.\s+(\d+)\s+\((\d+)\)\s+pp\.\s+([\d-]+)\s+URL\s+:\s+(.*)\s+DOI\s+:\s+(.*)$/)){
|
||||
item.ISSN = '0033-068X';
|
||||
item.publicationTitle = "Progress of Theoretical Physics";
|
||||
item.journalAbbreviation = "Prog. Theor. Phys.";
|
||||
item.volume = m[1];
|
||||
item.issue = m[2];
|
||||
item.date = m[3];
|
||||
item.pages = m[4];
|
||||
item.url = m[5];
|
||||
item.DOI = m[6];
|
||||
} else if (m = info.match(/Supplement\s+No\.\s+(\d+)\s+\((\d+)\)\s+pp\.\s+([\d-]+)\s+URL\s+:\s+(.*)\s+DOI\s+:\s+(.*)$/)){
|
||||
item.ISSN = '0375-9687';
|
||||
item.publicationTitle = "Progress of Theoretical Physics Supplement";
|
||||
item.journalAbbreviation = "Prog. Theor. Phys. Suppl.";
|
||||
item.volume = m[1];
|
||||
item.date = m[2];
|
||||
item.pages = m[3];
|
||||
item.url = m[4];
|
||||
item.DOI = m[5];
|
||||
}
|
||||
var pdfurl = doc.evaluate('//a[contains(text(), "PDF")]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().href;
|
||||
item.attachments = [
|
||||
{url:item.url, title:"PTP Snapshot", mimeType:"text/html"},
|
||||
|
|
Loading…
Reference in a new issue