Skip to content
Permalink
Browse files

Rename and update magazines.russ.ru.js (#1210)

good call on forcing the library catalog rename. Thanks both!
  • Loading branch information...
zuphilip authored and adam3smith committed Dec 31, 2016
1 parent edb3d50 commit 145a7b4b99c02c5b3ff4e199aa9c97e2d631ea2a
Showing with 42 additions and 36 deletions.
  1. +42 −36 Zhurnalnyi zal.js → magazines.russ.ru.js
@@ -1,6 +1,6 @@
{
"translatorID": "0db1c2d0-eaae-4f3d-94ef-d4b3aa61de16",
"label": "Журнальный зал",
"label": "magazines.russ.ru",
"creator": "Avram Lyon",
"target": "^https?://magazines\\.russ\\.ru/[a-zA-Z -_]+/[0-9]+/[0-9]+/",
"minVersion": "2.1.9",
@@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2014-04-04 10:03:46"
"lastUpdated": "2016-12-31 10:22:19"
}

/*
@@ -35,43 +35,50 @@
***** END LICENSE BLOCK *****
*/

/*
Translator for Russian journal aggregator. Scrapes basic bibliographic information
for all of the journals, many of them literary or academic, hosted on the site.
Due to small variations in journal formatting, some will not be translated correctly.

Examples (Chicago style):
1. Сергей Бирюков, “Избранное из неизбранного,” Дети Ра, no. 6 (2010), http://magazines.russ.ru/ra/2010/6/bi3.html.
2. Вера Проскурина, “Ода Г.Р. Державина «На Счастие»: политика и поэтика,” НЛО, no. 97 (2009), http://magazines.russ.ru/nlo/2009/97/pr8.html.
*/

function detectWeb(doc, url) {
var results = ZU.xpath(doc, '//div[@class="opub"]');
if (results.length) {
var results = ZU.xpathText(doc, '//p[@class="update"]');
if (results) {
return "journalArticle";
}
}

function doWeb(doc, url) {
var item = new Zotero.Item("journalArticle");

var publication = ZU.xpathText(doc, '//div[@class="opub"]/a');
if( publication ) {
var pieces = publication.match(/«(.*[\n\t ]*([0-9]+), №([0-9]+)/);
item.publicationTitle = pieces[1];
item.date = pieces[2];
item.issue = pieces[3];
var publication = ZU.xpathText(doc, '//p[@class="update"]/a');
//e.g. Дети Ра, 2012, 3(89)
if (publication) {
Z.debug(publication);
var pieces = publication.split(',');
//var pieces = publication.match(/«(.*)»[\n\t ]*([0-9]+), №([0-9]+)/);
item.publicationTitle = pieces[0].trim();
item.date = pieces[1].trim();
var complex = pieces[2];
var posParenthesis = complex.indexOf('(');
if (posParenthesis>-1) {
item.volume = complex.substr(0, posParenthesis);
item.issue = complex.substr(posParenthesis+1, complex.length-posParenthesis-2);
}

}

item.title = ZU.xpathText(doc, '//div[@class="title1"]');
item.title = ZU.xpathText(doc, '//div[contains(@class, "article")]//h1');

var author = ZU.xpathText(doc, '//*[@class="avt1"]');
item.creators.push(ZU.cleanAuthor(author, "author"));
var authors = ZU.xpath(doc, '//div[@class="authors"]');
for (var i=0; i<authors.length; i++) {
item.creators.push(ZU.cleanAuthor(authors[i].textContent, "author"));
}

item.libraryCatalog = "Журнальный зал";

item.url = url;
item.attachments.push({url:url, title: (item.publicationTitle + " Snapshot"), mimeType:"text/html"});
item.attachments.push({
url:url,
title: "Snapshot",
mimeType:"text/html"
});

item.complete();
}
@@ -83,30 +90,29 @@ var testCases = [
"items": [
{
"itemType": "journalArticle",
"title": "В сторону СМОГа, или Параллели и меридианы СМОГа",
"creators": [
{
"firstName": "Вячеслав",
"lastName": "Самошкин",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"date": "2012",
"issue": "89",
"libraryCatalog": "Журнальный зал",
"publicationTitle": "Дети Ра",
"url": "http://magazines.russ.ru/ra/2012/3/s11.html",
"volume": "3",
"attachments": [
{
"url": "http://magazines.russ.ru/ra/2012/3/s11.html",
"title": "Дети Ра Snapshot",
"title": "Snapshot",
"mimeType": "text/html"
}
],
"publicationTitle": "Дети Ра",
"title": "В сторону СМОГа, или Параллели и меридианы СМОГа",
"date": "2012",
"issue": "3",
"url": "http://magazines.russ.ru/ra/2012/3/s11.html",
"libraryCatalog": "Журнальный зал",
"accessDate": "CURRENT_TIMESTAMP"
"tags": [],
"notes": [],
"seeAlso": []
}
]
}

0 comments on commit 145a7b4

Please sign in to comment.
You can’t perform that action at this time.