source: trunk/bibopa.sh @ 56

Last change on this file since 56 was 56, checked in by pinsard, 16 years ago

migration to docbook5 for biblio.xml; bug fix in bibopa.sh; xmlto is not anymore needed; xml(starlet) must be available

  • Property svn:keywords set to Id
File size: 19.1 KB
Line 
1#!/bin/bash
2#
3#    Behera, S. K., J. Luo, S. Masson, S. Rao, S. Gualdi, P. Delecluse, A.
4#    Navarra and T. Yamagata, 2004 : Paramount Impact of the Indian Ocean
5#    Dipole on the East African Short Rains: A CGCM Study, J. Climate, In
6#    press.
7#
8#    donnerait
9#
10#    <biblioentry xml:id="behara2004">
11#    <authorgroup>
12#    <author><surname>Behera</surname> <firstname>S. K.</firstname> </author>
13#    <author><firstname>J.</firstname> <surname>Luo</surname></author>
14#    <author><firstname>S.</firstname> <surname>Masson</surname></author>
15#    <author><firstname>S.</firstname> <surname>Rao</surname></author>
16#    <author><firstname>S.</firstname> <surname>Gualdi</surname></author>
17#    <author><firstname>P.</firstname> <surname>Delecluse</surname></author>
18#    <author><firstname>A.</firstname> <surname>Navara</surname></author>
19#    <author><firstname>T.</firstname> <surname>Yamagata</surname></author>
20#    </authorgroup>
21#    <date>2004</date>
22#    <title>Paramount Impact of the Indian Ocean Dipole on the East African
23#    Short Rains: A CGCM Study</title>
24#    <publishername>J. Climate</publishername>
25#    <biblioid class="doi">doi</biblioid>
26#    <bibliomisc role="pseudoref">In press.</bibliomisc>
27#    <bibliomisc role="internalref">from
28#    http://www.lodyc.jussieu.fr/~opatlod/NEMO_v1/6_Menu/2_page/index.html
29#    2007-03-29T16:24:31Z fplod by hand</bibliomisc>
30#    </biblioentry>
31#
32#   @book{MetReiCoh2004 ,
33#      author    = {Michael Metcalf and
34#              John Reid and Malcolm Cohen},
35#      title     = {Fortran 95/2003 explained},
36#      year      = {2004},
37#      publisher = {Oxford University Press},
38#      edition   = {Third},
39#      ISBN      = {0-19-852693-8},
40#      pages = {434}
41#   }
42# donnerait
43#    <biblioentry xml:id="MetReiCoh2004">
44#    <authorgroup>
45#    <author><firstname>Michael</firstname> <surname>Metcalf</surname></author>
46#    <author><firstname>John</firstname> <surname>Reid</surname></author>
47#    <author><firstname>Malcolm</firstname> <surname>Cohen</surname></author>
48#    </authorgroup>
49#    <date>2004}</date>
50#    <title>Fortran 95/2003 explained</title>
51#    <publisher><publishername>Oxford University Press</publishername></publisher>
52#    <biblioid class="isbn">0-19-852693-8</biblioid>
53#    <pagenums>434</pagenums>
54#    <edition>Third</edition>
55#
56# example :
57# $ ./bibopa.sh -p birefnemo -i data/biball.txt -t raw
58# $ ./bibopa.sh -p bibrefnemo -i data/mail2007-05-10T09:01:56Z -t mailbody
59# $ ./bibopa.sh -p polyfortran -i data/petitpolyfp.bib -t bibtex -l fr
60# $ ./bibopa.sh -p demo1 -i data/bibdemo1.txt -t raw -l fr
61#
62# see also mailtouser.sh
63#
64# original location :
65# /usr/home/fplod/incas/bibnemo/src/bibnemomaf/bibopa.sh sur cerbere.locean-ipsl.upmc.fr
66#
67# update
68# ++ gestion des comments
69# ++ gestion des id existants (cf à la fin)
70# ++ option debug
71# $Id$
72# fplod 2008-04-30T07:11:58Z aedon.locean-ipsl.upmc.fr (Darwin)
73# chgt for dbk5 out
74# xmlto 0.0.18 does'nt like this docbook release. remove
75# usage of xml (xmlstarlet) for validation
76# bug fix
77# add journal names from demo1
78# fplod 2008-03-12T16:11:07Z aedon.locean-ipsl.upmc.fr (Darwin)
79# add -p option (to overide bibrefnemo in file name and id)
80# add -l option by default en
81# fplod 2008-03-11T11:25:27Z aedon.locean-ipsl.upmc.fr (Darwin)
82# add bibtex entry (not finished)++
83# fplod 2007-06-20T17:18:02Z aedon.locean-ipsl.upmc.fr (Darwin)
84# <bibliomisc role="id"> replace by <biblioid class="doi">
85# smasson 2007-06-07T16:43:42Z arete.locean-ipsl.upmc.fr (Darwin)
86# Add journals
87# fplod 2007-05-10T09:17:09Z aedon.locean-ipsl.upmc.fr (Darwin)
88# dernières touches
89# fplod 2007-04-25T10:59:49Z cerbere.locean-ipsl.upmc.fr (Linux)
90# add a filein parameter and an option for mailbody
91# comments  (line begininig with #) are now possible
92# Sebastien Masson avril 2007 creation
93#
94
95rmbl () {
96    echo "${1}" | sed -e "s/^ *//" | sed -e "s/ *$//"
97}
98cleanname () {
99    echo "${1}" | sed -e "s/^ *//" \
100        -e "s/^ *,//" \
101        -e "s/^ *;//" \
102        -e "s/^ *\.//" \
103        -e "s/ *$//" \
104        -e "s/, *$//" \
105        -e "s/; *$//" \
106        -e "s/\. *$//"
107}
108#
109set -o posix
110command=$(basename ${0})
111log_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
112log=/tmp/${command}.${log_date}
113#
114# test if xsltproc is available
115type xsltproc 1> /dev/null 2>&1
116status=${?}
117if [ ${status} -ne 0 ]
118then
119 echo " eee : xsltproc not found"
120 exit 1
121fi
122#
123# test if xml  is available
124type xml 1> /dev/null 2>&1
125status=${?}
126if [ ${status} -ne 0 ]
127then
128 echo " eee : xml not found"
129 exit 1
130fi
131#
132usage=" Usage : ${command} -i filein -t type -p project -l lang"
133#
134# default
135lang=en
136#
137minargcount=6
138#echo " narg ${#}"
139if [ ${#} -lt ${minargcount} ]
140then
141   echo "eee : not enought arguments"
142   echo "${usage}"
143   exit 1
144fi
145#
146while [ ! -z "${1}" ]
147do
148 case ${1} in
149 -i) # filein
150  filein=${2}
151  shift
152 ;;
153 -t) # type
154  type=${2}
155  shift
156 ;;
157 -p)
158  project=${2}
159  shift
160 ;;
161 -l)
162  lang=${2}
163  shift
164 ;;
165 -h)
166  echo "${usage}"
167  exit 0
168 ;;
169 *) # other choice
170  echo "${usage}"
171  exit 1
172 ;;
173 esac
174 shift # next flag
175done
176#
177set -u
178#
179# check for filein
180if [ ! -f ${filein} ]
181then
182   echo "eee : ${filein} not found"
183   exit 1
184fi
185#
186case ${type} in
187raw) # file like data/biball.txt
188 fileraw=${filein}
189;;
190mailbody) # file like data/mail2007-04-25T08:58:16Z.txt
191 fileraw=/tmp/$(basename ${filein}).raw
192 echo "# from ${filein}" > ${fileraw}
193 echo "# ${log_date}" >> ${fileraw}
194 echo "# corrections" >> ${fileraw}
195 grep "correction_.*=" ${filein} | grep -v "correction_.*=$" | \
196 sed -e "s/correction_.*=//">> ${fileraw}
197 echo "# new references" >> ${fileraw}
198 awk "/newreferences=/,/comments=/" ${filein} | sed -e "s/newreferences=//" -e "/comments=/d" >> ${fileraw}
199 #more ${fileraw} # ++ if debug
200 #read a #++ if debug
201;;
202bibtex) # file like data/petitpoly.bib
203 fileraw=/tmp/$(basename ${filein}).raw
204 awk -f join_endcomma.awk ${filein} >> ${fileraw}
205 #more ${fileraw} # ++ if debug
206 #read a #++ if debug
207;;
208*)
209   echo "eee : type should be raw, mailbody or bibtex"
210   exit 1
211;;
212esac
213#
214# check for output
215fileou=$( basename ${filein} .txt).xml
216if [ -f ${fileou} ]
217then
218   echo "eee : ${fileou} already exist"
219   exit 1
220fi
221#
222jlist[1]="J. Climate"
223jlist[2]="Journal of Climate"
224jlist[3]="Ocean Modelling"
225jlist[4]="Geophys. Res. Lett."
226jlist[5]="J. Geophys. Res."
227jlist[6]="Tellus A"
228jlist[7]="Tellus B"
229jlist[8]="J. Phys. Oceanogr."
230jlist[9]="Clim. Dyn."
231jlist[10]="Climate Dynamics"
232jlist[11]="Dyn. Atmos. Oceans"
233jlist[12]="Mon. Wea. Rev."
234jlist[13]="Global Biogeochem. Cycles"
235jlist[14]="Nonlinear Processes in Geophysics"
236jlist[15]="Ocean Science"
237jlist[16]="J. Mar. Systems"
238jlist[17]="J. Atmos. Sc."
239jlist[18]="Proc. Royal Soc."
240jlist[19]="Bull. Amer. Meteorol. Soc."
241jlist[20]="Ocean Dyn."
242jlist[21]="Geophysical Monograph Series"
243jlist[22]="Paleoceanography"
244jlist[23]="Annales Geophysicae"
245jlist[24]="Annals of Geophys."
246jlist[25]="Deep Sea Research Part II: Topical Studies in Oceanography"
247jlist[26]="Deep Sea Res. II"
248jlist[27]="Atmospheric Chemistry and Physics"
249jlist[28]="Atmospheric Chemistry and Physics Discussions"
250jlist[29]="Earth Plan. Sc. Lett."
251jlist[30]="J. Mar. Res."
252jlist[31]="PCMDI Report Series"
253jlist[32]="J. Mar. Syst."
254jlist[33]="Note du Pole de Modelisation"
255jlist[34]="Calculateurs Paralleles"
256jlist[35]="Note Scientifique du Pole de Modelisation"
257jlist[36]="Lecture Notes in Computer Science"
258jlist[37]="Prog. Oceanogr."
259jlist[38]="Deep Sea Research Part I: Oceanographic Research Papers"
260jlist[39]="Deep Sea Res. I"
261jlist[40]="IEEE Trans. Geosci. Remote Sensing"
262jlist[41]="ECMWF Tech. Memorandum"
263jlist[42]="J. Environ. Radioactivity"
264jlist[43]="Int. WOCE Newsletter"
265jlist[44]="C. R. Acad. Sci. Paris"
266jlist[45]="C. R. Acad. Sci. Paris, Earth and Planetary Sciences"
267jlist[46]="In The mathematics of models for climatology and environment"
268jlist[47]="Oceanol. Acta"
269jlist[48]="The global atmosphere and ocean system"
270jlist[49]="NATO Advanced Study Institute"
271jlist[50]="WCRP"
272jlist[51]="The Courier"
273jlist[52]="Elsevier Oceanographic Series"
274jlist[53]="In Conference Proceedings of the 1988 International Conference on Supercomputing"
275jlist[54]="In Science and engineering on Cray Supercomputers"
276jlist[55]="In Modeling the Earth's Climate and its Variability"
277jlist[56]="Fish. Oceanogr."
278jlist[57]="Q. J. R. Meteor. Soc."
279jlist[58]="In High performance computing in the geosciences"
280jlist[59]="Int. J. Numer. Meth. in Fluids"
281jlist[60]="Lecture notes in Physics"
282jlist[61]="J. Meterol. Soc. Japan"
283jlist[62]="Journal of Marine Systems"
284jlist[63]="Canadian Journal of Fisheries and Aquatic Sciences"
285jlist[64]="J. Atmos. Ocean. Tech."
286jlist[65]="EOS"
287jlist[66]="Nature"
288jlist[67]="Physics and Chemistry of the Earth, Part B: Hydrology, Oceans and Atmosphere"
289jlist[68]="Journal of Atmospheric and Oceanic Technology"
290jlist[69]="Lecture Notes in Computational Science Engineering"
291jlist[70]="In Greenhouse Gas Control Technologies"
292jlist[71]="Chemical Geology"
293jlist[72]="Marine Geology"
294jlist[73]="Developments in Paleoenvironmental Research"
295jlist[74]="Science"
296jlist[75]="In Mediterranean Climate Variability"
297jlist[76]="Global and Planetary Change"
298jlist[77]="Physical Review Letters"
299#
300# following Journal name are fake ones for demo1 : references extracted from
301# Cantratrix Sopronica L. written by Georges Perec
302#find in http://www-rocq.inria.fr/who/Marc.Thiriet/PsFil/Biblio/cantatrix.ps
303ij=77
304ij=$(( ${ij} + 1))
305jlist[$ij]="Res. Proc. neurophysiol. Fanatic Soc"
306ij=$(( ${ij} + 1))
307jlist[$ij]="New Records Ass. J."
308ij=$(( ${ij} + 1))
309jlist[$ij]="Am. J. Allegrol."
310ij=$(( ${ij} + 1))
311jlist[$ij]="J. Neurochem. Neurocytol. Enzymol."
312ij=$(( ${ij} + 1))
313jlist[$ij]="Hammersmith J."
314ij=$(( ${ij} + 1))
315jlist[$ij]="Nasa Rept."
316ij=$(( ${ij} + 1))
317jlist[$ij]="C.r. Assoc. Conc. Lam."
318ij=$(( ${ij} + 1))
319jlist[$ij]="Gaz. med. franco-rus."
320ij=$(( ${ij} + 1))
321jlist[$ij]="Amer. J. music. Deciency"
322#jlist[]=""
323#
324#
325    cat <<EOF > ${fileou}
326<?xml version='1.0' encoding='ISO-8859-1'?>
327<bibliography
328version="5.0"
329xmlns="http://docbook.org/ns/docbook"
330xml:id="bib${project}ref"
331xml:lang="${lang}">
332
333<info>
334<date>$( date -u +"%Y-%m-%dT%H:%M:%SZ" )</date>
335</info>
336EOF
337#
338# strip comments
339fileraw_strict=/tmp/$(basename ${fileraw})_strict
340grep -v "^#" ${fileraw} > ${fileraw_strict}
341totlines=$( wc -l ${fileraw_strict} | awk '{print $1}' )
342l=1
343while [ ${l} -le ${totlines}  ]
344do
345# extract one line
346  line=$( sed -n ${l}p ${fileraw_strict} )
347  orgline=$( echo ${line} | sed -e "s/--/- -/g" )
348  line=$( echo ${line} | sed -e "s/</\&lt;/g" -e "s/>/\&gt;/g" )
349  # detect if bibtex or not bibtex (starting with @)
350  if [ ${line:0:1} != "@" ]
351  then
352     # parsing non bibtex line
353     bibtex=0
354     # before the first :
355       tmp=${line%%:*}
356     # before the last ,
357       auths=${tmp%,*},
358     # replace "and" by ","
359       auths=$( echo "${auths}" | sed -e "s/ and /,/g" )
360     # after the last ,
361       year=${tmp##*,}
362       year=$( rmbl "${year}" )
363     ## first author before the first .,
364       first=${auths%%.,*}.
365     # its firstname after the last ,
366       firstfn=${first##*,}
367       firstfn=$( rmbl "${firstfn}" )
368     # its surname ; before the first ,
369       firstsn=${first%%,*}
370       firstsn=$( rmbl "${firstsn}" )
371     ## ref id
372       refid=$( echo ${firstsn} | tr "[:upper:]" "[:lower:]" | tr -s " " "_"  | tr -s "'" "_" | recode -d -f ISO-8859-1..flat )${year}
373       num=$( grep -c "<biblioentry xml:id=\"${refid}_[0-9][0-9]\">" ${fileou} )
374       num=$(( ${num} + 1 ))
375       [ ${num} -le 9 ] && num=0${num}
376       refid=${refid}_${num}
377       hasauthor=1
378   else
379      # parsing bibtex line
380      bibtex=1
381      # before the first ,
382      tmp=${line%%,*}
383      endline=${line#*,}
384      # refid is after { and before the first comma
385      refid=${tmp#*{}
386      # ++ test if refid already exist
387      # check if author field is there
388      echo ${endline} | grep -q "author"
389      hasauthor=${?}
390      if [ ${hasauthor} -eq 0 ]
391      then
392         auths=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(author * = *{\)\(.*\)\(}\)/\2/")
393         #echo "auths $auths" # genre  Michael Metcalf and John Reid and Malcolm Cohen
394      else
395        echo "pas d'auteurs" # ++
396      fi
397      endline=${endline#*,}
398      title=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(title * = *{\)\(.*\)\(}\)/\2/")
399      endline=${endline#*,}
400#echo ${endline} | awk -F "," '{print $1}' #++debug
401      year=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(year * = *{\)\(.*\)\(}\)/\2/")
402      endline=${endline#*,}
403      publisher=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(publisher * = *{\)\(.*\)\(}\)/\2/")
404      endline=${endline#*,}
405      edition=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(edition * = *{\)\(.*\)\(}\)/\2/")
406      endline=${endline#*,}
407      isbn=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(isbn * = *{\)\(.*\)\(}\)/\2/")
408      endline=${endline#*,}
409      pag=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(page * = *{\)\(.*\)\(}\)/\2/")
410
411      if [ ${hasauthor} -eq 1 ]
412      then
413         ## first author before the first and
414         first=${auths%%and*}
415         # its surname after the last " "  ++ pas vrai double nom et pb blanc dans la syntaxe
416         # firstsn=${first##* } . ok en interactif . pas ok en script
417         firstsn=$( echo ${first}  | awk '{print $2}')
418         #echo "firstsn $firstsn"
419         # its firstname before the first " "
420         firstfn=${first%% *}
421      fi
422   fi
423
424          cat <<EOF >> ${fileou}
425<biblioentry xml:id="${refid}">
426  <!-- date
427  $( date -u +"%Y-%m-%dT%H:%M:%SZ" )
428  -->
429  <!-- original text
430  ${orgline}
431  -->
432EOF
433      if [ ${hasauthor} -eq 1 ]
434      then
435          cat <<EOF >> ${fileou}
436  <authorgroup>
437    <author> <personname> <surname>${firstsn}</surname> <firstname>${firstfn}</firstname> </personname> </author>
438EOF
439
440## other authors..
441  if [ ${bibtex} -eq 0 ]
442  then
443   previous=${first},
444   # next authors...
445   next=${auths##*${previous}}
446  fi
447  if [ ${bibtex} -eq 1 ]
448  then
449   previous=${first}"and "
450   # next authors...
451   #echo "auths ${auths}"
452   next=${auths##*${previous}}
453   if [ "${next}and " = "${previous}" ]
454   then
455     next=""
456   fi
457  fi
458  #echo "previous ${previous}"
459  #echo "next ${next}"
460# while the next author is not empty
461  while [  "${next}" != "" ]
462    do
463      if [ ${bibtex} -eq 0 ]
464      then
465         # get the first next author; before the first ,
466         next=${next%%,*}
467         # its surname ; after the last .
468         nextsn=${next##*.}
469         nextsn=$( rmbl "${nextsn}" )
470         # its firstname ; before the last .
471         nextfn=${next%.*}.
472         nextfn=$( rmbl "${nextfn}" )
473       fi
474      if [ ${bibtex} -eq 1 ]
475      then
476         # get the first next author; before the first "and"
477         next=${next%%and *}
478         # its surname after the last " "  ++ pas vrai double nom et pb blanc dans la syntaxe
479         # nextsn=${next##* } . ok en interactif . pas ok en script
480         nextsn=$( echo ${next}  | awk '{print $2}')
481         #echo "nextsn $nextsn"
482         # its nextname before the first " "
483         nextfn=${next%% *}
484      fi
485#
486    echo "    <author> <personname> <surname>${nextsn}</surname> <firstname>${nextfn}</firstname> </personname> </author>" >> ${fileou}
487    #echo "    <author> <personname> <surname>${nextsn}</surname> <firstname>${nextfn}</firstname> </personname> </author>"  #++debug
488    if [ ${bibtex} -eq 0 ]
489    then
490      previous=${next},
491      next=${auths##*${previous}}
492    fi
493    if [ ${bibtex} -eq 1 ]
494    then
495      previous=${next}"and "
496      next=${auths##*${previous}}
497    fi
498  done
499  echo "  </authorgroup>"  >> ${fileou}
500  fi
501
502# end of the line ; after the first :
503  endline=${line#*:}
504
505## find the journal
506  j=1
507  jfound=""
508  jlistsize=${#jlist[@]}
509  while [[ ${j} -le ${jlistsize} && "${jfound}" == "" ]]
510    do
511    ok=$( echo ${endline} | grep -ci "${jlist[j]} *," )
512    [ $ok -eq 1 ] && jfound="${jlist[j]}"
513    j=$(( ${j} + 1 ))
514  done
515  if [ "${jfound}" == "" ]
516      then
517      echo "eee: Journal not found "
518      echo "${endline}"
519      #++exit 1
520#+++ following lines are not yet validate
521      # it might be a book, a manual, a conference, etc. ++
522      echo "  <title>${title}</title>" >> ${fileou}
523      echo "  <biblioid class=\"isbn\">${isbn}</biblioid>" >> ${fileou}
524          cat <<EOF >> ${fileou}
525  <biblioset relation="nojournal">
526    <title>${title}</title>
527    <pagenums>${pag}</pagenums>
528    <pubdate>${year}</pubdate>
529  </biblioset>
530EOF
531          cat <<EOF >> ${fileou}
532</biblioentry>
533
534EOF
535  fi # end of if jfound empty (ie not an article)
536  if [ "${jfound}" != "" ]
537  then
538## title
539# before the first :
540  title=${endline%%${jfound}*}
541  title=$( cleanname "${title}" )
542  echo "  <title>${title}</title>" >> ${fileou}
543## end
544## end of the line ; after the first ${jfound}
545  endline=${endline#*${jfound}}
546  endline=$( cleanname "${endline}" )
547## doi
548  endline=$( echo ${endline} | sed -e "s/[dD][oO][iI] *\t* *: *\t* */doi:/" )
549  ok=$( echo ${endline} | grep -ic "doi:" )
550  if [ ${ok} -eq 1 ]
551      then
552      doi=${endline##*doi:}
553      echo "  <biblioid class=\"doi\">${doi}</biblioid>" >> ${fileou}
554      endline=${endline%doi:*}
555      endline=$( cleanname "${endline}" )
556  else
557      echo "non doi: ${line}"
558  fi
559  num=$( echo ${endline} |  tr -dc "," | wc -c )
560  case ${num} in
561      1)
562### echo ${num}: ${endline}
563          vol=${endline%,*}
564          vol=$( cleanname "${vol}" )
565          pag=${endline##*,}
566          pag=$( cleanname "${pag}" )
567          cat <<EOF >> ${fileou}
568  <biblioset relation="journal">
569    <title>${jfound}</title>
570    <volumenum>${vol}</volumenum><pagenums>${pag}</pagenums>
571    <pubdate>${year}</pubdate>
572  </biblioset>
573EOF
574      ;;
575      2)
576          vol=${endline%,*}
577          vol=$( cleanname "${vol}" )
578          iss=${vol##*,}
579          iss=$( cleanname "${iss}" )
580          vol=${vol%,*}
581          vol=$( cleanname "${vol}" )
582          pag=${endline##*,}
583          pag=$( cleanname "${pag}" )
584          cat <<EOF >> ${fileou}
585  <biblioset role="journal">
586    <title>${jfound}</title>
587    <volumenum>${vol}</volumenum><issuenum>${iss}</issuenum><pagenums>${pag}</pagenums>
588    <pubdate>${year}</pubdate>
589  </biblioset>
590EOF
591      ;;
592      *)
593#echo ${num}: ${endline} # ++debug
594          cat <<EOF >> ${fileou}
595  <biblioset role="journal">
596    <title>${jfound}</title>
597    <pubdate>${year}</pubdate>
598    <bibliomisc>${endline}</bibliomisc>
599  </biblioset>
600EOF
601      ;;
602  esac
603
604          cat <<EOF >> ${fileou}
605</biblioentry>
606
607EOF
608
609
610
611
612  fi # end of if jfound not empty
613  l=$(( ${l} + 1 ))
614
615done
616echo "</bibliography>" >> ${fileou}
617
618xml val --err \
619        --xsd http://www.docbook.org/xml/5.0/xsd/docbook.xsd \
620        ${fileou} 1> xmlstarlet.log 2>&1
621
622# clean
623echo "iii : xslstarlet.log contains sdtout and stderr from xml command on ${fileou}"
624echo "iii : which was done just to check consistence of ${fileou}"
625more xmlstarlet.log
626rm -i xmlstarlet.log
627#
628case ${type} in
629raw)
630 echo "iii : ${fileraw_strict} contains a copy of input file without comments"
631 rm -i ${fileraw_strict}
632;;
633mailbody)
634 echo "iii : ${fileraw} contains a copy of input file"
635 rm -i ${fileraw}
636 echo "iii : ${fileraw_strict} contains a copy of input file without comments"
637 rm -i ${fileraw_strict}
638;;
639esac
640#
641echo " iii : you have a some new or modified bibliographic references in ${fileou} (biblioentry)"
642echo " iii : you can add them in ${fileou}" #++ filename path
643echo " iii : modify date in ${fileou}" #++ filename path
644echo " iii : but please take care of id last part (after underscore) that may"
645echo " iii : be in conflict with existing ones" #++ pour s'affranchir de ce souci il faudrait donner en entrée complémentaire le fichier à compléter.
646#
647exit 0
Note: See TracBrowser for help on using the repository browser.