1 | #! /bin/sh -x |
---|
2 | #+ |
---|
3 | # |
---|
4 | # ========= |
---|
5 | # genbib.sh |
---|
6 | # ========= |
---|
7 | # |
---|
8 | # SYNOPSIS |
---|
9 | # ======== |
---|
10 | # |
---|
11 | # .. code-block:: bash |
---|
12 | # |
---|
13 | # ./genbib.sh |
---|
14 | # |
---|
15 | # DESCRIPTION |
---|
16 | # =========== |
---|
17 | # |
---|
18 | # TODO |
---|
19 | # ==== |
---|
20 | # |
---|
21 | # plainnat pourvoir les doi dans le pdf mais des effets de bord |
---|
22 | # sur les champs url et un doi ne passe pas peut-être à cause de "-" |
---|
23 | # |
---|
24 | # pb avec l'apostrophe dans les noms d'auteurs avec bibtool |
---|
25 | # |
---|
26 | # pb biber pour manger toutes les références : TeX capacity exceeded, sorry |
---|
27 | # |
---|
28 | # find missing hal/tel reference with bibtool |
---|
29 | # |
---|
30 | # produce HTML files by year |
---|
31 | # |
---|
32 | # good looking of \delta on jabref outputs |
---|
33 | # |
---|
34 | # ++ doublons |
---|
35 | # |
---|
36 | # ask for installation of biber on cratos |
---|
37 | # |
---|
38 | # jabref.preferences.xml : cleaning |
---|
39 | # |
---|
40 | # jabref doesn't handle multiple url |
---|
41 | # |
---|
42 | # could not encode : still some trouble with degre sign |
---|
43 | # |
---|
44 | # add a test on unescaped ampersand |
---|
45 | # |
---|
46 | # a solution for symbols : |
---|
47 | # bibtex2html --no-abstract --no-keywords --title "Bibliographie du LOCEAN" --footer "$(date)" --style "alpha" --use-keys --raw-url ~/locean/hal/gtbiblio/biblioref.bib |
---|
48 | # |
---|
49 | # Pour récupérer tous les bibtexkey dans le html produit : |
---|
50 | # |
---|
51 | # .. code-block:: bash |
---|
52 | # |
---|
53 | # grep ">bib<" biblioref.html | sed -e "s/.*#//" -e "s/\">.*$//" > list1 |
---|
54 | # |
---|
55 | # Pour récupérer tous les bibtexkey dans le fichier original: |
---|
56 | # |
---|
57 | # .. code-block:: bash |
---|
58 | # |
---|
59 | # grep "@.*{" ../data/biblioref.bib | sed -e "/PREAM/d" -e "s/.*{//" -e "s/,$//" > list2 |
---|
60 | # |
---|
61 | # Faire la différence: |
---|
62 | # |
---|
63 | # .. code-block:: bash |
---|
64 | # |
---|
65 | # sdiff list1 list2 |
---|
66 | # |
---|
67 | # vérifier que les mois sont dans la liste |
---|
68 | # |
---|
69 | # .. code-block:: bash |
---|
70 | # |
---|
71 | # locale -k abmon | tr [:upper:] [:lower:] |
---|
72 | # |
---|
73 | # changer le titre des pages HTML |
---|
74 | # |
---|
75 | # contrÎler le vocabulaire des champs pour avoir la liste des mots utilisés |
---|
76 | # nb : c'est mieux de faire ça aprÚs avoir resauver sous jabref pour |
---|
77 | # uniformiser les séparateurs et les blancs devant |
---|
78 | # chaque option: |
---|
79 | # |
---|
80 | # .. code-block:: bash |
---|
81 | # |
---|
82 | # grep " = {" biblioref.bib | awk -F = '{print $1}' | sed -e "s/ //g" | sort -u |
---|
83 | # |
---|
84 | # pour voir nom/prénom dans la version bibtex (seulemen pour l'oeil ++): |
---|
85 | # |
---|
86 | # .. code-block:: bash |
---|
87 | # |
---|
88 | # grep "author" biblioref.bib | sed -e "s/author = {//" -e "s/},$//" | awk -F " and" '{print $NF}' | sort -u | more |
---|
89 | # |
---|
90 | # Pour corriger la version docbook : remplacer lastname par surname, |
---|
91 | # ajouter la balise debut <bibliography>, |
---|
92 | # remplacer authorgroup dans la doctype par bibliography |
---|
93 | # |
---|
94 | # Pour voir les nom_prenom à patir de la version docbook : |
---|
95 | # |
---|
96 | # .. code-block:: bash |
---|
97 | # |
---|
98 | # xml sel -t -m "//author" -v "concat(surname,' ',firstname)" -n /usr/work/incas/fplod/public_html/gtbiblio/all.docbook.jabref.xml | sort -u |more |
---|
99 | # |
---|
100 | # ou sur mac lion: |
---|
101 | # |
---|
102 | # .. code-block:: bash |
---|
103 | # |
---|
104 | # xmlstarlet sel -t -m "//author" -v "concat(surname,' ',firstname)" -n /tmp/fplod/public_html/gtbiblio/all.docbook.jabref.xml | sort -u |more |
---|
105 | # |
---|
106 | # pour voir la liste des journaux: |
---|
107 | # |
---|
108 | # .. code-block:: bash |
---|
109 | # |
---|
110 | # grep "journal *= *{" biblioref.bib | sed -e "s/journal *= {//" -e "s/},$//g" | sort -u | more |
---|
111 | # |
---|
112 | # EVOLUTIONS |
---|
113 | # ========== |
---|
114 | # |
---|
115 | # $Id$ |
---|
116 | # |
---|
117 | # $URL$ |
---|
118 | # |
---|
119 | # - fplod 20130411T144927Z cratos.locean-ipsl.upmc.fr (Linux) |
---|
120 | # |
---|
121 | # * suppress test on comma in author field |
---|
122 | # - fplod 20130325T145636Z halios.locean-ipsl.upmc.fr (Darwin) |
---|
123 | # |
---|
124 | # * add usage of biber (only on halios now) |
---|
125 | # |
---|
126 | # - fplod 20121108T094612Z cratos.locean-ipsl.upmc.fr (Linux) |
---|
127 | # |
---|
128 | # * externalisation de hal dans genprehal.sh |
---|
129 | # |
---|
130 | # - fplod 20121015T100652Z cratos.locean-ipsl.upmc.fr (Linux) |
---|
131 | # |
---|
132 | # * usage of define_author.sh |
---|
133 | # |
---|
134 | # - fplod 20120703T135330Z cratos (Linux) |
---|
135 | # |
---|
136 | # * usage of PROJECT env. variables |
---|
137 | # |
---|
138 | # - fplod 20120703T105755Z cratos (Linux) |
---|
139 | # |
---|
140 | # * change snapo to caraus/snapo-co2 |
---|
141 | # |
---|
142 | # - fplod 20120419T121614Z cratos (Linux) |
---|
143 | # |
---|
144 | # * add copy of sorttable.js in dirwww |
---|
145 | # * add copy of sorttable.css in dirwww |
---|
146 | # |
---|
147 | # - fplod 20120322 |
---|
148 | # |
---|
149 | # * add authors mainly from Bondy |
---|
150 | # |
---|
151 | # - fplod 20120223 |
---|
152 | # |
---|
153 | # * apply locean_tablerefsabsbibsort format for author (was locean_listrefs) |
---|
154 | # |
---|
155 | # - fplod 20120217 |
---|
156 | # |
---|
157 | # * ajout des auteurs de l'équipe surf |
---|
158 | # |
---|
159 | # - fplod 20120131 |
---|
160 | # |
---|
161 | # * les non publiés sont maintenant tout simplement des @unpublished |
---|
162 | # (plus de ruse avec year={xxxx, *}) |
---|
163 | # |
---|
164 | # - fplod 20111010T073116Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
165 | # |
---|
166 | # * création page thesesud |
---|
167 | # |
---|
168 | # - fplod 20110610T100740Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
169 | # |
---|
170 | # * suppression upmc et labex |
---|
171 | # * ajout création page these |
---|
172 | # |
---|
173 | # - fplod 20110511T155810Z cratos.locean-ipsl.upmc.fr (Linux) |
---|
174 | # |
---|
175 | # * replace /tmp by /usr/work/incas/ |
---|
176 | # |
---|
177 | # - fplod 20110427T110808Z cratos.locean-ipsl.upmc.fr (Linux) |
---|
178 | # |
---|
179 | # * la production pdflatex+bibtex ne fonctionne plus sur aedon. |
---|
180 | # malgré le changement d'installation (port vs fink) rien à faire ! |
---|
181 | # donc - et ça va plutÎt dans le bon sens - machine de référence = cratos. |
---|
182 | # |
---|
183 | # - fplod 20110301T091253Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
184 | # |
---|
185 | # * trying to make it run with bibtool 2.51 on zeus |
---|
186 | # |
---|
187 | # - fplod 20110228T162021Z cratos.locean-ipsl.upmc.fr (Linux) |
---|
188 | # |
---|
189 | # * trying to make it run with bibtool 2.51 on cratos (vs 2.48 sur aedon) |
---|
190 | # |
---|
191 | # - fplod 20101109T144613Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
192 | # |
---|
193 | # * add for upmc 2009-2010 |
---|
194 | # ++ suppression in revision, submitted and so on |
---|
195 | # ++ correction $...$ et Monaco C. L. en Lo Monaco C. |
---|
196 | # ++ je ne sais pas pourquoi rien n'apparait en ouvrant le RTF produit |
---|
197 | # avec TextEdit alors que l'on voit qqe chose en l'ouvrant directement avec |
---|
198 | # OpenOffice. |
---|
199 | # |
---|
200 | # - fplod 20101108T103903Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
201 | # |
---|
202 | # * correction of years selection for 2007-2010 |
---|
203 | # because match year 2000.'select={year "20[01][0789].*"}' |
---|
204 | # |
---|
205 | # * add for labex a selection of articles published in 2009. |
---|
206 | # ++ suppression in revision, submitted and so on |
---|
207 | # ++ auteurs labo (ipsl) en gras dans document word |
---|
208 | # ++ correction $...$ et Monaco C. L. en Lo Monaco C. |
---|
209 | # |
---|
210 | # - fplod 20101013T090448Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
211 | # |
---|
212 | # * add specific RTF output for 2007-2010 articles (labex2007_2010.rtf) |
---|
213 | # |
---|
214 | # - fplod 20100430T131122Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
215 | # |
---|
216 | # * jabref 2.5 -> 2.6 |
---|
217 | # |
---|
218 | # - fplod 20100127T084405Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
219 | # |
---|
220 | # * add generation of HTML files pages by (affectation,year) using bibtool |
---|
221 | # |
---|
222 | # - fplod 20091120T140131Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
223 | # |
---|
224 | # * fix latex pb : PDF production is now possible |
---|
225 | # * detection of [delta] |
---|
226 | # nb: remplacement de [delta] par \delta ok pour la production de PDF avec |
---|
227 | # pdflatex mais pas ok pour la production d'HTML avec jabref |
---|
228 | # |
---|
229 | # - fplod 20091117T093404Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
230 | # |
---|
231 | # * add test if bibtool available |
---|
232 | # |
---|
233 | # - fplod 20091023T125342Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
234 | # |
---|
235 | # * add test if existing {\ : available feature in latex but confusing |
---|
236 | # for author search using bibtool select |
---|
237 | # * add test if , in author field |
---|
238 | # |
---|
239 | # - fplod 20091021T153653Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
240 | # |
---|
241 | # * outputs HTML, PDF and RTF in dirwww |
---|
242 | # |
---|
243 | # - fplod 20091020T134644Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
244 | # |
---|
245 | # * usage of bibtool to find years list |
---|
246 | # * usage of bibtool to produce bibtex files by year |
---|
247 | # * usage of bibtool to produce bibtex files by team (instead of |
---|
248 | # biblio_split.sh + grep) |
---|
249 | # |
---|
250 | # - fplod 20091020T092945Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
251 | # |
---|
252 | # * avoid diacritical and punctuation in filename (list_team_title s |
---|
253 | # list_team_grep) |
---|
254 | # |
---|
255 | # - fplod 20091016T145245Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
256 | # |
---|
257 | # * use locean_listrefs format for every team |
---|
258 | # |
---|
259 | # - fplod 2009-08-21T08:20:29Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
260 | # |
---|
261 | # * add locean_listrefs format |
---|
262 | # |
---|
263 | # - fplod 2009-08-19T15:48:01Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
264 | # |
---|
265 | # * add simplehtml format |
---|
266 | # |
---|
267 | # - fplod 2009-08-17T07:56:02Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
268 | # |
---|
269 | # * add alpha style |
---|
270 | # |
---|
271 | # - fplod 2009-08-14T15:39:44Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
272 | # |
---|
273 | # * use -p option to add customized exports format |
---|
274 | # * add loop one latex biblio style |
---|
275 | # |
---|
276 | # - fplod 2009-08-10T17:08:07Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
277 | # |
---|
278 | # * test with jabref 2.5 |
---|
279 | # * add docbook production |
---|
280 | # |
---|
281 | # - fplod 2009-07-07T10:17:37Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
282 | # |
---|
283 | # * loop on html formats |
---|
284 | # |
---|
285 | # - fplod 2009-07-03T08:01:21Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
286 | # |
---|
287 | # * add latex+bibtex processing |
---|
288 | # |
---|
289 | #- |
---|
290 | set -u |
---|
291 | command=$(basename ${0}) |
---|
292 | # |
---|
293 | system=$(uname) |
---|
294 | case "${system}" in |
---|
295 | AIX|IRIX64) |
---|
296 | echo "${command} : www : no specific posix checking" |
---|
297 | ;; |
---|
298 | *) |
---|
299 | set -o posix |
---|
300 | ;; |
---|
301 | esac |
---|
302 | # |
---|
303 | log_date=$(date -u +"%Y%m%dT%H%M%SZ") |
---|
304 | log=/tmp/$(basename ${command} .sh).log.${log_date} |
---|
305 | # |
---|
306 | usage=" Usage : ${command}" |
---|
307 | # |
---|
308 | # test if bibtool available |
---|
309 | tool=bibtool |
---|
310 | type ${tool} 1> /dev/null 2>&1 |
---|
311 | status=${?} |
---|
312 | if [ ${status} -ne 0 ] |
---|
313 | then |
---|
314 | echo "${command} : eee : ${tool} unavailable" >&2 |
---|
315 | exit 1 |
---|
316 | fi |
---|
317 | unset tool |
---|
318 | unset status |
---|
319 | # |
---|
320 | # default |
---|
321 | # n.a. |
---|
322 | # |
---|
323 | hostname=$(hostname) |
---|
324 | tmpdir=${PROJECT_LOG}/gtbiblio |
---|
325 | dirwww=${PROJECT_OD}/public_html/gtbiblio/ |
---|
326 | rm -rf ${tmpdir} 2> /dev/null |
---|
327 | mkdir -p ${tmpdir} |
---|
328 | rm -rf ${dirwww} 2> /dev/null |
---|
329 | mkdir -p ${dirwww} |
---|
330 | # |
---|
331 | . jabref_header.sh |
---|
332 | # |
---|
333 | # copy javascript and css for sort table in output directory |
---|
334 | cp sorttable.js ${dirwww}/ |
---|
335 | cp sorttable.css ${dirwww}/ |
---|
336 | |
---|
337 | # define team for : |
---|
338 | # - search in bibtex file (in loceanteam field) |
---|
339 | # - give a element of HTML filename (no diacritical and no punctuation) |
---|
340 | iteam=1 |
---|
341 | list_team_bibtool[${iteam}]="phybiocar" |
---|
342 | list_team_title[${iteam}]="phybiocar" |
---|
343 | iteam=$(( ${iteam} + 1)) |
---|
344 | list_team_bibtool[${iteam}]="surf" |
---|
345 | list_team_title[${iteam}]="surf" |
---|
346 | iteam=$(( ${iteam} + 1)) |
---|
347 | list_team_bibtool[${iteam}]="varclim" |
---|
348 | list_team_title[${iteam}]="varclim" |
---|
349 | iteam=$(( ${iteam} + 1)) |
---|
350 | list_team_bibtool[${iteam}]="austral-boréal" |
---|
351 | list_team_title[${iteam}]="austral-boreal" |
---|
352 | iteam=$(( ${iteam} + 1)) |
---|
353 | list_team_bibtool[${iteam}]="bio&pal" |
---|
354 | list_team_title[${iteam}]="bio_et_pal" |
---|
355 | iteam=$(( ${iteam} + 1)) |
---|
356 | list_team_bibtool[${iteam}]="paléotropique" |
---|
357 | list_team_title[${iteam}]="paleotropique" |
---|
358 | iteam=$(( ${iteam} + 1)) |
---|
359 | list_team_bibtool[${iteam}]="caraus/snapo-co2" |
---|
360 | list_team_title[${iteam}]="caraus_snapo-co2" |
---|
361 | iteam=$(( ${iteam} + 1)) |
---|
362 | list_team_bibtool[${iteam}]="dycos" |
---|
363 | list_team_title[${iteam}]="dycos" |
---|
364 | iteam=$(( ${iteam} + 1)) |
---|
365 | list_team_bibtool[${iteam}]="prodyam" |
---|
366 | list_team_title[${iteam}]="prodyam" |
---|
367 | iteam=$(( ${iteam} + 1)) |
---|
368 | list_team_bibtool[${iteam}]="incas" |
---|
369 | list_team_title[${iteam}]="incas" |
---|
370 | iteam=$(( ${iteam} + 1)) |
---|
371 | list_team_bibtool[${iteam}]="mmsa" |
---|
372 | list_team_title[${iteam}]="mmsa" |
---|
373 | iteam=$(( ${iteam} + 1)) |
---|
374 | list_team_bibtool[${iteam}]="ditm" |
---|
375 | list_team_title[${iteam}]="ditm" |
---|
376 | iteam=$(( ${iteam} + 1)) |
---|
377 | list_team_bibtool[${iteam}]="nemo" |
---|
378 | list_team_title[${iteam}]="nemo" |
---|
379 | iteam=$(( ${iteam} + 1)) |
---|
380 | list_team_bibtool[${iteam}]="paleoproxus" |
---|
381 | list_team_title[${iteam}]="paleoproxus" |
---|
382 | iteam=$(( ${iteam} + 1)) |
---|
383 | list_team_bibtool[${iteam}]="vartrop" |
---|
384 | list_team_title[${iteam}]="vartrop" |
---|
385 | # |
---|
386 | # define affectation for : |
---|
387 | # |
---|
388 | # - search in bibtex file (in loceanaffectation field) |
---|
389 | # - give a element of HTML filename (no diacritical and no punctuation) |
---|
390 | # |
---|
391 | iaffectation=1 |
---|
392 | list_affectation_bibtool[${iaffectation}]="mnhn" |
---|
393 | list_affectation_title[${iaffectation}]="mnhn" |
---|
394 | iaffectation=$(( ${iaffectation} + 1)) |
---|
395 | list_affectation_bibtool[${iaffectation}]="cnrs" |
---|
396 | list_affectation_title[${iaffectation}]="cnrs" |
---|
397 | iaffectation=$(( ${iaffectation} + 1)) |
---|
398 | list_affectation_bibtool[${iaffectation}]="ird" |
---|
399 | list_affectation_title[${iaffectation}]="ird" |
---|
400 | iaffectation=$(( ${iaffectation} + 1)) |
---|
401 | list_affectation_bibtool[${iaffectation}]="upmc" |
---|
402 | list_affectation_title[${iaffectation}]="upmc" |
---|
403 | iaffectation=$(( ${iaffectation} + 1)) |
---|
404 | list_affectation_bibtool[${iaffectation}]="uvsq" |
---|
405 | list_affectation_title[${iaffectation}]="uvsq" |
---|
406 | # |
---|
407 | # define bibliography reference file |
---|
408 | # ++ pour test biblioref_orig=../../../trunk/data/petitpoly.bib |
---|
409 | biblioref_orig=${PROJECT_ID}/biblioref.bib #++ parameter |
---|
410 | biblioref=${tmpdir}/all.bib |
---|
411 | cp ${biblioref_orig} ${biblioref} |
---|
412 | # |
---|
413 | # test if "[delta]" |
---|
414 | # if so, exit with error |
---|
415 | list_bad_delta="" |
---|
416 | list_bad_delta=$(grep -n "\[delta\]" ${biblioref}) |
---|
417 | if [ "${list_bad_delta}" != "" ] |
---|
418 | then |
---|
419 | echo "${command} : eee : replace [delta] by \\delta (and check formula) in ${list_bad_delta}" |
---|
420 | exit 1 |
---|
421 | fi |
---|
422 | # |
---|
423 | # test if "{\" like {\'e} |
---|
424 | # if so, exit with error |
---|
425 | list_backslash_after="" |
---|
426 | #++ pb regexp list_backslash_after=$(grep -n "\{\\" ${biblioref}) |
---|
427 | #++grep -n '{\\' ${biblioref} |
---|
428 | if [ "${list_backslash_after}" != "" ] |
---|
429 | then |
---|
430 | echo "${command} : eee : suppress \"{\\\" in ${list_backslash_after}" |
---|
431 | exit 1 |
---|
432 | fi |
---|
433 | unset list_backslash_after |
---|
434 | |
---|
435 | # test if " }" |
---|
436 | # if so, exit with error |
---|
437 | list_blank_before="" |
---|
438 | list_blank_before=$(grep -n " \}" ${biblioref}) |
---|
439 | if [ "${list_blank_before}" != "" ] |
---|
440 | then |
---|
441 | echo "${command} : eee : suppress \" }\" in ${list_blank_before}" |
---|
442 | exit 1 |
---|
443 | fi |
---|
444 | unset list_blank_before |
---|
445 | |
---|
446 | # test if "{ " |
---|
447 | # if so, exit with error |
---|
448 | list_blank_after="" |
---|
449 | list_blank_after=$(grep -n "\{ " ${biblioref}) |
---|
450 | if [ "${list_blank_after}" != "" ] |
---|
451 | then |
---|
452 | echo "${command} : eee : suppress \"{ \" in ${list_blank_after}" |
---|
453 | exit 1 |
---|
454 | fi |
---|
455 | unset list_blank_after |
---|
456 | |
---|
457 | # test if doi in url field (because of HAL bibtex output) |
---|
458 | # if so, exit with error |
---|
459 | list_doi_in_url="" |
---|
460 | list_doi_in_url=$(grep -n "url = {dx" ${biblioref}) |
---|
461 | if [ "${list_doi_in_url}" != "" ] |
---|
462 | then |
---|
463 | echo "${command} : eee : suppress doi from url fied in ${list_doi_in_url}" |
---|
464 | exit 1 |
---|
465 | fi |
---|
466 | unset list_doi_in_url |
---|
467 | # |
---|
468 | # test if { or } in doi field (because of HAL bibtex output) |
---|
469 | # if so, exit with error |
---|
470 | list_bad_doi="" |
---|
471 | list_bad_doi=$(grep -n "doi = {.*{.*}.*}" ${biblioref}) |
---|
472 | if [ "${list_bad_doi}" != "" ] |
---|
473 | then |
---|
474 | echo "${command} : eee : suppress \{ or \} from doi fied in ${list_bad_doi}" |
---|
475 | exit 1 |
---|
476 | fi |
---|
477 | unset list_bad_doi |
---|
478 | |
---|
479 | # test if doi does'nt start with 10 |
---|
480 | # ++ je ne sais pas rédiger cette contrainte en grep |
---|
481 | # if so, exit with error |
---|
482 | list_bad_doi="" |
---|
483 | list_bad_doi=$(grep "doi = {.*}" ${biblioref} | grep -v "doi = {10") |
---|
484 | if [ "${list_bad_doi}" != "" ] |
---|
485 | then |
---|
486 | echo "${command} : eee : find and modify ${list_bad_doi} suppress in ${biblioref}" |
---|
487 | exit 1 |
---|
488 | fi |
---|
489 | unset list_bad_doi |
---|
490 | |
---|
491 | # test if { or } in pages field (because of HAL bibtex output) |
---|
492 | # if so, exit with error |
---|
493 | list_bad_pages="" |
---|
494 | list_bad_pages=$(grep -n "pages={.*{.*}.*}" ${biblioref}) |
---|
495 | if [ "${list_bad_pages}" != "" ] |
---|
496 | then |
---|
497 | echo "${command} : eee : suppress \{ or \} from pages field in ${list_bad_pages}" |
---|
498 | #++exit 1 |
---|
499 | fi |
---|
500 | unset list_bad_pages |
---|
501 | |
---|
502 | # test if semi-cadratin++ translation in pages field (because of HAL bibtex output) |
---|
503 | # if so, exit with error |
---|
504 | #++echo "${command} : eee : ++ suppress ++ semi-cadratin from pages fied in ${list_bad_pages}" |
---|
505 | #++exit 1 |
---|
506 | |
---|
507 | # artificial header of jabref file to enforce encoding |
---|
508 | jabref_header ${tmpdir}/header_jabref |
---|
509 | # |
---|
510 | #list_style="amsalpha plain alpha" |
---|
511 | list_style="plain" #+++ |
---|
512 | for style in ${list_style} |
---|
513 | do |
---|
514 | rm ${dirwww}/$(basename ${biblioref}.${style}.log .log).* 2> /dev/null |
---|
515 | # generation of latex file |
---|
516 | cat << EOF > ${biblioref}.${style}.tex |
---|
517 | \documentclass[a4paper]{article} |
---|
518 | %++\usepackage[frenchb]{babel} |
---|
519 | \usepackage[latin1]{inputenc} |
---|
520 | \begin{document} |
---|
521 | % force to include all entry of the bibliography |
---|
522 | \nocite{*} |
---|
523 | |
---|
524 | % bibliography |
---|
525 | \bibliographystyle{${style}} |
---|
526 | |
---|
527 | \bibliography{${biblioref}} |
---|
528 | \end{document} |
---|
529 | EOF |
---|
530 | # |
---|
531 | # processing bibliography with pdflatex (${dirwww}/${biblioref}.${style}.pdf) |
---|
532 | rm ${dirwww}/$(basename ${biblioref}.${style}.log .log).* 2> /dev/null |
---|
533 | pdflatex -output-directory ${dirwww} ${biblioref}.${style}.tex |
---|
534 | bibtex ${dirwww}/$(basename ${biblioref}.${style}) |
---|
535 | #++ warnings |
---|
536 | pdflatex -output-directory ${dirwww} ${biblioref}.${style}.tex |
---|
537 | pdflatex -output-directory ${dirwww} ${biblioref}.${style}.tex |
---|
538 | # |
---|
539 | # remove temporary latex files |
---|
540 | #ls ${dirwww}/$(basename ${biblioref}.${style})* |
---|
541 | rm ${dirwww}/$(basename ${biblioref}.${style}.bbl) ${dirwww}/$(basename ${biblioref}.${style}.blg) ${dirwww}/$(basename ${biblioref}.${style}.log) ${dirwww}/$(basename ${biblioref}.${style}.aux) 2> /dev/null |
---|
542 | # |
---|
543 | rm ${biblioref}.${style}.tex 2> /dev/null |
---|
544 | done |
---|
545 | |
---|
546 | echo "fin 1re passe latex+bibtex" |
---|
547 | read a |
---|
548 | # |
---|
549 | # test if biber available |
---|
550 | tool=biber |
---|
551 | type ${tool} 1> /dev/null 2>&1 |
---|
552 | status=${?} |
---|
553 | if [ ${status} -ne 0 ] |
---|
554 | then |
---|
555 | echo "${command} : eee : ${tool} unavailable" >&2 |
---|
556 | else |
---|
557 | style=biber |
---|
558 | #++option_pdflatex=-interaction=nonstopmode |
---|
559 | option_pdflatex="" |
---|
560 | # processing bibliography with pdflatex (${dirwww}/${biblioref}.${style}.pdf) |
---|
561 | rm ${dirwww}/$(basename ${biblioref}.${style}.log .log).* 2> /dev/null |
---|
562 | sed -e "s@ginette@${biblioref}@" biblio_biber_biblatex.tex > ${biblioref}.${style}.tex |
---|
563 | # |
---|
564 | pdflatex ${option_pdflatex} -output-directory ${dirwww} ${biblioref}.${style}.tex |
---|
565 | biber ${dirwww}/$(basename ${biblioref}.${style}).bcf |
---|
566 | #++ warnings |
---|
567 | pdflatex ${option_pdflatex} -output-directory ${dirwww} ${biblioref}.${style}.tex |
---|
568 | pdflatex ${option_pdflatex} -output-directory ${dirwww} ${biblioref}.${style}.tex |
---|
569 | # |
---|
570 | # remove temporary latex files |
---|
571 | rm ${dirwww}/$(basename ${biblioref}.${style}.bbl) ${dirwww}/$(basename ${biblioref}.${style}.blg) ${dirwww}/$(basename ${biblioref}.${style}.log) ${dirwww}/$(basename ${biblioref}.${style}.aux) ${dirwww}/$(basename ${biblioref}.${style}.bcf) ${dirwww}/$(basename ${biblioref}.${style}.run.xml) 2> /dev/null |
---|
572 | # |
---|
573 | rm ${biblioref}.${style}.tex 2> /dev/null |
---|
574 | fi |
---|
575 | unset tool |
---|
576 | unset status |
---|
577 | echo "fin 1re passe latex+biber" |
---|
578 | read a |
---|
579 | # |
---|
580 | # pour vérifier que j'ai bien tout mes styles d'exportation |
---|
581 | # pour mémoire |
---|
582 | #java -jar ${JABREF_DIR}/JabRef-${JABREF_VERSION}.jar -n true \ |
---|
583 | #-p ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml -h |
---|
584 | |
---|
585 | # processing on the whole bibliography reference file |
---|
586 | output_title=all |
---|
587 | # generation one RTF file style harvard |
---|
588 | rm ${biblioref}.harvard.jabref.rtf 2> /dev/null |
---|
589 | java -jar ${JABREF_DIR}/JabRef-${JABREF_VERSION}.jar -n true \ |
---|
590 | -p ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \ |
---|
591 | --output ${dirwww}/${output_title}.harvard.jabref.rtf,harvard \ |
---|
592 | ${biblioref} |
---|
593 | echo "fin rtf all" |
---|
594 | # |
---|
595 | # theses |
---|
596 | bibtool -- 'select{@phdthesis}' ${biblioref} -o ${tmpdir}/tmp1.bib |
---|
597 | bibtool -- 'select={type ".*doctorat.*"}' -- 'sort.format={%d(year)%N(author)}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp2.bib |
---|
598 | rm ${tmpdir}/tmp1.bib |
---|
599 | java -jar ${JABREF_DIR}/JabRef-${JABREF_VERSION}.jar -n true \ |
---|
600 | -p ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \ |
---|
601 | --output ${dirwww}/these.html,locean_tablerefsabsbibsort \ |
---|
602 | ${tmpdir}/tmp2.bib |
---|
603 | rm ${tmpdir}/tmp2.bib |
---|
604 | echo "fin these" |
---|
605 | # |
---|
606 | # page thesesud |
---|
607 | bibtool -- 'select{@phdthesis}' ${biblioref} -o ${tmpdir}/tmp1.bib |
---|
608 | bibtool -- 'select={type ".*doctorat.*"}' -- 'sort.format={%d(year)%N(author)}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp2.bib |
---|
609 | bibtool -- 'select={ird_thesesud "oui"}' ${tmpdir}/tmp2.bib \ |
---|
610 | -o ${tmpdir}/tmp3.bib |
---|
611 | rm ${tmpdir}/tmp1.bib ${tmpdir}/tmp2.bib |
---|
612 | java -jar ${JABREF_DIR}/JabRef-${JABREF_VERSION}.jar -n true \ |
---|
613 | -p ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \ |
---|
614 | --output ${dirwww}/thesesud.html,locean_tablerefsabsbibsort \ |
---|
615 | ${tmpdir}/tmp3.bib |
---|
616 | #++rm ${tmpdir}/tmp3.bib |
---|
617 | echo "fin thesesud" |
---|
618 | |
---|
619 | # find the years list |
---|
620 | # . select all the references with no "," in year field |
---|
621 | bibtool -- 'select.non={year ","}' ${biblioref} -o ${tmpdir}/tmp.bib |
---|
622 | # . extract year field |
---|
623 | list_year=$(grep "^ year =" ${tmpdir}/tmp.bib | sort -u | sed -e "s/^ year = {//" -e "s/},//" -e "s/}//") |
---|
624 | rm ${tmpdir}/tmp.bib |
---|
625 | # |
---|
626 | # write a bibtex file for each year of the list |
---|
627 | for iyear in ${list_year} |
---|
628 | do |
---|
629 | # select year |
---|
630 | bibtool_command="bibtool -- 'select={year \"${iyear}\"}' ${biblioref} -o ${tmpdir}/tmp1.bib" |
---|
631 | eval ${bibtool_command} |
---|
632 | # remove unpublished reference |
---|
633 | bibtool -- 'select.non={@unpublished}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp2.bib |
---|
634 | cat ${tmpdir}/header_jabref ${tmpdir}/tmp2.bib > ${tmpdir}/tmp_${iyear}.bib |
---|
635 | rm ${tmpdir}/tmp1.bib |
---|
636 | rm ${tmpdir}/tmp2.bib |
---|
637 | done |
---|
638 | #++ on ne fait rien de ${tmpdir}/tmp_${iyear}.bib |
---|
639 | # |
---|
640 | # write a bibtex file for unpublished work |
---|
641 | bibtool -- 'select={@unpublished}' ${biblioref} -o ${tmpdir}/tmp2.bib |
---|
642 | cat ${tmpdir}/header_jabref ${tmpdir}/tmp2.bib > ${tmpdir}/tmp_unpublished.bib |
---|
643 | rm ${tmpdir}/tmp2.bib |
---|
644 | #++ on ne fait rien de ${tmpdir}/tmp_unpublished.bib |
---|
645 | # |
---|
646 | list_format="html simplehtml tablerefs locean_tablerefs locean_tablerefsabsbibsort locean_listrefs" |
---|
647 | #+++list_format="" #+++ |
---|
648 | for format in ${list_format} |
---|
649 | do |
---|
650 | echo "format export jabref ${format}" |
---|
651 | # generation one HTML file style ${format} |
---|
652 | rm ${biblioref}.${format}.jabref.html 2> /dev/null |
---|
653 | java -jar ${JABREF_DIR}/JabRef-${JABREF_VERSION}.jar -n true \ |
---|
654 | -p ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \ |
---|
655 | --output ${dirwww}/${output_title}.${format}.jabref.html,${format} \ |
---|
656 | ${biblioref} |
---|
657 | jabref_status=${?} |
---|
658 | if [ ${jabref_status} -ne 0 ] |
---|
659 | then |
---|
660 | echo "${command} : eee : pb with jabref export ${format}" |
---|
661 | exit 1 |
---|
662 | fi |
---|
663 | done |
---|
664 | |
---|
665 | # generation of DocBook |
---|
666 | format=docbook |
---|
667 | rm ${biblioref}.${format}.jabref.html 2> /dev/null |
---|
668 | java -jar ${JABREF_DIR}/JabRef-${JABREF_VERSION}.jar -n true \ |
---|
669 | -p ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \ |
---|
670 | --output ${dirwww}/${output_title}.${format}.jabref.xml,${format} \ |
---|
671 | ${biblioref} |
---|
672 | jabref_status=${?} |
---|
673 | if [ ${jabref_status} -ne 0 ] |
---|
674 | then |
---|
675 | echo "${command} : eee : pb with jabref export ${format}" |
---|
676 | exit 1 |
---|
677 | fi |
---|
678 | |
---|
679 | # loop on teams to build bibliography reference file |
---|
680 | iteam=1 |
---|
681 | nbteam=${#list_team_bibtool[@]} |
---|
682 | #+++nbteam=0 |
---|
683 | while [ ${iteam} -le ${nbteam} ] |
---|
684 | do |
---|
685 | echo "team title = ${list_team_title[iteam]}" |
---|
686 | echo "team grep = ${list_team_bibtool[iteam]}" |
---|
687 | biblioref_team=${tmpdir}/${list_team_title[iteam]}.bib |
---|
688 | bibtool_command="bibtool -- 'select={loceanteam \"${list_team_bibtool[iteam]}\"}' ${biblioref} -o ${tmpdir}/tmp1.bib" |
---|
689 | eval ${bibtool_command} |
---|
690 | # test if no file found ++ |
---|
691 | cat ${tmpdir}/header_jabref ${tmpdir}/tmp1.bib > ${biblioref_team} |
---|
692 | format=locean_listrefs |
---|
693 | # generation one HTML file style ${format} |
---|
694 | rm ${biblioref}.${format}.jabref.html 2> /dev/null |
---|
695 | java -jar ${JABREF_DIR}/JabRef-${JABREF_VERSION}.jar -n true \ |
---|
696 | -p ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \ |
---|
697 | --output ${dirwww}/${list_team_title[iteam]}.${format}.jabref.html,${format} \ |
---|
698 | ${biblioref_team} |
---|
699 | jabref_status=${?} |
---|
700 | if [ ${jabref_status} -ne 0 ] |
---|
701 | then |
---|
702 | echo "${command} : eee : pb with jabref export ${format}" |
---|
703 | exit 1 |
---|
704 | fi |
---|
705 | #++ else |
---|
706 | #++ echo "${command} : iii : no reference for team ${team}" |
---|
707 | #++ fi |
---|
708 | iteam=$(( ${iteam} + 1 )) |
---|
709 | done |
---|
710 | |
---|
711 | # loop on affectations to build bibliography reference file |
---|
712 | format=locean_listrefs |
---|
713 | iaffectation=1 |
---|
714 | nbaffectation=${#list_affectation_bibtool[@]} |
---|
715 | while [ ${iaffectation} -le ${nbaffectation} ] |
---|
716 | do |
---|
717 | echo "affectation title = ${list_affectation_title[iaffectation]}" |
---|
718 | echo "affectation grep = ${list_affectation_bibtool[iaffectation]}" |
---|
719 | bibtool_command="bibtool -- 'select={loceanaffectation \"${list_affectation_bibtool[iaffectation]}\"}' ${biblioref} -o ${tmpdir}/tmp1.bib" |
---|
720 | eval ${bibtool_command} |
---|
721 | # test if no file found ++ |
---|
722 | # select all the references of unpublished work |
---|
723 | bibtool -- 'select={@unpublished}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp2.bib |
---|
724 | biblioref_affectation_unpublished=${tmpdir}/${list_affectation_title[iaffectation]}_${iyear}.bib |
---|
725 | cat ${tmpdir}/header_jabref ${tmpdir}/tmp2.bib > ${biblioref_affectation_unpublished} |
---|
726 | # generation one HTML file style ${format} |
---|
727 | rm ${biblioref}.${format}.jabref.html 2> /dev/null |
---|
728 | java -jar ${JABREF_DIR}/JabRef-${JABREF_VERSION}.jar -n true \ |
---|
729 | -p ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \ |
---|
730 | --output ${dirwww}/${list_affectation_title[iaffectation]}_unpublished.${format}.jabref.html,${format} \ |
---|
731 | ${biblioref_affectation_unpublished} |
---|
732 | jabref_status=${?} |
---|
733 | if [ ${jabref_status} -ne 0 ] |
---|
734 | then |
---|
735 | echo "${command} : eee : pb with jabref export ${format}" |
---|
736 | exit 1 |
---|
737 | fi |
---|
738 | # find the years list |
---|
739 | # . select all the references of published work |
---|
740 | bibtool -- 'select.non={@unpublished}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp2.bib |
---|
741 | # . extract year field |
---|
742 | list_year=$(grep "^ year =" ${tmpdir}/tmp2.bib | sed -e "s/^ year = {//" -e "s/},//" -e "s/}$//" | sort -u) |
---|
743 | echo "list_years for ${list_affectation_title[iaffectation]} : ${list_year}" |
---|
744 | # write a bibtex file for each year of the list |
---|
745 | for iyear in ${list_year} |
---|
746 | do |
---|
747 | # select year |
---|
748 | bibtool_command="bibtool -- 'select={year \"${iyear}\"}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp3.bib" |
---|
749 | eval ${bibtool_command} |
---|
750 | biblioref_affectation_year=${tmpdir}/${list_affectation_title[iaffectation]}_${iyear}.bib |
---|
751 | cat ${tmpdir}/header_jabref ${tmpdir}/tmp3.bib > ${biblioref_affectation_year} |
---|
752 | # generation one HTML file style ${format} |
---|
753 | rm ${biblioref}.${format}.jabref.html 2> /dev/null |
---|
754 | java -jar ${JABREF_DIR}/JabRef-${JABREF_VERSION}.jar -n true \ |
---|
755 | -p ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \ |
---|
756 | --output ${dirwww}/${list_affectation_title[iaffectation]}_${iyear}.${format}.jabref.html,${format} \ |
---|
757 | ${biblioref_affectation_year} |
---|
758 | jabref_status=${?} |
---|
759 | if [ ${jabref_status} -ne 0 ] |
---|
760 | then |
---|
761 | echo "${command} : eee : pb with jabref export ${format}" |
---|
762 | exit 1 |
---|
763 | fi |
---|
764 | #++ else |
---|
765 | #++ echo "${command} : iii : no reference for affectation ${affectation}" |
---|
766 | #++ fi |
---|
767 | # end of loop on years |
---|
768 | done |
---|
769 | iaffectation=$(( ${iaffectation} + 1 )) |
---|
770 | done |
---|
771 | |
---|
772 | . define_authors.sh |
---|
773 | # |
---|
774 | # loop on authors to build bibliography reference file |
---|
775 | iauthor=1 |
---|
776 | nbauthor=${#list_author_bibtool[@]} |
---|
777 | #++nbauthor=0 #+++ |
---|
778 | while [ ${iauthor} -le ${nbauthor} ] |
---|
779 | do |
---|
780 | rm ${tmpdir}/tmp1.bib 2> /dev/null |
---|
781 | echo "author title = ${list_author_title[iauthor]}" |
---|
782 | echo "author grep = ${list_author_bibtool[iauthor]}" |
---|
783 | biblioref_author=${tmpdir}/${list_author_file[iauthor]}.bib |
---|
784 | bibtool_command="bibtool -- 'select={author \"${list_author_bibtool[iauthor]}\"}' ${biblioref} -o ${tmpdir}/tmp1.bib" |
---|
785 | eval ${bibtool_command} |
---|
786 | # test if no file found ++ |
---|
787 | cat ${tmpdir}/header_jabref ${tmpdir}/tmp1.bib > ${biblioref_author} |
---|
788 | format=locean_tablerefsabsbibsort |
---|
789 | # generation one HTML file style ${format} |
---|
790 | rm ${dirwww}/${list_author_file[iauthor]}.${format}.jabref.html 2> /dev/null |
---|
791 | java -jar ${JABREF_DIR}/JabRef-${JABREF_VERSION}.jar -n true \ |
---|
792 | -p ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \ |
---|
793 | --output ${dirwww}/${list_author_file[iauthor]}.${format}.jabref.html,${format} \ |
---|
794 | ${biblioref_author} |
---|
795 | jabref_status=${?} |
---|
796 | if [ ${jabref_status} -ne 0 ] |
---|
797 | then |
---|
798 | echo "${command} : eee : pb with jabref export ${format}" |
---|
799 | exit 1 |
---|
800 | fi |
---|
801 | #++ else |
---|
802 | #++ echo "${command} : iii : no reference for author ${team}" |
---|
803 | #++ fi |
---|
804 | iauthor=$(( ${iauthor} + 1 )) |
---|
805 | done |
---|
806 | echo "fin auteurs" |
---|
807 | |
---|
808 | #++rm ${biblioref} 2> /dev/null |
---|
809 | #++rm ${biblioref}_hal 2> /dev/null |
---|
810 | #++rm ${tmpdir}/header_jabref 2> /dev/null |
---|
811 | |
---|
812 | exit 0 |
---|