This repository has been archived by the owner on Jan 3, 2020. It is now read-only.
forked from zotero/translators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHAL Archives Ouvertes.js
334 lines (324 loc) · 12.6 KB
/
HAL Archives Ouvertes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
{
"translatorID": "f20f91fe-d875-47e7-9656-0abb928be472",
"label": "HAL Archives Ouvertes",
"creator": "Sebastian Karcher",
"target": "^https?://hal\\.archives-ouvertes\\.fr",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2014-11-08 21:46:36"
}
/*
***** BEGIN LICENSE BLOCK *****
HAL translator
Copyright © 2012-2014 Sebastian Karcher
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (url.search(/\/search\/index\//)!=-1) return "multiple";
if (url.search(/\index\.php\?halsid=|\.fr\/[a-z]+-\d+/)!=-1) return findItemType(doc, url);
}
function findItemType(doc, url){
var itemType= ZU.xpathText(doc, '//div[contains(@class, "label")]');
//Z.debug(itemType)
var typeMap = {
"Books": "book",
"Ouvrage (y compris édition critique et traduction)": "book",
"Book sections": "bookSection",
"Chapitre d'ouvrage": "bookSection",
"Conference papers": "conferencePaper",
"Communication dans un congrès": "conferencePaper",
"Directions of work or proceedings": "book",
"Direction d'ouvrage, Proceedings": "book",
"Journal articles": "journalArticle",
"Article dans des revues": "journalArticle",
"Lectures": "presentation",
"Cours": "presentation",
"Other publications": "book", //this could also be report, not sure here but bibtex guesses book
"Autre publication": "book", //this could also be report, not sure here but bibtex guesses book
"Patents": "patent",
"Brevet": "patent",
"Preprints, Working Papers, ...": "manuscript",
"Pré-publication, Document de travail": "manuscript",
"Reports": "report",
"Rapport": "report",
"Theses": "thesis",
"Thèse": "thesis"
}
if (typeMap[itemType]) return typeMap[itemType];
else if (url.indexOf("medihal-")!=-1) return "artwork";
else return "journalArticle";
}
function doWeb(doc, url) {
var articles = new Array();
if (detectWeb(doc, url) == "multiple") {
var items = {};
var titles = doc.evaluate('//strong/a[@data-original-title="Display the resource" or @data-original-title="Voir la ressource"]', doc, null, XPathResult.ANY_TYPE, null);
var title;
while (title = titles.iterateNext()) {
items[title.href] = title.textContent;
}
Zotero.selectItems(items, function (items) {
if (!items) {
return true;
}
for (var i in items) {
articles.push(i);
}
Zotero.Utilities.processDocuments(articles, scrape)
});
} else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var bibtexUrl = url.replace(/#.+|\/$/, "") + "/bibtex";
var abstract = ZU.xpathText(doc, '//div[@class="abstract-content"]');
var pdfUrl = url.replace(/#.+|\/$/, "") + "/document";
//Z.debug(pdfUrl)
ZU.doGet(bibtexUrl, function (bibtex) {
//Z.debug(bibtex)
var translator = Zotero.loadTranslator("import");
translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4");
translator.setString(bibtex);
translator.setHandler("itemDone", function (obj, item) {
if (abstract){
item.abstractNote=abstract.replace(/(Abstract|Résumé)\s*:/, "");
}
if (ZU.xpathText(doc, '//div/a[contains(@data-original-title, ".pdf")]')){
item.attachments = [{
url: pdfUrl,
title: "HAL PDF Full Text",
mimeType: "application/pdf"
}];
}
else{
item.attachments = [{
document: doc,
title: "HAL Snapshot",
mimeType: "text/html"
}];
}
if (detectWeb(doc, url)=="artwork"|detectWeb(doc, url)=="presentation"){
item.itemType= detectWeb(doc, url);
}
item.complete();
});
translator.translate();
})
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://hal.archives-ouvertes.fr/hal-00328427",
"items": [
{
"itemType": "journalArticle",
"title": "Tropopause referenced ozone climatology and inter-annual variability (1994–2003) from the MOZAIC programme",
"creators": [
{
"firstName": "V.",
"lastName": "Thouret",
"creatorType": "author"
},
{
"firstName": "J.-P.",
"lastName": "Cammas",
"creatorType": "author"
},
{
"firstName": "B.",
"lastName": "Sauvage",
"creatorType": "author"
},
{
"firstName": "G.",
"lastName": "Athier",
"creatorType": "author"
},
{
"firstName": "R.",
"lastName": "Zbinden",
"creatorType": "author"
},
{
"firstName": "P.",
"lastName": "Nédélec",
"creatorType": "author"
},
{
"firstName": "P.",
"lastName": "Simon",
"creatorType": "author"
},
{
"firstName": "F.",
"lastName": "Karcher",
"creatorType": "author"
}
],
"date": "March 2006",
"abstractNote": "The MOZAIC programme collects ozone and water vapour data using automatic equipment installed on board five long-range Airbus A340 aircraft flying regularly all over the world since August 1994. Those measurements made between September 1994 and August 1996 allowed the first accurate ozone climatology at 9–12 km altitude to be generated. The seasonal variability of the tropopause height has always provided a problem when constructing climatologies in this region. To remove any signal from the seasonal and synoptic scale variability in tropopause height we have chosen in this further study of these and subsequent data to reference our climatology to the altitude of the tropopause. We define the tropopause as a mixing zone 30 hPa thick across the 2 pvu potential vorticity surface. A new ozone climatology is now available for levels characteristic of the upper troposphere (UT) and the lower stratosphere (LS) regardless of the seasonal variations of the tropopause over the period 1994–2003. Moreover, this new presentation has allowed an estimation of the monthly mean climatological ozone concentration at the tropopause showing a sine seasonal variation with a maximum in May (120 ppbv) and a minimum in November (65 ppbv). Besides, we present a first assessment of the inter-annual variability of ozone in this particular critical region. The overall increase in the UTLS is about 1%/yr for the 9 years sampled. However, enhanced concentrations about 10–15 % higher than the other years were recorded in 1998 and 1999 in both the UT and the LS. This so-called \"1998–1999 anomaly\" may be attributed to a combination of different processes involving large scale modes of atmospheric variability, circulation features and local or global pollution, but the most dominant one seems to involve the variability of the North Atlantic Oscillation (NAO) as we find a strong positive correlation (above 0.60) between ozone recorded in the upper troposphere and the NAO index. A strong anti-correlation is also found between ozone and the extremes of the Northern Annular Mode (NAM) index, attributing the lower stratospheric variability to dynamical anomalies. Finally this analysis highlights the coupling between the troposphere, at least the upper one, and the stratosphere, at least the lower one.",
"issue": "4",
"itemID": "thouret:hal-00328427",
"libraryCatalog": "HAL Archives Ouvertes",
"pages": "1051",
"publicationTitle": "Atmospheric Chemistry and Physics",
"url": "https://hal.archives-ouvertes.fr/hal-00328427",
"volume": "6",
"attachments": [
{
"title": "HAL Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://hal.archives-ouvertes.fr/hal-00472553v1",
"items": [
{
"itemType": "book",
"title": "Les sites préhistoriques de la région de Fejej, Sud-Omo, Éthiopie, dans leur contexte stratigraphique et paléontologique.",
"creators": [
{
"firstName": "Henry",
"lastName": "De Lumley",
"creatorType": "author"
},
{
"firstName": "Beyene",
"lastName": "Yonas",
"creatorType": "author"
}
],
"date": "2004",
"abstractNote": "Parmi les nombreux sites paléontologiques et préhistoriques de la région de Fejej, dans la région Sud-Omo, en Éthiopie, le site FJ-1, situé à seulement 5 km au nord de la frontière avec le Kenya et daté de 1,96 Ma, parfaitement en place, très riche en faune et en industrie, étudié avec une approche interdisciplinaire, apporte des informations exceptionnelles pour reconstituer l'habitat, le comportement et le mode de vie, ainsi que les paléoenvironnements des premiers hommes. Des Homo habilis s'étaient installés sur un bourrelet de sables fluviatiles, grossier et meuble, bordé par un dénivelé de 50 cm de hauteur, à proximité de la berge d'une rivière, pendant une période d'étiage, et au coeur d'une plaine d'inondation. Peu de temps sans doute après leur départ, en période de pluie une remontée des eaux de la rivière a provoqué l'enfouissement du sol d'occupation par de nouveaux dépôt de sables qui ont protégé l'ensemble sans le déplacer. La bonne conservation du matériel archéologique et paléontologique, l'enfouissement rapide et le maintien des objets en place, les nombreux remontages effectués, que ce soit en ce qui concerne las artefacts lithiques ou les reste fauniques, les traces de fracturations anthropiques et la non-intervention d'autres prédateurs carnivores, sont, entre autre les conditions exceptionnelles de mise en place et d'étude de ce gisement, qui nous apporte autant de renseignements rares et précieux sur un épisode de la vie des hominidés d'il y a presque 2 millions d'années.",
"itemID": "delumley:hal-00472553",
"libraryCatalog": "HAL Archives Ouvertes",
"numPages": "637 p.",
"publisher": "Éditions Recherche sur les Civilisations",
"url": "https://hal.archives-ouvertes.fr/hal-00472553",
"attachments": [
{
"title": "HAL Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://hal.archives-ouvertes.fr/hal-00973502",
"items": [
{
"itemType": "report",
"title": "Learning Centre de l'UHA : comment accompagner son ouverture et inciter les futurs usagers à exploiter ce nouveau centre de ressources ?",
"creators": [
{
"firstName": "Bernard",
"lastName": "Coulibaly",
"creatorType": "author"
},
{
"firstName": "Hélène",
"lastName": "Hermann",
"creatorType": "author"
}
],
"date": "March 2014",
"extra": "140 pages",
"itemID": "coulibaly:hal-00973502",
"libraryCatalog": "HAL Archives Ouvertes",
"shortTitle": "Learning Centre de l'UHA",
"url": "https://hal.archives-ouvertes.fr/hal-00973502",
"attachments": [
{
"title": "HAL PDF Full Text",
"mimeType": "application/pdf"
}
],
"tags": [
" ICT appropriation",
"Bibliothèque universitaire",
"Innovation",
"Learning Centre",
"Pedagogy",
"University Library",
"appropriation TICE",
"innovation",
"pédagogie universitaire"
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://hal.archives-ouvertes.fr/medihal-00772952v1",
"items": [
{
"itemType": "artwork",
"title": "Children playing in a park",
"creators": [
{
"firstName": "François",
"lastName": "Gipouloux",
"creatorType": "author"
}
],
"date": "March 2012",
"abstractNote": "Children performing for a crowd of passersby in a park in Kunming. (Enfants jouant dans un parc à Kunming Photo d'enfants jouant dans un parc à Kunming",
"itemID": "gipouloux:medihal-00772952",
"libraryCatalog": "HAL Archives Ouvertes",
"url": "https://medihal.archives-ouvertes.fr/medihal-00772952",
"attachments": [
{
"title": "HAL Snapshot",
"mimeType": "text/html"
}
],
"tags": [
"China",
"Kunming",
"children",
"park",
"town"
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://hal.archives-ouvertes.fr/search/index/q/%2A/docType_s/THESE/",
"items": "multiple"
}
]
/** END TEST CASES **/