source: branches/bibliolocean/src/genbib.sh @ 130

Last change on this file since 130 was 130, checked in by pinsard, 12 years ago

improve AERES visibility

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id URL
File size: 34.5 KB
Line 
1#! /bin/sh -x
2#+
3#
4# =========
5# genbib.sh
6# =========
7#
8# SYNOPSIS
9# ========
10#
11# ``./genbib.sh``
12#
13# DESCRIPTION
14# ===========
15#
16#
17# TODO
18# ====
19#
20# pb avec l'apostrophe dans les noms d'auteurs avec bibtool
21#
22# find missing hal/tel reference with bibtool
23#
24# produce HTML files by year
25#
26# good looking of \delta on jabref outputs
27#
28# 180 et 13C sideupper
29#
30# check for all chemical and physical expressions
31#
32# add a test on unescaped ampersand
33#
34# a solution for symbols :
35# bibtex2html --no-abstract --no-keywords --title "Bibliographie du LOCEAN" --footer "$(date)" --style "alpha" --use-keys --raw-url  ~/locean/hal/gtbiblio/biblioref.bib
36#
37# vérifier que les mois sont dans la liste
38# locale -k abmon | tr [:upper:] [:lower:]
39#
40# changer le titre des pages HTML
41#
42# contrôler le vocabulaire des champs
43# pour avoir la liste des mots utilisés ::
44#
45#  $  grep "=" biblioref.bib | awk -F = '{print $1}' | sed -e "s/ //g" | sort -u
46#
47# pour voir nom/prénom dans la version bibtex (seulemen pour l'oeil ++)::
48#
49#   $ grep "author" biblioref.bib | sed -e "s/author = {//" -e "s/},$//" |  awk -F " and" '{print $NF}' | sort -u | more
50#
51# Pour corriger la version docbook : remplacer lastname par surname, ajouter la balise debut <bibliography>,
52# remplacer authorgroup dans la doctype par bibliography
53#
54# Pour voir les nom_prenom à patir de la version docbook ::
55#
56#  $ xml sel -t -m "//author" -v "concat(surname,' ',firstname)" -n /usr/work/incas/fplod/public_html/gtbiblio/all.docbook.jabref.xml | sort -u |more
57#
58# ou sur mac lion::
59#
60#  $ xmlstarlet sel -t -m "//author" -v "concat(surname,' ',firstname)" -n /tmp/fplod/public_html/gtbiblio/all.docbook.jabref.xml | sort -u |more
61#
62# EVOLUTIONS
63# ==========
64#
65# - fplod 20120217
66#
67#   * ajout des auteurs de l"équipe surf
68#
69# - fplod 20120131
70#
71#   * les non publiés sont mainteant tout simplement des @unpublished
72#     (plus de ruse avec year={xxxx, *})
73#
74# - fplod 20111010T073116Z aedon.locean-ipsl.upmc.fr (Darwin)
75#
76#   * création page thesesud
77#
78# - fplod 20110610T100740Z aedon.locean-ipsl.upmc.fr (Darwin)
79#
80#   * suppression upmc et labex
81#   * ajout création page these
82#
83# - fplod 20110511T155810Z cratos.locean-ipsl.upmc.fr (Linux)
84#
85#   * replace /tmp by /usr/work/incas/
86#
87# - fplod 20110427T110808Z cratos.locean-ipsl.upmc.fr (Linux)
88#
89#   * la production pdflaetx+bibtex ne fonctionne plus sur aedon.
90#     malgrè le changement d'installation (port vs fink) rien à faire !
91#     donc - et ça va plutôt dans le bon sens - machine de référence = cratos.
92#
93# - fplod 20110301T091253Z aedon.locean-ipsl.upmc.fr (Darwin)
94#
95#   * trying to make it run with bibtool 2.51 on zeus
96#
97# - fplod 20110228T162021Z cratos.locean-ipsl.upmc.fr (Linux)
98#
99#   * trying to make it run with bibtool 2.51 on cratos (vs 2.48 sur aedon)
100#
101# - fplod 20101109T144613Z aedon.locean-ipsl.upmc.fr (Darwin)
102#
103#   * add for upmc 2009-2010
104#     ++ suppression in revision, submitted and so on
105#     ++ correction $...$ et Monaco C. L. en Lo Monaco C.
106#     ++ je ne sais pas pourquoi rien n'apparait en ouvrant le RTF produit avec #        TextEdit alors que l'on voit qqe chose en l'ouvrant directement avec
107#        OpenOffice.
108#
109# - fplod 20101108T103903Z aedon.locean-ipsl.upmc.fr (Darwin)
110#
111#   * correction of years selection for 2007-2010
112#     because match year 2000.'select={year "20[01][0789].*"}'
113#
114#   * add for labex a selection of articles published in 2009.
115#     ++ suppression in revision, submitted and so on
116#     ++ auteurs labo (ipsl) en gras dans document word
117#     ++ correction $...$ et Monaco C. L. en Lo Monaco C.
118#
119# - fplod 20101013T090448Z aedon.locean-ipsl.upmc.fr (Darwin)
120#
121#   * add specific RTF output for 2007-2010 articles (labex2007_2010.rtf)
122#
123# - fplod 20100430T131122Z aedon.locean-ipsl.upmc.fr (Darwin)
124#
125#   * jabref 2.5 -> 2.6
126#
127# - fplod 20100127T084405Z aedon.locean-ipsl.upmc.fr (Darwin)
128#
129#   * add generation of HTML files pages by (affectation,year) using bibtool
130#
131# - fplod 20091120T140131Z aedon.locean-ipsl.upmc.fr (Darwin)
132#
133#   * fix latex pb : PDF production is now possible
134#   * detection of [delta]
135#     nb: remplacement de [delta] par \delta ok pour la production de PDF avec
136#     pdflatex mais pas ok pour la production d'HTML avec jabref
137#
138# - fplod 20091117T093404Z aedon.locean-ipsl.upmc.fr (Darwin)
139#
140#   * add test if bibtool available
141#
142# - fplod 20091023T125342Z aedon.locean-ipsl.upmc.fr (Darwin)
143#
144#   * add test if existing {\ : available feature in latex but confusing
145#     for author search using bibtool select
146#   * add test if , in author field
147#
148# - fplod 20091021T153653Z aedon.locean-ipsl.upmc.fr (Darwin)
149#
150#   * outputs HTML, PDF and RTF in dirwww
151#
152# - fplod 20091020T134644Z aedon.locean-ipsl.upmc.fr (Darwin)
153#
154#   * usage of bibtool to find years list
155#   * usage of bibtool to produce bibtex files by year
156#   * usage of bibtool to produce bibtex files by team (instead of
157#     biblio_split.sh + grep)
158#
159# - fplod 20091020T092945Z aedon.locean-ipsl.upmc.fr (Darwin)
160#
161#   * avoid diacritical and punctuation in filename (list_team_title s
162#     list_team_grep)
163#
164# - fplod 20091016T145245Z aedon.locean-ipsl.upmc.fr (Darwin)
165#
166#   * use locean_listrefs format for every team
167#
168# - fplod 2009-08-21T08:20:29Z aedon.locean-ipsl.upmc.fr (Darwin)
169#
170#   * add locean_listrefs format
171#
172# - fplod 2009-08-19T15:48:01Z aedon.locean-ipsl.upmc.fr (Darwin)
173#
174#   * add simplehtml format
175#
176# - fplod 2009-08-17T07:56:02Z aedon.locean-ipsl.upmc.fr (Darwin)
177#
178#   * add alpha style
179#
180# - fplod 2009-08-14T15:39:44Z aedon.locean-ipsl.upmc.fr (Darwin)
181#
182#   * use -p option to add customized exports format
183#   * add loop one latex biblio style
184#
185# - fplod 2009-08-10T17:08:07Z aedon.locean-ipsl.upmc.fr (Darwin)
186#
187#   * test with jabref 2.5
188#   * add docbook production
189#
190# - fplod 2009-07-07T10:17:37Z aedon.locean-ipsl.upmc.fr (Darwin)
191#
192#   * loop on html formats
193#
194# - fplod 2009-07-03T08:01:21Z aedon.locean-ipsl.upmc.fr (Darwin)
195#
196#   * add latex+bibtex processing
197#
198# TODO
199# ====
200#
201# ++ doublons
202#
203# jabref.preferences.xml : cleaning
204#
205# jabref doesn't handle multiple url
206#
207# could not encode : still some trouble with degre sign
208#
209# installation de bibtool sur zeus
210#
211set -u
212command=$(basename ${0})
213#
214jabref_version="2.6"
215#
216jabref_dir="/usr/home/incas/francoise/jabref-${jabref_version}_$(hostname)/"
217case "$(uname -s)" in
218   Darwin)
219      jabref_dir=${jabref_dir}"JabRef.app/Contents/Resources/Java/"
220   ;;
221   Linux)
222   ;;
223   *) 
224      echo "${command} : eee : unknown system $(uname -s)"
225   ;;
226esac
227#
228system=$(uname)
229case "${system}" in
230   AIX|IRIX64)
231      echo "${command} : www : no specific posix checking"
232   ;;
233   *)
234      set -o posix
235   ;;
236esac
237#
238#
239log_date=$(date -u +"%Y%m%dT%H%M%SZ")
240log=/tmp/$(basename ${command} .sh).log.${log_date}
241#
242usage=" Usage : ${command}"
243#
244# test if bibtool available
245tool=bibtool
246type ${tool} 1> /dev/null 2>&1
247status=${?}
248if [ ${status} -ne 0 ]
249then
250   echo "${command} : eee : ${tool} unavailable" >&2
251   exit 1
252fi
253unset tool
254unset status
255#
256# default
257# n.a.
258#
259hostname=$(hostname)
260case ${hostname} in
261   cratos)
262      tmpdir=/usr/work/incas/${LOGNAME}/gtbiblio
263      dirwww=/usr/work/incas/${LOGNAME}/public_html/gtbiblio/
264   ;;
265   *)
266      tmpdir=/tmp/${LOGNAME}/gtbiblio
267      dirwww=/tmp/${LOGNAME}/public_html/gtbiblio/
268   ;;   
269esac
270rm -rf ${tmpdir} 2> /dev/null
271mkdir -p ${tmpdir}
272rm -rf ${dirwww} 2> /dev/null
273mkdir -p ${dirwww}
274#
275# define team for :
276# - search in bibtex file (in loceanteam field)
277# - give a element of HTML filename (no diacritical and no punctation)
278iteam=1
279list_team_bibtool[${iteam}]="phybiocar"
280list_team_title[${iteam}]="phybiocar"
281iteam=$(( ${iteam} + 1))
282list_team_bibtool[${iteam}]="surf"
283list_team_title[${iteam}]="surf"
284iteam=$(( ${iteam} + 1))
285list_team_bibtool[${iteam}]="varclim"
286list_team_title[${iteam}]="varclim"
287iteam=$(( ${iteam} + 1))
288list_team_bibtool[${iteam}]="austral-boréal"
289list_team_title[${iteam}]="austral-boreal"
290iteam=$(( ${iteam} + 1))
291list_team_bibtool[${iteam}]="bio&pal"
292list_team_title[${iteam}]="bio_et_pal"
293iteam=$(( ${iteam} + 1))
294list_team_bibtool[${iteam}]="paléotropique"
295list_team_title[${iteam}]="paleotropique"
296iteam=$(( ${iteam} + 1))
297list_team_bibtool[${iteam}]="snapo"
298list_team_title[${iteam}]="snapo"
299iteam=$(( ${iteam} + 1))
300list_team_bibtool[${iteam}]="dycos"
301list_team_title[${iteam}]="dycos"
302iteam=$(( ${iteam} + 1))
303list_team_bibtool[${iteam}]="prodyam"
304list_team_title[${iteam}]="prodyam"
305iteam=$(( ${iteam} + 1))
306list_team_bibtool[${iteam}]="incas"
307list_team_title[${iteam}]="incas"
308iteam=$(( ${iteam} + 1))
309list_team_bibtool[${iteam}]="mmsa"
310list_team_title[${iteam}]="mmsa"
311iteam=$(( ${iteam} + 1))
312list_team_bibtool[${iteam}]="ditm"
313list_team_title[${iteam}]="ditm"
314iteam=$(( ${iteam} + 1))
315list_team_bibtool[${iteam}]="nemo"
316list_team_title[${iteam}]="nemo"
317iteam=$(( ${iteam} + 1))
318list_team_bibtool[${iteam}]="paleoproxus"
319list_team_title[${iteam}]="paleoproxus"
320iteam=$(( ${iteam} + 1))
321list_team_bibtool[${iteam}]="vartrop"
322list_team_title[${iteam}]="vartrop"
323#
324# define affectation for :
325# - search in bibtex file (in loceanaffectation field)
326# - give a element of HTML filename (no diacritical and no punctation)
327iaffectation=1
328list_affectation_bibtool[${iaffectation}]="mnhn"
329list_affectation_title[${iaffectation}]="mnhn"
330iaffectation=$(( ${iaffectation} + 1))
331list_affectation_bibtool[${iaffectation}]="cnrs"
332list_affectation_title[${iaffectation}]="cnrs"
333iaffectation=$(( ${iaffectation} + 1))
334list_affectation_bibtool[${iaffectation}]="ird"
335list_affectation_title[${iaffectation}]="ird"
336iaffectation=$(( ${iaffectation} + 1))
337list_affectation_bibtool[${iaffectation}]="upmc"
338list_affectation_title[${iaffectation}]="upmc"
339iaffectation=$(( ${iaffectation} + 1))
340#
341# define bibliography reference file
342biblioref_orig=./biblioref.bib #++ parameter
343biblioref=${tmpdir}/all.bib
344cp ${biblioref_orig} ${biblioref}
345#
346#
347# test if "[delta]"
348# if so, exit with error
349list_bad_delta=""
350list_bad_delta=$(grep -n "\[delta\]" ${biblioref})
351if [ "${list_bad_delta}" != "" ]
352then
353   echo "${command} : eee : replace [delta] by \\delta (and check formula) in ${list_bad_delta}"
354   exit 1
355fi
356#
357# test if "{\" like {\'e}
358# if so, exit with error
359list_comma_author=""
360#++grep -n "author.* =.*{.*,.*}," ${biblioref} | awk -F":" '{print $1}'
361list_comma_author=$(grep -n 'author.* =.*{.*,.*},' ${biblioref})
362if [ "${list_comma_author}" != "" ]
363then
364   echo "${command} : eee : suppress , in author field in ${list_comma_author}"
365   exit 1
366fi
367#
368# test if "{\" like {\'e}
369# if so, exit with error
370list_backslash_after=""
371#++ pb regexp list_backslash_after=$(grep -n "\{\\" ${biblioref})
372#++grep -n '{\\' ${biblioref}
373if [ "${list_backslash_after}" != "" ]
374then
375   echo "${command} : eee : suppress \"{\\\" in ${list_backslash_after}"
376   exit 1
377fi
378unset list_backslash_after
379
380# test if " }"
381# if so, exit with error
382list_blank_before=""
383list_blank_before=$(grep -n " \}" ${biblioref})
384if [ "${list_blank_before}" != "" ]
385then
386   echo "${command} : eee : suppress \" }\" in ${list_blank_before}"
387   exit 1
388fi
389unset list_blank_before
390
391# test if "{ "
392# if so, exit with error
393list_blank_after=""
394list_blank_after=$(grep -n "\{ " ${biblioref})
395if [ "${list_blank_after}" != "" ]
396then
397   echo "${command} : eee : suppress \"{ \" in ${list_blank_after}"
398   exit 1
399fi
400unset list_blank_after
401
402# test if doi in url field (because of HAL bibtex output)
403# if so, exit with error
404list_doi_in_url=""
405list_doi_in_url=$(grep -n "url = {dx" ${biblioref})
406if [ "${list_doi_in_url}" != "" ]
407then
408   echo "${command} : eee : suppress doi from url fied in ${list_doi_in_url}"
409   exit 1
410fi
411unset list_doi_in_url
412#
413# test if { or } in doi field (because of HAL bibtex output)
414# if so, exit with error
415list_bad_doi=""
416list_bad_doi=$(grep -n "doi = {.*{.*}.*}" ${biblioref})
417if [ "${list_bad_doi}" != "" ]
418then
419   echo "${command} : eee : suppress \{ or \} from doi fied in ${list_bad_doi}"
420   exit 1
421fi
422unset list_bad_doi
423
424# test if doi does'nt start with 10
425# ++ je ne sais pas rédiger cette contrainte en grep
426# if so, exit with error
427list_bad_doi=""
428list_bad_doi=$(grep "doi = {.*}" ${biblioref} | grep -v "doi = {10")
429if [ "${list_bad_doi}" != "" ]
430then
431   echo "${command} : eee : find and modify ${list_bad_doi} suppress in ${biblioref}"
432   exit 1
433fi
434unset list_bad_doi
435
436# test if { or } in pages field (because of HAL bibtex output)
437# if so, exit with error
438list_bad_pages=""
439list_bad_pages=$(grep -n "pages={.*{.*}.*}" ${biblioref})
440if [ "${list_bad_pages}" != "" ]
441then
442   echo "${command} : eee : suppress \{ or \} from pages field in ${list_bad_pages}"
443   #++exit 1
444fi
445unset list_bad_pages
446
447# test if semi-cadratin++ translation in pages field (because of HAL bibtex output)
448# if so, exit with error
449   #++echo "${command} : eee : ++ suppress ++ semi-cadratin from pages fied in ${list_bad_pages}"
450   #++exit 1
451
452# artificial header of jabref file to enforce encoding
453{
454echo "% This file was articifialy created for JabRef ${jabref_version}."
455echo "% Encoding: ISO8859_1"
456echo " "
457} > ${tmpdir}/header_jabref
458#
459#list_style="amsalpha plain alpha"
460list_style="plain" #+++
461for style in ${list_style}
462do
463   rm ${dirwww}/$(basename ${biblioref}.${style}.log .log).* 2> /dev/null
464   # generation of latex file
465   cat << EOF > ${biblioref}.${style}.tex
466\documentclass[a4paper]{article}
467%++\usepackage[frenchb]{babel}
468\usepackage[latin1]{inputenc}
469\begin{document}
470% force to include all entry of the bibliography
471\nocite{*}
472
473% bibliography
474\bibliographystyle{${style}}
475
476\bibliography{${biblioref}}
477\end{document}
478EOF
479   #
480   # processing bibliography with pdflatex (${dirwww}/${biblioref}.${style}.pdf)
481   rm ${dirwww}/$(basename ${biblioref}.${style}.log .log).* 2> /dev/null
482   pdflatex -output-directory ${dirwww} ${biblioref}.${style}.tex
483   bibtex ${dirwww}/$(basename ${biblioref}.${style})
484   #++ warnings
485   pdflatex -output-directory ${dirwww} ${biblioref}.${style}.tex
486   pdflatex -output-directory ${dirwww} ${biblioref}.${style}.tex
487   #
488   # remove temporary latex files
489   rm ${dirwww}/$(basename ${biblioref}.${style}.bbl) ${dirwww}/$(basename ${biblioref}.${style}.blg) ${dirwww}/$(basename ${biblioref}.${style}.log) ${dirwww}/$(basename ${biblioref}.${style}.aux) 2> /dev/null
490   #
491   #++rm ${biblioref}.${style}.tex 2> /dev/null
492done
493
494echo "fin 1re passe latex"
495read a
496# pour vérifier que j'ai bien tout mes styles d'exportation
497# pour mémoire
498#java -jar ${jabref_dir}/JabRef-${jabref_version}.jar -n true \
499#-p ./jabref.preferences.xml -h
500
501# processing on the whole bibliography reference file
502output_title=all
503# generation one RTF file style harvard
504rm ${biblioref}.harvard.jabref.rtf 2> /dev/null
505java -jar ${jabref_dir}/JabRef-${jabref_version}.jar -n true \
506-p ./jabref.preferences.xml \
507--output ${dirwww}/${output_title}.harvard.jabref.rtf,harvard \
508${biblioref}
509echo "fin rtf all"
510#
511# theses
512bibtool -- 'select{@phdthesis}'  ${biblioref} -o ${tmpdir}/tmp1.bib
513bibtool -- 'select={type ".*doctorat.*"}' -- 'sort.format={%d(year)%N(author)}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp2.bib
514rm ${tmpdir}/tmp1.bib
515java -jar ${jabref_dir}/JabRef-${jabref_version}.jar -n true \
516-p ./jabref.preferences.xml \
517--output ${dirwww}/these.html,locean_tablerefsabsbibsort \
518${tmpdir}/tmp2.bib
519rm ${tmpdir}/tmp2.bib
520echo "fin these"
521read a
522#
523# page thesesud
524bibtool -- 'select{@phdthesis}'  ${biblioref} -o ${tmpdir}/tmp1.bib
525bibtool -- 'select={type ".*doctorat.*"}' -- 'sort.format={%d(year)%N(author)}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp2.bib
526bibtool -- 'select={ird_thesesud "oui"}' ${tmpdir}/tmp2.bib \
527-o ${tmpdir}/tmp3.bib
528rm ${tmpdir}/tmp1.bib ${tmpdir}/tmp2.bib
529java -jar ${jabref_dir}/JabRef-${jabref_version}.jar -n true \
530-p ./jabref.preferences.xml \
531--output ${dirwww}/thesesud.html,locean_tablerefsabsbibsort \
532${tmpdir}/tmp3.bib
533#++rm ${tmpdir}/tmp3.bib
534echo "fin thesesud"
535read a
536
537# find the years list
538# . select all the references with no "," in year field
539bibtool -- 'select.non={year ","}' ${biblioref} -o ${tmpdir}/tmp.bib
540# . extract year field
541list_year=$(grep "^  year               =" ${tmpdir}/tmp.bib | sort -u | sed -e "s/^  year              = {//" -e "s/},//" -e "s/}//")
542read a
543rm ${tmpdir}/tmp.bib
544#
545# write a bibtex file for each year of the list
546for iyear in ${list_year}
547do
548   # select year
549   bibtool_command="bibtool -- 'select={year \"${iyear}\"}' ${biblioref} -o ${tmpdir}/tmp1.bib"
550   eval ${bibtool_command}
551   # remove unpublished reference
552   bibtool -- 'select.non={@unpublished}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp2.bib
553   cat ${tmpdir}/header_jabref ${tmpdir}/tmp2.bib > ${tmpdir}/tmp_${iyear}.bib
554   rm ${tmpdir}/tmp1.bib
555   rm ${tmpdir}/tmp2.bib
556done
557#++ on ne fait rien de ${tmpdir}/tmp_${iyear}.bib
558#
559# write a bibtex file for unpublished work
560bibtool -- 'select={@unpublished}' ${biblioref} -o ${tmpdir}/tmp2.bib
561cat ${tmpdir}/header_jabref ${tmpdir}/tmp2.bib > ${tmpdir}/tmp_unpublished.bib
562rm ${tmpdir}/tmp2.bib
563#++ on ne fait rien de ${tmpdir}/tmp_unpublished.bib
564#
565list_format="html simplehtml tablerefs locean_tablerefs locean_tablerefsabsbibsort locean_listrefs"
566#+++list_format="" #+++
567for format in ${list_format}
568do
569   echo "format export jabref ${format}"
570   # generation one HTML file style ${format}
571   rm ${biblioref}.${format}.jabref.html 2> /dev/null
572   java -jar ${jabref_dir}/JabRef-${jabref_version}.jar -n true \
573   -p ./jabref.preferences.xml \
574   --output ${dirwww}/${output_title}.${format}.jabref.html,${format} \
575   ${biblioref}
576   jabref_status=${?}
577   if [ ${jabref_status} -ne 0 ]
578   then
579      echo "${command} : eee : pb with jabref export ${format}"
580      exit 1
581   fi
582done
583
584# generation of DocBook
585format=docbook
586rm ${biblioref}.${format}.jabref.html 2> /dev/null
587java -jar ${jabref_dir}/JabRef-${jabref_version}.jar -n true \
588-p ./jabref.preferences.xml \
589--output ${dirwww}/${output_title}.${format}.jabref.xml,${format} \
590${biblioref}
591jabref_status=${?}
592if [ ${jabref_status} -ne 0 ]
593then
594   echo "${command} : eee : pb with jabref export ${format}"
595   exit 1
596fi
597
598# loop on teams to build bibliography reference file
599iteam=1
600nbteam=${#list_team_bibtool[@]}
601#+++nbteam=0
602while [ ${iteam} -le ${nbteam} ]
603do
604   echo "team title = ${list_team_title[iteam]}"
605   echo "team grep = ${list_team_bibtool[iteam]}"
606   biblioref_team=${tmpdir}/${list_team_title[iteam]}.bib
607   bibtool_command="bibtool -- 'select={loceanteam \"${list_team_bibtool[iteam]}\"}' ${biblioref} -o ${tmpdir}/tmp1.bib"
608   eval ${bibtool_command}
609   # test if no file found ++
610   cat ${tmpdir}/header_jabref ${tmpdir}/tmp1.bib > ${biblioref_team}
611   format=locean_listrefs
612   # generation one HTML file style ${format}
613   rm ${biblioref}.${format}.jabref.html 2> /dev/null
614   java -jar ${jabref_dir}/JabRef-${jabref_version}.jar -n true \
615      -p ./jabref.preferences.xml \
616      --output ${dirwww}/${list_team_title[iteam]}.${format}.jabref.html,${format} \
617      ${biblioref_team}
618   jabref_status=${?}
619   if [ ${jabref_status} -ne 0 ]
620   then
621      echo "${command} : eee : pb with jabref export ${format}"
622      exit 1
623   fi
624#++ else
625#++ echo "${command} : iii : no reference for team ${team}"
626#++ fi
627   iteam=$(( ${iteam} + 1 ))
628done
629
630# loop on affectations to build bibliography reference file
631format=locean_listrefs
632iaffectation=1
633nbaffectation=${#list_affectation_bibtool[@]}
634while [ ${iaffectation} -le ${nbaffectation} ]
635do
636   echo "affectation title = ${list_affectation_title[iaffectation]}"
637   echo "affectation grep = ${list_affectation_bibtool[iaffectation]}"
638   bibtool_command="bibtool -- 'select={loceanaffectation \"${list_affectation_bibtool[iaffectation]}\"}' ${biblioref} -o ${tmpdir}/tmp1.bib"
639   eval ${bibtool_command}
640   # test if no file found ++
641   # select all the references of unpublished work
642   bibtool -- 'select={@unpublished}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp2.bib
643   biblioref_affectation_unpublished=${tmpdir}/${list_affectation_title[iaffectation]}_${iyear}.bib
644   cat ${tmpdir}/header_jabref ${tmpdir}/tmp2.bib > ${biblioref_affectation_unpublished}
645   # generation one HTML file style ${format}
646   rm ${biblioref}.${format}.jabref.html 2> /dev/null
647   java -jar ${jabref_dir}/JabRef-${jabref_version}.jar -n true \
648        -p ./jabref.preferences.xml \
649        --output ${dirwww}/${list_affectation_title[iaffectation]}_unpublished.${format}.jabref.html,${format} \
650        ${biblioref_affectation_unpublished}
651   jabref_status=${?}
652   if [ ${jabref_status} -ne 0 ]
653   then
654      echo "${command} : eee : pb with jabref export ${format}"
655      exit 1
656   fi
657   # find the years list
658   # . select all the references of published work
659   bibtool -- 'select.non={@unpublished}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp2.bib
660   # . extract year field
661   list_year=$(grep "^  year            =" ${tmpdir}/tmp2.bib | sed -e "s/^  year               = {//" -e "s/},//" -e "s/}$//" | sort -u)
662   echo "list_years for ${list_affectation_title[iaffectation]} : ${list_year}"
663   read a
664   # write a bibtex file for each year of the list
665   for iyear in ${list_year}
666   do
667      # select year
668      bibtool_command="bibtool -- 'select={year \"${iyear}\"}' ${tmpdir}/tmp1.bib -o ${tmpdir}/tmp3.bib"
669      eval ${bibtool_command}
670      biblioref_affectation_year=${tmpdir}/${list_affectation_title[iaffectation]}_${iyear}.bib
671      cat ${tmpdir}/header_jabref ${tmpdir}/tmp3.bib > ${biblioref_affectation_year}
672      # generation one HTML file style ${format}
673      rm ${biblioref}.${format}.jabref.html 2> /dev/null
674      java -jar ${jabref_dir}/JabRef-${jabref_version}.jar -n true \
675         -p ./jabref.preferences.xml \
676         --output ${dirwww}/${list_affectation_title[iaffectation]}_${iyear}.${format}.jabref.html,${format} \
677         ${biblioref_affectation_year}
678      jabref_status=${?}
679      if [ ${jabref_status} -ne 0 ]
680      then
681         echo "${command} : eee : pb with jabref export ${format}"
682         exit 1
683      fi
684      #++ else
685      #++ echo "${command} : iii : no reference for affectation ${affectation}"
686      #++ fi
687   # end of loop on years
688   done
689   iaffectation=$(( ${iaffectation} + 1 ))
690done
691
692# define author for :
693# - search in bibtex file (in author field)
694# - give a element of HTML filename (no diacritical and no punctation)
695iauthor=1
696#
697list_author_bibtool[${iauthor}]="{A}lban {L}azar"
698list_author_title[${iauthor}]="Alban Lazar"
699list_author_file[${iauthor}]="Lazar_alban"
700#
701iauthor=$(( ${iauthor} + 1))
702list_author_bibtool[${iauthor}]="{M}atthieu {L}engaigne"
703list_author_title[${iauthor}]="Matthieu Lengaigne"
704list_author_file[${iauthor}]="Lengaigne_matthieu"
705#
706iauthor=$(( ${iauthor} + 1))
707list_author_bibtool[${iauthor}]="{F}rançoise {P}insard"
708list_author_title[${iauthor}]="Françoise Pinsard"
709list_author_file[${iauthor}]="Pinsard_francoise"
710# ++ python auteur="Francoise Pinsard"
711# ++ python filename=string.split(auteur)[1] + "_" + string.lower(string.split(auteur)[0])
712
713#
714iauthor=$(( ${iauthor} + 1))
715# pb avec l'apostrophe avec la ligne suivante dans bibtool
716#++list_author_bibtool[${iauthor}]="{F}rancesco {d\'{O}vidio}"
717list_author_bibtool[${iauthor}]="{O}vidio}"
718list_author_title[${iauthor}]="Francesco d'Ovidio"
719list_author_file[${iauthor}]="Dovidio_francesco"
720#
721iauthor=$(( ${iauthor} + 1))
722list_author_bibtool[${iauthor}]="{M}arina {L}évy"
723list_author_title[${iauthor}]="Marina Lévy"
724list_author_file[${iauthor}]="Levy_marina"
725#
726iauthor=$(( ${iauthor} + 1))
727list_author_bibtool[${iauthor}]="{N}icolas {M}etzl"
728list_author_title[${iauthor}]="Nicolas Metzl"
729list_author_file[${iauthor}]="Metzl_nicolas"
730#
731iauthor=$(( ${iauthor} + 1))
732list_author_bibtool[${iauthor}]="{L}aurence {E}ymard"
733list_author_title[${iauthor}]="Laurence Eymard"
734list_author_file[${iauthor}]="Eymard_laurence"
735#
736iauthor=$(( ${iauthor} + 1))
737list_author_bibtool[${iauthor}]="{J}acqueline {B}outin"
738list_author_title[${iauthor}]="Jacqueline Boutin"
739list_author_file[${iauthor}]="Boutin_jacqueline"
740#
741iauthor=$(( ${iauthor} + 1))
742list_author_bibtool[${iauthor}]="{V}incent {E}chevin"
743list_author_title[${iauthor}]="Vincent Echevin"
744list_author_file[${iauthor}]="Echevin_vincent"
745#
746iauthor=$(( ${iauthor} + 1))
747list_author_bibtool[${iauthor}]="{C}hristophe {E}. {M}enkès"
748list_author_title[${iauthor}]="Christophe Menkès"
749list_author_file[${iauthor}]="Menkes_christophe"
750#
751iauthor=$(( ${iauthor} + 1))
752list_author_bibtool[${iauthor}]="{G}urvan {M}adec"
753list_author_title[${iauthor}]="Gurvan Madec"
754list_author_file[${iauthor}]="Madec_gurvan"
755#
756iauthor=$(( ${iauthor} + 1))
757list_author_bibtool[${iauthor}]="{C}hristian {É}thé"
758list_author_title[${iauthor}]="Christian Éthé"
759list_author_file[${iauthor}]="Ethe_christian"
760#
761iauthor=$(( ${iauthor} + 1))
762list_author_bibtool[${iauthor}]="{A}lexis {C}haigneau"
763list_author_title[${iauthor}]="Alexis Chaigneau"
764list_author_file[${iauthor}]="Chaigneau_alexis"
765#
766iauthor=$(( ${iauthor} + 1))
767list_author_bibtool[${iauthor}]="{S}téphane {P}ous"
768list_author_title[${iauthor}]="Stéphane Pous"
769list_author_file[${iauthor}]="Pous_stephane"
770#
771iauthor=$(( ${iauthor} + 1))
772list_author_bibtool[${iauthor}]="{P}ascal {T}erray"
773list_author_title[${iauthor}]="Pascal Terray"
774list_author_file[${iauthor}]="Terray_pascal"
775#
776iauthor=$(( ${iauthor} + 1))
777list_author_bibtool[${iauthor}]="{F}rançois {C}olas"
778list_author_title[${iauthor}]="François Colas"
779list_author_file[${iauthor}]="Colas_francois"
780#
781iauthor=$(( ${iauthor} + 1))
782list_author_bibtool[${iauthor}]="{S}ébastien {M}asson"
783list_author_title[${iauthor}]="Sébastien Masson"
784list_author_file[${iauthor}]="Masson_sebastion"
785#
786iauthor=$(( ${iauthor} + 1))
787list_author_bibtool[${iauthor}]="{C}laire {L}évy"
788list_author_title[${iauthor}]="Claire Lévy"
789list_author_file[${iauthor}]="Levy_claire"
790#
791iauthor=$(( ${iauthor} + 1))
792list_author_bibtool[${iauthor}]="{R}achid {B}enshila"
793list_author_title[${iauthor}]="Rachid Benshila"
794list_author_file[${iauthor}]="Benshila_rachid"
795#
796iauthor=$(( ${iauthor} + 1))
797list_author_bibtool[${iauthor}]="{C}atherine {P}ierre"
798list_author_title[${iauthor}]="Catherine Pierre"
799list_author_file[${iauthor}]="Pierre_catherine"
800#
801iauthor=$(( ${iauthor} + 1))
802list_author_bibtool[${iauthor}]="{I}oanna {B}ouloubassi"
803list_author_title[${iauthor}]="Ioanna Bouloubassi"
804list_author_file[${iauthor}]="Bouloubassi_Ioanna"
805#
806iauthor=$(( ${iauthor} + 1))
807list_author_bibtool[${iauthor}]="{C}édric {C}otté"
808list_author_title[${iauthor}]="Cédric Cotté"
809list_author_file[${iauthor}]="Cotte_cedric"
810#
811iauthor=$(( ${iauthor} + 1))
812list_author_bibtool[${iauthor}]="{J}ean-{B}enoît {C}harrassin"
813list_author_title[${iauthor}]="Jean-Benoit Charrassin"
814list_author_file[${iauthor}]="Charrassin_jeanbenoit"
815#
816iauthor=$(( ${iauthor} + 1))
817list_author_bibtool[${iauthor}]="{Y}ves {D}andonneau"
818list_author_title[${iauthor}]="Yves Dandonneau"
819list_author_file[${iauthor}]="Dandonneau_yves"
820#
821iauthor=$(( ${iauthor} + 1))
822list_author_bibtool[${iauthor}]="{L}iliane {M}erlivat"
823list_author_title[${iauthor}]="Liliane Merlivat"
824list_author_file[${iauthor}]="Merlivat_liliane"
825#
826iauthor=$(( ${iauthor} + 1))
827list_author_bibtool[${iauthor}]="{P}ascale {B}ouruet-{A}ubertot"
828list_author_title[${iauthor}]="Pascale Bouruet-Aubertot"
829list_author_file[${iauthor}]="Bouruetaubertot_pascale"
830#
831iauthor=$(( ${iauthor} + 1))
832list_author_bibtool[${iauthor}]="{Y}annis {C}uypers"
833list_author_title[${iauthor}]="Yannis Cuypers"
834list_author_file[${iauthor}]="Cuypers_yannis"
835#
836iauthor=$(( ${iauthor} + 1))
837list_author_bibtool[${iauthor}]="{J}érôme {V}ialard"
838list_author_title[${iauthor}]="Jérôme Vialard"
839list_author_file[${iauthor}]="Vialard_jerome"
840#
841iauthor=$(( ${iauthor} + 1))
842list_author_bibtool[${iauthor}]="{N}athalie {L}efèvre"
843list_author_title[${iauthor}]="Nathalie Lefèvre"
844list_author_file[${iauthor}]="Lefevre_nathalie"
845#
846#
847iauthor=$(( ${iauthor} + 1))
848list_author_bibtool[${iauthor}]="{S}ylvie {T}hiria"
849list_author_title[${iauthor}]="Sylvie Thiria"
850list_author_file[${iauthor}]="Thiria_sylvie"
851#
852iauthor=$(( ${iauthor} + 1))
853list_author_bibtool[${iauthor}]="{J}ulien {B}rajard"
854list_author_title[${iauthor}]="Julien Brajard"
855list_author_file[${iauthor}]="Brajard_julien"
856#
857iauthor=$(( ${iauthor} + 1))
858list_author_bibtool[${iauthor}]="{C}arlos {M}ejia"
859list_author_title[${iauthor}]="Carlos Mejia"
860list_author_file[${iauthor}]="Mejia_carlos"
861#
862iauthor=$(( ${iauthor} + 1))
863list_author_bibtool[${iauthor}]="{F}ouad {B}adran"
864list_author_title[${iauthor}]="Fouad Badran"
865list_author_file[${iauthor}]="Badran_fouad"
866#
867iauthor=$(( ${iauthor} + 1))
868list_author_bibtool[${iauthor}]="{Y}oung-{H}yang {P}ark"
869list_author_title[${iauthor}]="Young-Hyang {P}ark"
870list_author_file[${iauthor}]="Park_younghyang"
871#
872iauthor=$(( ${iauthor} + 1))
873list_author_bibtool[${iauthor}]="{J}uliette {M}ignot"
874list_author_title[${iauthor}]="Juliette Mignot"
875list_author_file[${iauthor}]="Mignot_juliette"
876#
877iauthor=$(( ${iauthor} + 1))
878list_author_bibtool[${iauthor}]="{M}yriam {K}hodri"
879list_author_title[${iauthor}]="Myriam Khodri"
880list_author_file[${iauthor}]="Khodri_myriam"
881#
882iauthor=$(( ${iauthor} + 1))
883list_author_bibtool[${iauthor}]="{H}ervé {{L}e {G}off}}"
884list_author_title[${iauthor}]="Hervé Le Goff"
885list_author_file[${iauthor}]="Legoff_herve"
886#
887iauthor=$(( ${iauthor} + 1))
888list_author_bibtool[${iauthor}]="{C}éline {R}idame"
889list_author_title[${iauthor}]="Céline Ridame"
890list_author_file[${iauthor}]="Ridame_celine"
891#
892iauthor=$(( ${iauthor} + 1))
893list_author_bibtool[${iauthor}]="{G}uillaume {M}assé"
894list_author_title[${iauthor}]="Guillaume Massé"
895list_author_file[${iauthor}]="Masse_guillaume"
896#
897iauthor=$(( ${iauthor} + 1))
898list_author_bibtool[${iauthor}]="{A}line {T}ribollet"
899list_author_title[${iauthor}]="Aline Tribollet"
900list_author_file[${iauthor}]="Tribollet_aline"
901#
902iauthor=$(( ${iauthor} + 1))
903list_author_bibtool[${iauthor}]="{A}lain {S}aliot"
904list_author_title[${iauthor}]="Alain Saliot"
905list_author_file[${iauthor}]="Saliot_alain"
906#
907iauthor=$(( ${iauthor} + 1))
908list_author_bibtool[${iauthor}]="{G}iovanni {A}loisi"
909list_author_title[${iauthor}]="Giovanni Aloisi"
910list_author_file[${iauthor}]="Aloisi_giovanni"
911#
912iauthor=$(( ${iauthor} + 1))
913list_author_bibtool[${iauthor}]="{Ch}ristian {B}runet"
914list_author_title[${iauthor}]="Christian Brunet"
915list_author_file[${iauthor}]="Brunet_christian"
916#
917iauthor=$(( ${iauthor} + 1))
918list_author_bibtool[${iauthor}]="{S}abine {A}rnault"
919list_author_title[${iauthor}]="Sabine Arnault"
920list_author_file[${iauthor}]="Arnault_sabine"
921#
922iauthor=$(( ${iauthor} + 1))
923list_author_bibtool[${iauthor}]="{J}ean-{L}uc {M}élice"
924list_author_title[${iauthor}]="Jean-Luc Mélice"
925list_author_file[${iauthor}]="Melice_jeanluc"
926#
927iauthor=$(( ${iauthor} + 1))
928list_author_bibtool[${iauthor}]="{Ch}ristophe {H}erbaut"
929list_author_title[${iauthor}]="Christophe Herbaut"
930list_author_file[${iauthor}]="Herbaut_christophe"
931#
932iauthor=$(( ${iauthor} + 1))
933list_author_bibtool[${iauthor}]="{M}arie-{N}oëlle {H}oussais"
934list_author_title[${iauthor}]="Marie-Noëlle Houssais"
935list_author_file[${iauthor}]="Houssais_marienoelle"
936#
937iauthor=$(( ${iauthor} + 1))
938list_author_bibtool[${iauthor}]="{E}mmanuelle {S}ultan"
939list_author_title[${iauthor}]="Emmanuelle Sultan"
940list_author_file[${iauthor}]="Sultan_emmanuelle"
941#
942iauthor=$(( ${iauthor} + 1))
943list_author_bibtool[${iauthor}]="{B}enjamin {S}ultan"
944list_author_title[${iauthor}]="Benjamin Sultan"
945list_author_file[${iauthor}]="Sultan_benjamin"
946#
947iauthor=$(( ${iauthor} + 1))
948list_author_bibtool[${iauthor}]="{Y}annis {C}uypers"
949list_author_title[${iauthor}]="Yannis Cuypers"
950list_author_file[${iauthor}]="Cuypers_yannis"
951#
952iauthor=$(( ${iauthor} + 1))
953list_author_bibtool[${iauthor}]="{L}aurent {M}ortier"
954list_author_title[${iauthor}]="Laurent Mortier"
955list_author_file[${iauthor}]="Mortier_laurent"
956#
957iauthor=$(( ${iauthor} + 1))
958list_author_bibtool[${iauthor}]="{P}ascale {B}ouruet-{A}ubertot"
959list_author_title[${iauthor}]="Pascale Bouruet-Aubertot"
960list_author_file[${iauthor}]="Bouruet-Aubertot_pascale"
961#
962iauthor=$(( ${iauthor} + 1))
963list_author_bibtool[${iauthor}]="{M}ichel {C}répon"
964list_author_title[${iauthor}]="Michel Crépon"
965list_author_file[${iauthor}]="Crepon_michel"
966#
967iauthor=$(( ${iauthor} + 1))
968list_author_bibtool[${iauthor}]="{N}icolas {M}artin"
969list_author_title[${iauthor}]="Nicolas Martin"
970list_author_file[${iauthor}]="Martin_nicolas"
971#
972iauthor=$(( ${iauthor} + 1))
973list_author_bibtool[${iauthor}]="{A}drien {M}artin"
974list_author_title[${iauthor}]="Adrien Martin"
975list_author_file[${iauthor}]="Martin_adrien"
976#
977iauthor=$(( ${iauthor} + 1))
978list_author_bibtool[${iauthor}]="{F}rédéric {V}ivier"
979list_author_title[${iauthor}]="Fréderic Vivier"
980list_author_file[${iauthor}]="Vivier_frederic"
981#
982iauthor=$(( ${iauthor} + 1))
983list_author_bibtool[${iauthor}]="{S}imon {M}orisset"
984list_author_title[${iauthor}]="Simon Morisset"
985list_author_file[${iauthor}]="Morisset_simon"
986#
987iauthor=$(( ${iauthor} + 1))
988list_author_bibtool[${iauthor}]="{A}ntonio {L}ourenço"
989list_author_title[${iauthor}]="Antonio Lourenço"
990list_author_file[${iauthor}]="Lourenco_antonio"
991#
992iauthor=$(( ${iauthor} + 1))
993list_author_bibtool[${iauthor}]="{G}illes {R}everdin"
994list_author_title[${iauthor}]="Gilles Reverdin"
995list_author_file[${iauthor}]="Reverdin_gilles"
996#
997iauthor=$(( ${iauthor} + 1))
998list_author_bibtool[${iauthor}]="{X}avier {C}apet"
999list_author_title[${iauthor}]="Xavier Capet"
1000list_author_file[${iauthor}]="Capet_xavier"
1001#
1002iauthor=$(( ${iauthor} + 1))
1003list_author_bibtool[${iauthor}]="{P}ierre {T}estor"
1004list_author_title[${iauthor}]="Pierre Testor"
1005list_author_file[${iauthor}]="Testor_pierre"
1006#
1007# loop on authors to build bibliography reference file
1008iauthor=1
1009nbauthor=${#list_author_bibtool[@]}
1010#++nbauthor=0 #+++
1011while [ ${iauthor} -le ${nbauthor} ]
1012do
1013   rm ${tmpdir}/tmp1.bib 2> /dev/null
1014   echo "author title = ${list_author_title[iauthor]}"
1015   echo "author grep = ${list_author_bibtool[iauthor]}"
1016   biblioref_author=${tmpdir}/${list_author_file[iauthor]}.bib
1017   bibtool_command="bibtool -- 'select={author \"${list_author_bibtool[iauthor]}\"}' ${biblioref} -o ${tmpdir}/tmp1.bib"
1018   eval ${bibtool_command}
1019   # test if no file found ++
1020   cat ${tmpdir}/header_jabref ${tmpdir}/tmp1.bib > ${biblioref_author}
1021   format=locean_listrefs
1022   # generation one HTML file style ${format}
1023   rm ${biblioref}.${format}.jabref.html 2> /dev/null
1024   java -jar ${jabref_dir}/JabRef-${jabref_version}.jar -n true \
1025      -p ./jabref.preferences.xml \
1026      --output ${dirwww}/${list_author_file[iauthor]}.${format}.jabref.html,${format} \
1027      ${biblioref_author}
1028   jabref_status=${?}
1029   if [ ${jabref_status} -ne 0 ]
1030   then
1031      echo "${command} : eee : pb with jabref export ${format}"
1032      exit 1
1033   fi
1034#++ else
1035#++ echo "${command} : iii : no reference for author ${team}"
1036#++ fi
1037   iauthor=$(( ${iauthor} + 1 ))
1038done
1039echo "fin auteurs"
1040read a
1041
1042#++ process html transformation of DocBook file ++
1043
1044# is there any reference to be add to HAL
1045biblioref_hal=$(grep -c "url = {http://hal.archives-ouvertes.fr/hal" ${biblioref} | grep ":0" | awk -F: '{print $1}')
1046if [ "${biblioref_hal}" != " " ]
1047then
1048   #++ more than 30 entries
1049   cat ${tmpdir}/header_jabref ${biblioref_hal} > ${biblioref}_hal.bib
1050   #
1051   # generation one XML file style prehal
1052
1053   rm ${biblioref}.1.jabref.xml 2> /dev/null
1054   java -jar ${jabref_dir}/JabRef-${jabref_version}.jar -n true \
1055      -p ./jabref.preferences.xml \
1056      --output ${tmpdir}/${output_title}.1.jabref.xml,prehal \
1057      ${biblioref}_hal.bib
1058fi
1059
1060#++rm ${biblioref} 2> /dev/null
1061#++rm ${biblioref}_hal 2> /dev/null
1062#++rm ${tmpdir}/header_jabref 2> /dev/null
1063
1064exit 0
Note: See TracBrowser for help on using the repository browser.