Skip to content

Commit 095f225

Browse files
committed
Small fixes for Ozon, business Wekk, and Live Journal. Test updates for the rest.
Notes: Sorry for the diff-mess in the OZON translator, the indents in the original were completely off. NZZ: The authors have vanished from their article sites - nothing to do. Nature: The "ERROR NO ISSN!" comes straight from the metadata on the site - it's the same in all ISSN fields.
1 parent 8ac8cc1 commit 095f225

9 files changed

+423
-566
lines changed

Diff for: BusinessWeek.js

+31-24
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
"label": "BusinessWeek",
44
"creator": "Michael Berkowitz",
55
"target": "^https?://(www\\.)?businessweek\\.com",
6-
"minVersion": "1.0.0b4.r5",
6+
"minVersion": "3.0",
77
"maxVersion": "",
88
"priority": 100,
99
"inRepository": true,
1010
"translatorType": 4,
1111
"browserSupport": "gcsv",
12-
"lastUpdated": "2012-01-30 22:52:13"
12+
"lastUpdated": "2012-06-30 09:46:05"
1313
}
1414

1515
function detectWeb(doc, url) {
16-
if (doc.title == "BusinessWeek Search Results") {
16+
if (doc.evaluate('//body[contains(@class, "searchResults")]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
1717
return "multiple";
18-
} else if (doc.evaluate('//meta[@name="headline"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
18+
} else if (doc.evaluate('//h1[@id="article_headline"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
1919
return "magazineArticle";
2020
}
2121
}
@@ -29,35 +29,41 @@ function doWeb(doc, url) {
2929
while (result = results.iterateNext()) {
3030
items[result.href] = Zotero.Utilities.trimInternal(result.textContent);
3131
}
32-
items = Zotero.selectItems(items);
33-
for (var i in items) {
34-
articles.push(i);
35-
}
32+
Zotero.selectItems(items, function (items) {
33+
if (!items) {
34+
return true;
35+
}
36+
for (var i in items) {
37+
articles.push(i);
38+
}
39+
Zotero.Utilities.processDocuments(articles, scrape, function () {
40+
Zotero.done();
41+
});
42+
});
3643
} else {
37-
articles = [url];
44+
scrape(doc, url)
3845
}
39-
Zotero.debug(articles);
40-
Zotero.Utilities.processDocuments(articles, function(newDoc) {
41-
var metaTags = new Object();
42-
var metas = newDoc.evaluate('//meta', newDoc, null, XPathResult.ANY_TYPE, null);
46+
}
47+
48+
function scrape(doc, url){
49+
var metaTags = new Object();
50+
var metas = doc.evaluate('//meta', doc, null, XPathResult.ANY_TYPE, null);
4351
var meta;
4452
while (meta = metas.iterateNext()) {
4553
metaTags[meta.name] = meta.content;
4654
}
4755
Zotero.debug(metaTags);
4856
var item = new Zotero.Item("magazineArticle");
49-
item.title = metaTags['headline'];
50-
item.abstractNote = metaTags['abstract'];
57+
item.title = ZU.xpathText(doc, '//h1[@id="article_headline"]');
58+
item.abstractNote = metaTags['description'];
5159
item.tags = metaTags['keywords'].split(/\s*,\s*/);
5260
//some articles don't have author tags - prevent this from failing
5361
if (metaTags['author']) item.creators.push(Zotero.Utilities.cleanAuthor(metaTags['author'], "author"));
5462
item.publicationTitle = "BusinessWeek: " + metaTags['channel'];
55-
item.url = newDoc.location.href;
56-
item.date = metaTags['pub_date'].replace(/(\d{4})(\d{2})(\d{2})/, "$2/$3/$1");
63+
item.url = url;
64+
item.date = metaTags['pub_date'].replace(/(\d{4})(\d{2})(\d{2})/, "$2/$3/$1").replace(/T.+/, "");
5765
item.complete();
58-
}, function() {Zotero.done();});
59-
Zotero.wait();
60-
}/** BEGIN TEST CASES **/
66+
}/** BEGIN TEST CASES **/
6167
var testCases = [
6268
{
6369
"type": "web",
@@ -75,7 +81,7 @@ var testCases = [
7581
"notes": [],
7682
"tags": [
7783
"leadership",
78-
"management",
84+
"Management",
7985
"bad bosses",
8086
"leaders",
8187
"Liz Ryan",
@@ -85,9 +91,10 @@ var testCases = [
8591
"seeAlso": [],
8692
"attachments": [],
8793
"title": "Ten Things Only Bad Managers Say",
88-
"publicationTitle": "BusinessWeek: Management",
94+
"abstractNote": "We know the kinds of things good managers say: They say “Attaboy” or “Attagirl,” “Let me know if you run into any roadblocks, and I’ll try to get rid of them for you,” and “You’ve been killing yourself—why don’t you take off at noon on Friday?”",
95+
"publicationTitle": "BusinessWeek: management",
8996
"url": "http://www.businessweek.com/management/ten-things-only-bad-managers-say-09232011.html?campaign_id=rss_topStories",
90-
"date": "09/23/2011",
97+
"date": "2011-09-23",
9198
"libraryCatalog": "BusinessWeek",
9299
"accessDate": "CURRENT_TIMESTAMP"
93100
}
@@ -99,4 +106,4 @@ var testCases = [
99106
"items": "multiple"
100107
}
101108
]
102-
/** END TEST CASES **/
109+
/** END TEST CASES **/

Diff for: Digital Humanities Quarterly.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ var testCases = [
8686
],
8787
"url": "http://www.digitalhumanities.org/dhq/vol/5/2/000094/000094.html",
8888
"title": "Network Narration in John Dos Passos’s U.S.A. Trilogy",
89-
"date": "Spring 2011",
89+
"date": "2011",
9090
"volume": "5",
9191
"issue": "2",
9292
"libraryCatalog": "Digital Humanities Quarterly",
@@ -100,4 +100,4 @@ var testCases = [
100100
"items": "multiple"
101101
}
102102
]
103-
/** END TEST CASES **/
103+
/** END TEST CASES **/

Diff for: Glenbow Library.js

+1-45
Original file line numberDiff line numberDiff line change
@@ -264,48 +264,4 @@ function doWeb(doc, url) {
264264
Zotero.Utilities.processDocuments(uris, scrape, function() {Zotero.done();});
265265
Zotero.wait();
266266
}
267-
268-
/** BEGIN TEST CASES **/
269-
var testCases = [
270-
{
271-
"type": "web",
272-
"url": "http://ww2.glenbow.org/search/libraryMainResults.aspx?AC=GET_RECORD&XC=/search/libraryMainResults.aspx&BU=&TN=GLENCAT&SN=AUTO24715&SE=1581&RN=8&MR=20&TR=0&TX=1000&ES=0&CS=0&XP=&RF=WebResults&EF=&DF=WebResultsDetails&RL=0&EL=0&DL=0&NP=255&ID=&MF=WPEngMsg.ini&MQ=&TI=0&DT=&ST=0&IR=56813&NR=0&NB=0&SV=0&BG=&FG=&QS=LibraryMainSearch&OEX=ISO-8859-1&OEH=ISO-8859-1",
273-
"items": [
274-
{
275-
"itemType": "book",
276-
"creators": [
277-
{
278-
"firstName": "Marlene A. D. Lynne Van",
279-
"lastName": "Luven",
280-
"creatorType": "author"
281-
},
282-
{
283-
"firstName": "Priscilla L.",
284-
"lastName": "Walton",
285-
"creatorType": "author"
286-
}
287-
],
288-
"notes": [],
289-
"tags": [
290-
"Popular culture - Canada",
291-
"Canada - Social life and customs - 20th century"
292-
],
293-
"seeAlso": [],
294-
"attachments": [],
295-
"callNumber": "306.40971 P831",
296-
"title": "Pop Can : popular culture in Canada / edited by Lynne Van Luven, Priscilla L. Walton",
297-
"place": "Scarborough, Ont.",
298-
"publisher": "Prentice Hall Allyn and Bacon Canada",
299-
"date": "c1999.",
300-
"pages": "xii, 237 p. ; 24 cm.",
301-
"abstractNote": "Includes bibliographical references and index.",
302-
"extra": "Accession number: [99092222]",
303-
"url": "http://ww2.glenbow.org/search/libraryMainResults.aspx?AC=GET_RECORD&XC=/search/libraryMainResults.aspx&BU=&TN=GLENCAT&SN=AUTO24715&SE=1581&RN=8&MR=20&TR=0&TX=1000&ES=0&CS=0&XP=&RF=WebResults&EF=&DF=WebResultsDetails&RL=0&EL=0&DL=0&NP=255&ID=&MF=WPEngMsg.ini&MQ=&TI=0&DT=&ST=0&IR=56813&NR=0&NB=0&SV=0&BG=&FG=&QS=LibraryMainSearch&OEX=ISO-8859-1&OEH=ISO-8859-1",
304-
"libraryCatalog": "Glenbow Library",
305-
"accessDate": "CURRENT_TIMESTAMP",
306-
"shortTitle": "Pop Can"
307-
}
308-
]
309-
}
310-
]
311-
/** END TEST CASES **/
267+
//Session time-out --> no tests

Diff for: L'Annee Philologique.js

+1-52
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
TODO: LAP provides book chapters as to separate RIS files - the chapter and the book
4040
the former doesn't have the editors or the book title. Ideally we should merge those,
4141
but that requires a rather elaborate hack, so it'll have to wait for another day
42-
43-
Test may fail - not sure if it's tied to a session
4442
*/
4543

4644

@@ -115,53 +113,4 @@ function scrape(doc, url) {
115113
translator.translate();
116114
});
117115
}
118-
/** BEGIN TEST CASES **/
119-
var testCases = [
120-
{
121-
"type": "web",
122-
"url": "http://www.annee-philologique.com/index.php?do=notice&num=5",
123-
"items": [
124-
{
125-
"itemType": "book",
126-
"creators": [
127-
{
128-
"lastName": "Diderot",
129-
"creatorType": "author",
130-
"firstName": " Denis"
131-
},
132-
{
133-
"lastName": "Carpanetto",
134-
"creatorType": "author",
135-
"firstName": " Secondo"
136-
},
137-
{
138-
"lastName": "Guerci",
139-
"creatorType": "author",
140-
"firstName": " Luciano"
141-
},
142-
{
143-
"lastName": "Canfora",
144-
"creatorType": "author",
145-
"firstName": " Luciano"
146-
}
147-
],
148-
"notes": [],
149-
"tags": [],
150-
"seeAlso": [],
151-
"attachments": [
152-
{
153-
"title": "L'Année Philologique Snapshot",
154-
"mimeType": "text/html"
155-
}
156-
],
157-
"itemID": "59-11596",
158-
"title": "Saggio sui regni di Claudio e Nerone, e sui costumi e gli scritti di Seneca / trad. di Carpanetto Secondo& Guerci Luciano ;con una nota di Canfora Luciano",
159-
"date": "1987",
160-
"publisher": "Sellerio",
161-
"place": "Palermo",
162-
"libraryCatalog": "L'Année Philologique"
163-
}
164-
]
165-
}
166-
]
167-
/** END TEST CASES **/
116+
//no permalinks --> no test

Diff for: Library Catalog (Mango).js

+8-6
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"priority": 200,
99
"inRepository": true,
1010
"translatorType": 4,
11-
"browserSupport": "gcsbv",
12-
"lastUpdated": "2012-03-12 01:06:01"
11+
"browserSupport": "gcsvb",
12+
"lastUpdated": "2012-06-30 10:12:52"
1313
}
1414

1515
/*
@@ -218,7 +218,9 @@ var testCases = [
218218
"tags": [
219219
"Psychological tests",
220220
"Educational tests and measurements",
221-
"Occupational aptitude tests"
221+
"Occupational aptitude tests",
222+
"Educational Measurement",
223+
"Psychological Tests"
222224
],
223225
"seeAlso": [],
224226
"attachments": [],
@@ -259,16 +261,16 @@ var testCases = [
259261
"attachments": [],
260262
"ISBN": "9780300169270",
261263
"title": "Adam Smith: an enlightened life",
262-
"place": "New Haven [Conn.] ; London",
264+
"place": "New Haven, CT ; London",
263265
"publisher": "Yale University Press",
264266
"date": "2010",
265267
"numPages": "345",
266268
"callNumber": "HB103.S6 P45 2010",
267-
"extra": "A Kirkcaldy upbringing -- Glasgow, Glasgow University and Francis Hutcheson's enlightenment -- Private study 1740-46 : Oxford and David Hume -- Edinburgh's early enlightenment -- Smith's Edinburgh lectures : a conjectural history -- Professor of moral philosophy at Glasgow, I. 1751-9 -- The 'Theory of moral sentiments' and the civilizing powers of commerce -- Professor of moral philosophy at Glasgow, 2. 1759-63 -- Smith and the Duke of Buccleuch in Europe 1764-6 -- London, Kirkcaldy and the making of the 'Wealth of nations' 1766-76 -- The 'Wealth of nations' and Smith's \"very violent attack ... upon the whole commercial system of Great Britain\" -- Hume's death -- Last years in Edinburgh 1778-90\nNicholas Phillipson's intellectual biography of Adam Smith shows that Smith saw himself as philosopher rather than an economist. Phillipson shows Smith's famous works were a part of a larger scheme to establish a \"Science of Man,\" which was to encompass law, history, and aesthetics as well as economics and ethics. Phillipson explains Adam Smith's part in the rapidly changing intellectual and commercial cultures of Glasgow and Edinburgh at the time of the Scottish Enlightenment. Above all Phillipson explains how far Smith's ideas developed in dialog with his closest friend David Hume. --Publisher's description",
269+
"extra": "1. A Kirkcaldy upbringing -- 2. Glasgow, Glasgow University and Francis Hutcheson's enlightenment -- 3. Private study 1740-46: Oxford and David Hume -- 4. Edinburgh's early enlightenment -- 5. Smith's Edinburgh lectures: a conjectural history -- 6. Professor of moral philosophy at Glasgow, I. 1751-9 -- 7. The 'Theory of moral sentiments' and the civilizing powers of commerce -- 8. Professor of moral philosophy at Glasgow, 2. 1759-63 -- 9. Smith and the Duke of Buccleuch in Europe 1764-6 -- 10. London, Kirkcaldy and the making of the 'Wealth of nations' 1766-76 -- 11. The 'Wealth of nations' and Smith's \"very violent attack ... upon the whole commercial system of Great Britain\" -- 12. Hume's death -- 13. Last years in Edinburgh 1778-90 A Kirkcaldy upbringing -- Glasgow, Glasgow University and Francis Hutcheson's enlightenment -- Private study 1740-46 : Oxford and David Hume -- Edinburgh's early enlightenment -- Smith's Edinburgh lectures : a conjectural history -- Professor of moral philosophy at Glasgow, I. 1751-9 -- The 'Theory of moral sentiments' and the civilizing powers of commerce -- Professor of moral philosophy at Glasgow, 2. 1759-63 -- Smith and the Duke of Buccleuch in Europe 1764-6 -- London, Kirkcaldy and the making of the 'Wealth of nations' 1766-76 -- The 'Wealth of nations' and Smith's \"very violent attack ... upon the whole commercial system of Great Britain\" -- Hume's death -- Last years in Edinburgh 1778-90\nNicholas Phillipson's intellectual biography of Adam Smith shows that Smith saw himself as philosopher rather than an economist. Phillipson shows Smith's famous works were a part of a larger scheme to establish a \"Science of Man,\" which was to encompass law, history, and aesthetics as well as economics and ethics. Phillipson explains Adam Smith's part in the rapidly changing intellectual and commercial cultures of Glasgow and Edinburgh at the time of the Scottish Enlightenment. Above all Phillipson explains how far Smith's ideas developed in dialog with his closest friend David Hume. --Publisher's description",
268270
"libraryCatalog": "Library Catalog (Mango)",
269271
"shortTitle": "Adam Smith"
270272
}
271273
]
272274
}
273275
]
274-
/** END TEST CASES **/
276+
/** END TEST CASES **/

0 commit comments

Comments
 (0)