Skip to content

Commit 0b583b8

Browse files
committed
small fixed for BiblioCommons and SRF
1 parent 3787961 commit 0b583b8

2 files changed

+51
-37
lines changed

Library Catalog (BiblioCommons).js

+49-35
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"inRepository": true,
1010
"translatorType": 4,
1111
"browserSupport": "gcsibv",
12-
"lastUpdated": "2012-12-19 01:24:23"
12+
"lastUpdated": "2013-02-25 21:26:18"
1313
}
1414

1515
/*
@@ -98,19 +98,19 @@ function doWeb(doc, url) {
9898

9999
function processor (obj) {
100100
// Gets {translator: , text: }
101+
//Z.debug(obj.text)
101102
// Here, we split up the table and insert little placeholders between record bits
102103
var marced = obj.text.replace(/\s+/g," ")
103104
.replace(/^.*<div id="marc_details">(?:\s*<[^>"]+>\s*)*/,"")
104105
.replace(/<tr +class="(?:odd|even)">\s*/g,"")
105-
.replace(/<td +class="marcTag"><strong>(\d+)<\/strong><\/td>\s*/g,"$1\x1F")
106+
.replace(/<td +scope="row" +class="marcTag"><strong>(\d+)<\/strong><\/td>\s*/g,"$1\x1F")
106107
// We may be breaking the indicator here
107108
.replace(/<td\s+class="marcIndicator">\s*(\d*)\s*<\/td>\s*/g,"$1\x1F")
108109
.replace(/<td +class="marcTagData">(.*?)<\/td>\s*<\/tr>\s*/g,"$1\x1E")
109110
.replace(/\x1F(?:[^\x1F]*)$/,"\x1F")
110111
// We have some extra 0's at the start of the leader
111112
.replace(/^000/,"");
112113
//Z.debug(marced);
113-
114114
// We've used the record delimiter to delimit fields
115115
var fields = marced.split("\x1E");
116116

@@ -122,15 +122,18 @@ function processor (obj) {
122122
// The first piece is the MARC leader
123123
record.leader = fields.shift();
124124
for each (var field in fields) {
125+
//Z.debug(field)
125126
// Skip blanks
126127
if (field.replace(/\x1F|\s/g,"") == "") continue;
127128
// We're using the subfield delimiter to separate the field code,
128129
// indicator, and the content.
129130
var pieces = field.split("\x1F");
131+
if (pieces.length>2){
130132
record.addField(pieces[0].trim(),
131133
pieces[1].trim(),
132134
// Now we insert the subfield delimiter
133135
pieces[2].replace(/\$([a-z]|$)/g,"\x1F$1").trim());
136+
}
134137
}
135138
// returns {translator: , text: false, items: [Zotero.Item[]]}
136139
var item = new Zotero.Item();
@@ -144,73 +147,84 @@ function processor (obj) {
144147
var testCases = [
145148
{
146149
"type": "web",
147-
"url": "http://bostonpl.bibliocommons.com/item/catalogue_info/2993906042_test",
150+
"url": "http://bostonpl.bibliocommons.com/item/show/2051015075_labor",
148151
"items": [
149152
{
150153
"itemType": "book",
151154
"creators": [
152155
{
153-
"firstName": "William",
154-
"lastName": "Sleator",
156+
"firstName": "Marcia McKenna",
157+
"lastName": "Biddle",
155158
"creatorType": "author"
156159
}
157160
],
158161
"notes": [
159162
{
160-
"note": "In the security-obsessed, elitist United States of the near future, where a standardized test determines each person's entire life, a powerful man runs a corrupt empire until seventeen-year-old Ann and other students take the lead in boycotting the test"
163+
"note": "Brief biographies of five women prominently involved in the labor movement in the United States: Mother Jones, Mary Heaton Vorse, Frances Perkins, Addie Wyatt, and Dolores Huerta. Also includes 11 other women who have made outstanding contributions"
161164
}
162165
],
163166
"tags": [
164-
"Educational tests and measurements",
165-
"Education",
166-
"Political corruption",
167-
"Immigrants",
168-
"Conspiracies"
167+
"Women labor union members",
168+
"United States",
169+
"Women",
170+
"United States",
171+
"Women labor union members",
172+
"Working class"
169173
],
170174
"seeAlso": [],
171175
"attachments": [],
172-
"ISBN": "9780810993563",
173-
"title": "Test",
174-
"place": "New York",
175-
"publisher": "Amulet Books",
176-
"date": "2008",
177-
"numPages": "298",
178-
"callNumber": "SLEATOR W",
176+
"ISBN": "0875181678",
177+
"title": "Labor",
178+
"place": "Minneapolis",
179+
"publisher": "Dillon Press",
180+
"date": "1979",
181+
"numPages": "126",
182+
"series": "Contributions of women",
183+
"callNumber": "HD6079.2.U5 B52",
179184
"libraryCatalog": "bostonpl Library Catalog"
180185
}
181186
]
182187
},
183188
{
184189
"type": "web",
185-
"url": "http://bostonpl.bibliocommons.com/item/show/3679347042_adam_smith",
190+
"url": "http://bostonpl.bibliocommons.com/search?t=smart&search_category=keyword&q=labor&commit=Search",
191+
"items": "multiple"
192+
},
193+
{
194+
"type": "web",
195+
"url": "http://nypl.bibliocommons.com/item/show/10974089052_labour",
186196
"items": [
187197
{
188198
"itemType": "book",
189199
"creators": [
190200
{
191-
"firstName": "James R.",
192-
"lastName": "Otteson",
201+
"firstName": "György",
202+
"lastName": "Lukács",
203+
"creatorType": "author"
204+
},
205+
{
206+
"firstName": "György",
207+
"lastName": "Lukács",
193208
"creatorType": "author"
194209
}
195210
],
196211
"notes": [],
197212
"tags": [
198-
"Smith, Adam",
199-
"Free enterprise",
200-
"Classical school of economics"
213+
"Labor",
214+
"Philosophy",
215+
"Philosophy, Marxist"
201216
],
202217
"seeAlso": [],
203218
"attachments": [],
204-
"ISBN": "0826429831",
205-
"title": "Adam Smith",
206-
"place": "New York",
207-
"publisher": "Continuum",
208-
"date": "2011",
209-
"numPages": "179",
210-
"series": "Major conservative and libertarian thinkers",
211-
"seriesNumber": "v. 16",
212-
"callNumber": "HB103.S6 O88 2011",
213-
"libraryCatalog": "bostonpl Library Catalog"
219+
"title": "Labour",
220+
"place": "London",
221+
"publisher": "Merlin Press",
222+
"date": "1980",
223+
"numPages": "139",
224+
"series": "The Ontology of social being",
225+
"seriesNumber": "3",
226+
"callNumber": "JFD 87-5272",
227+
"libraryCatalog": "nypl Library Catalog"
214228
}
215229
]
216230
}

Schweizer Radio und Fernsehen SRF.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"inRepository": true,
1010
"translatorType": 4,
1111
"browserSupport": "gcsibv",
12-
"lastUpdated": "2012-12-19 01:28:48"
12+
"lastUpdated": "2013-02-25 21:02:50"
1313
}
1414

1515
/*
@@ -140,7 +140,7 @@ var testCases = [
140140
},
141141
{
142142
"type": "web",
143-
"url": "http://www.srf.ch/sendungen/echo-der-zeit",
143+
"url": "http://www.srf.ch/sendungen/echo-der-zeit/sendungen",
144144
"items": "multiple"
145145
}
146146
]

0 commit comments

Comments
 (0)