Trans: Updated Radio Liberty for news archive pages

This commit is contained in:
Avram Lyon 2011-05-24 17:37:52 +00:00
parent d5fb8358fb
commit 691a70107f

View File

@ -8,7 +8,7 @@
"maxVersion":"", "maxVersion":"",
"priority":100, "priority":100,
"inRepository":true, "inRepository":true,
"lastUpdated":"2011-04-01 00:45:00" "lastUpdated":"2011-05-24 00:45:00"
} }
/* /*
@ -74,7 +74,7 @@
*/ */
function detectWeb(doc, url){ function detectWeb(doc, url){
if (url.match(/\/content\//)) { if (url.match(/\/content\/|\/archive\/news/)) {
// The translator uses this type because RFE/RL generally has a place of publication // The translator uses this type because RFE/RL generally has a place of publication
// and a Section; both are specific to newspaperArticle. // and a Section; both are specific to newspaperArticle.
return "newspaperArticle"; return "newspaperArticle";
@ -137,7 +137,7 @@ function doWeb(doc, url){
item.creators.push(cleaned); item.creators.push(cleaned);
} }
// The section should _always_ be present // The section should _always_ be present
item.section = doc.evaluate('//div[@id="article"]/h2/a[@class="h3link"]', doc, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; item.section = doc.evaluate('//div[@id="article" or @class="middle_content"]/h2', doc, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent.trim();
// This exposes a limitation of Zotero's date handling; the Afghan services // This exposes a limitation of Zotero's date handling; the Afghan services
// use the Hijri calendar, and mixed sorting looks funny-- I'd like to be able // use the Hijri calendar, and mixed sorting looks funny-- I'd like to be able
@ -154,7 +154,9 @@ function doWeb(doc, url){
// characters that may occur in city names. // characters that may occur in city names.
// This all-caps class is borrowed from utilities.js and augmented by // This all-caps class is borrowed from utilities.js and augmented by
// the basic Cyrillic capital letters. // the basic Cyrillic capital letters.
var text = doc.evaluate('//div[@id="article"]/div[@class="zoomMe"]', doc, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; var textnode = doc.evaluate('//div[@id="article"]/div[@class="zoomMe"]', doc, ns, XPathResult.ANY_TYPE, null).iterateNext();
if (textnode) {
var text = textnode.textContent;
hits = text.match(/([A-ZА-Я \u0400-\u042f]+) \((.*)\) --/); hits = text.match(/([A-ZА-Я \u0400-\u042f]+) \((.*)\) --/);
if (!hits) { if (!hits) {
hits = text.match(/([A-ZА-Я \u0400-\u042f]+) --/); hits = text.match(/([A-ZА-Я \u0400-\u042f]+) --/);
@ -165,6 +167,7 @@ function doWeb(doc, url){
// We add the wire service as an author; it would be nice to have a field for it // We add the wire service as an author; it would be nice to have a field for it
item.creators.push({lastName : hits[2], creatorType:"author", fieldMode:true}); item.creators.push({lastName : hits[2], creatorType:"author", fieldMode:true});
} }
}
item.url = url; item.url = url;
item.publicationTitle = doc.evaluate('//h2[@id="header_logo_anchor"]//span', doc, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; item.publicationTitle = doc.evaluate('//h2[@id="header_logo_anchor"]//span', doc, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent;