source: trunk/bibopa.sh @ 63

Last change on this file since 63 was 59, checked in by smasson, 16 years ago

add journals

  • Property svn:keywords set to Id
File size: 19.5 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 Oceanography 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"
299jlist[78]="Water Resour. Res."
300jlist[79]="Phil. Trans. Roy. Soc. A"
301jlist[80]="Theoretical and Applied Climatology"
302jlist[81]="Journal of Hydrometeorology"
303jlist[82]="Remote Sensing of Environment"
304jlist[83]="Progress In Oceanography"
305jlist[84]="Climatic Change"
306jlist[85]="Ocean Dynamics"
307jlist[86]="Izvestiya Atmospheric and Oceanic Physics"
308jlist[87]="Oceanology"
309jlist[88]="Advances in Atmospheric Sciences"
310jlist[89]="Quaternary Science Reviews"
311jlist[90]="AGU monograph"
312#
313# following Journal name are fake ones for demo1 : references extracted from
314# Cantratrix Sopronica L. written by Georges Perec
315#find in http://www-rocq.inria.fr/who/Marc.Thiriet/PsFil/Biblio/cantatrix.ps
316ij=90
317ij=$(( ${ij} + 1))
318jlist[$ij]="Res. Proc. neurophysiol. Fanatic Soc"
319ij=$(( ${ij} + 1))
320jlist[$ij]="New Records Ass. J."
321ij=$(( ${ij} + 1))
322jlist[$ij]="Am. J. Allegrol."
323ij=$(( ${ij} + 1))
324jlist[$ij]="J. Neurochem. Neurocytol. Enzymol."
325ij=$(( ${ij} + 1))
326jlist[$ij]="Hammersmith J."
327ij=$(( ${ij} + 1))
328jlist[$ij]="Nasa Rept."
329ij=$(( ${ij} + 1))
330jlist[$ij]="C.r. Assoc. Conc. Lam."
331ij=$(( ${ij} + 1))
332jlist[$ij]="Gaz. med. franco-rus."
333ij=$(( ${ij} + 1))
334jlist[$ij]="Amer. J. music. Deciency"
335#jlist[]=""
336#
337#
338    cat <<EOF > ${fileou}
339<?xml version='1.0' encoding='ISO-8859-1'?>
340<bibliography
341version="5.0"
342xmlns="http://docbook.org/ns/docbook"
343xml:id="bib${project}ref"
344xml:lang="${lang}">
345
346<info>
347<date>$( date -u +"%Y-%m-%dT%H:%M:%SZ" )</date>
348</info>
349EOF
350#
351# strip comments
352fileraw_strict=/tmp/$(basename ${fileraw})_strict
353grep -v "^#" ${fileraw} > ${fileraw_strict}
354totlines=$( wc -l ${fileraw_strict} | awk '{print $1}' )
355l=1
356while [ ${l} -le ${totlines}  ]
357do
358# extract one line
359  line=$( sed -n ${l}p ${fileraw_strict} )
360  orgline=$( echo ${line} | sed -e "s/--/- -/g" )
361  line=$( echo ${line} | sed -e "s/</\&lt;/g" -e "s/>/\&gt;/g" )
362  # detect if bibtex or not bibtex (starting with @)
363  if [ ${line:0:1} != "@" ]
364  then
365     # parsing non bibtex line
366     bibtex=0
367     # before the first :
368       tmp=${line%%:*}
369     # before the last ,
370       auths=${tmp%,*},
371     # replace "and" by ","
372       auths=$( echo "${auths}" | sed -e "s/ and /,/g" )
373     # after the last ,
374       year=${tmp##*,}
375       year=$( rmbl "${year}" )
376     ## first author before the first .,
377       first=${auths%%.,*}.
378     # its firstname after the last ,
379       firstfn=${first##*,}
380       firstfn=$( rmbl "${firstfn}" )
381     # its surname ; before the first ,
382       firstsn=${first%%,*}
383       firstsn=$( rmbl "${firstsn}" )
384     ## ref id
385       refid=$( echo ${firstsn} | tr "[:upper:]" "[:lower:]" | tr -s " " "_"  | tr -s "'" "_" | recode -d -f ISO-8859-1..flat )${year}
386       num=$( grep -c "<biblioentry xml:id=\"${refid}_[0-9][0-9]\">" ${fileou} )
387       num=$(( ${num} + 1 ))
388       [ ${num} -le 9 ] && num=0${num}
389       refid=${refid}_${num}
390       hasauthor=1
391   else
392      # parsing bibtex line
393      bibtex=1
394      # before the first ,
395      tmp=${line%%,*}
396      endline=${line#*,}
397      # refid is after { and before the first comma
398      refid=${tmp#*{}
399      # ++ test if refid already exist
400      # check if author field is there
401      echo ${endline} | grep -q "author"
402      hasauthor=${?}
403      if [ ${hasauthor} -eq 0 ]
404      then
405         auths=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(author * = *{\)\(.*\)\(}\)/\2/")
406         #echo "auths $auths" # genre  Michael Metcalf and John Reid and Malcolm Cohen
407      else
408        echo "pas d'auteurs" # ++
409      fi
410      endline=${endline#*,}
411      title=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(title * = *{\)\(.*\)\(}\)/\2/")
412      endline=${endline#*,}
413#echo ${endline} | awk -F "," '{print $1}' #++debug
414      year=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(year * = *{\)\(.*\)\(}\)/\2/")
415      endline=${endline#*,}
416      publisher=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(publisher * = *{\)\(.*\)\(}\)/\2/")
417      endline=${endline#*,}
418      edition=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(edition * = *{\)\(.*\)\(}\)/\2/")
419      endline=${endline#*,}
420      isbn=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(isbn * = *{\)\(.*\)\(}\)/\2/")
421      endline=${endline#*,}
422      pag=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(page * = *{\)\(.*\)\(}\)/\2/")
423
424      if [ ${hasauthor} -eq 1 ]
425      then
426         ## first author before the first and
427         first=${auths%%and*}
428         # its surname after the last " "  ++ pas vrai double nom et pb blanc dans la syntaxe
429         # firstsn=${first##* } . ok en interactif . pas ok en script
430         firstsn=$( echo ${first}  | awk '{print $2}')
431         #echo "firstsn $firstsn"
432         # its firstname before the first " "
433         firstfn=${first%% *}
434      fi
435   fi
436
437          cat <<EOF >> ${fileou}
438<biblioentry xml:id="${refid}">
439  <!-- date
440  $( date -u +"%Y-%m-%dT%H:%M:%SZ" )
441  -->
442  <!-- original text
443  ${orgline}
444  -->
445EOF
446      if [ ${hasauthor} -eq 1 ]
447      then
448          cat <<EOF >> ${fileou}
449  <authorgroup>
450    <author> <personname> <surname>${firstsn}</surname> <firstname>${firstfn}</firstname> </personname> </author>
451EOF
452
453## other authors..
454  if [ ${bibtex} -eq 0 ]
455  then
456   previous=${first},
457   # next authors...
458   next=${auths##*${previous}}
459  fi
460  if [ ${bibtex} -eq 1 ]
461  then
462   previous=${first}"and "
463   # next authors...
464   #echo "auths ${auths}"
465   next=${auths##*${previous}}
466   if [ "${next}and " = "${previous}" ]
467   then
468     next=""
469   fi
470  fi
471  #echo "previous ${previous}"
472  #echo "next ${next}"
473# while the next author is not empty
474  while [  "${next}" != "" ]
475    do
476      if [ ${bibtex} -eq 0 ]
477      then
478         # get the first next author; before the first ,
479         next=${next%%,*}
480         # its surname ; after the last .
481         nextsn=${next##*.}
482         nextsn=$( rmbl "${nextsn}" )
483         # its firstname ; before the last .
484         nextfn=${next%.*}.
485         nextfn=$( rmbl "${nextfn}" )
486       fi
487      if [ ${bibtex} -eq 1 ]
488      then
489         # get the first next author; before the first "and"
490         next=${next%%and *}
491         # its surname after the last " "  ++ pas vrai double nom et pb blanc dans la syntaxe
492         # nextsn=${next##* } . ok en interactif . pas ok en script
493         nextsn=$( echo ${next}  | awk '{print $2}')
494         #echo "nextsn $nextsn"
495         # its nextname before the first " "
496         nextfn=${next%% *}
497      fi
498#
499    echo "    <author> <personname> <surname>${nextsn}</surname> <firstname>${nextfn}</firstname> </personname> </author>" >> ${fileou}
500    #echo "    <author> <personname> <surname>${nextsn}</surname> <firstname>${nextfn}</firstname> </personname> </author>"  #++debug
501    if [ ${bibtex} -eq 0 ]
502    then
503      previous=${next},
504      next=${auths##*${previous}}
505    fi
506    if [ ${bibtex} -eq 1 ]
507    then
508      previous=${next}"and "
509      next=${auths##*${previous}}
510    fi
511  done
512  echo "  </authorgroup>"  >> ${fileou}
513  fi
514
515# end of the line ; after the first :
516  endline=${line#*:}
517
518## find the journal
519  j=1
520  jfound=""
521  jlistsize=${#jlist[@]}
522  while [[ ${j} -le ${jlistsize} && "${jfound}" == "" ]]
523    do
524    ok=$( echo ${endline} | grep -ci "${jlist[j]} *," )
525    [ $ok -eq 1 ] && jfound="${jlist[j]}"
526    j=$(( ${j} + 1 ))
527  done
528  if [ "${jfound}" == "" ]
529      then
530      echo "eee: Journal not found "
531      echo "${endline}"
532      #++exit 1
533#+++ following lines are not yet validate
534      # it might be a book, a manual, a conference, etc. ++
535      echo "  <title>${title}</title>" >> ${fileou}
536      echo "  <biblioid class=\"isbn\">${isbn}</biblioid>" >> ${fileou}
537          cat <<EOF >> ${fileou}
538  <biblioset relation="nojournal">
539    <title>${title}</title>
540    <pagenums>${pag}</pagenums>
541    <pubdate>${year}</pubdate>
542  </biblioset>
543EOF
544          cat <<EOF >> ${fileou}
545</biblioentry>
546
547EOF
548  fi # end of if jfound empty (ie not an article)
549  if [ "${jfound}" != "" ]
550  then
551## title
552# before the first :
553  title=${endline%%${jfound}*}
554  title=$( cleanname "${title}" )
555  echo "  <title>${title}</title>" >> ${fileou}
556## end
557## end of the line ; after the first ${jfound}
558  endline=${endline#*${jfound}}
559  endline=$( cleanname "${endline}" )
560## doi
561  endline=$( echo ${endline} | sed -e "s/[dD][oO][iI] *\t* *: *\t* */doi:/" )
562  ok=$( echo ${endline} | grep -ic "doi:" )
563  if [ ${ok} -eq 1 ]
564      then
565      doi=${endline##*doi:}
566      echo "  <biblioid class=\"doi\">${doi}</biblioid>" >> ${fileou}
567      endline=${endline%doi:*}
568      endline=$( cleanname "${endline}" )
569  else
570      echo "non doi: ${line}"
571  fi
572  num=$( echo ${endline} |  tr -dc "," | wc -c )
573  case ${num} in
574      1)
575### echo ${num}: ${endline}
576          vol=${endline%,*}
577          vol=$( cleanname "${vol}" )
578          pag=${endline##*,}
579          pag=$( cleanname "${pag}" )
580          cat <<EOF >> ${fileou}
581  <biblioset relation="journal">
582    <title>${jfound}</title>
583    <volumenum>${vol}</volumenum><pagenums>${pag}</pagenums>
584    <pubdate>${year}</pubdate>
585  </biblioset>
586EOF
587      ;;
588      2)
589          vol=${endline%,*}
590          vol=$( cleanname "${vol}" )
591          iss=${vol##*,}
592          iss=$( cleanname "${iss}" )
593          vol=${vol%,*}
594          vol=$( cleanname "${vol}" )
595          pag=${endline##*,}
596          pag=$( cleanname "${pag}" )
597          cat <<EOF >> ${fileou}
598  <biblioset role="journal">
599    <title>${jfound}</title>
600    <volumenum>${vol}</volumenum><issuenum>${iss}</issuenum><pagenums>${pag}</pagenums>
601    <pubdate>${year}</pubdate>
602  </biblioset>
603EOF
604      ;;
605      *)
606#echo ${num}: ${endline} # ++debug
607          cat <<EOF >> ${fileou}
608  <biblioset role="journal">
609    <title>${jfound}</title>
610    <pubdate>${year}</pubdate>
611    <bibliomisc>${endline}</bibliomisc>
612  </biblioset>
613EOF
614      ;;
615  esac
616
617          cat <<EOF >> ${fileou}
618</biblioentry>
619
620EOF
621
622
623
624
625  fi # end of if jfound not empty
626  l=$(( ${l} + 1 ))
627
628done
629echo "</bibliography>" >> ${fileou}
630
631xml val --err \
632        --xsd http://www.docbook.org/xml/5.0/xsd/docbook.xsd \
633        ${fileou} 1> xmlstarlet.log 2>&1
634
635# clean
636echo "iii : xslstarlet.log contains sdtout and stderr from xml command on ${fileou}"
637echo "iii : which was done just to check consistence of ${fileou}"
638more xmlstarlet.log
639rm -i xmlstarlet.log
640#
641case ${type} in
642raw)
643 echo "iii : ${fileraw_strict} contains a copy of input file without comments"
644 rm -i ${fileraw_strict}
645;;
646mailbody)
647 echo "iii : ${fileraw} contains a copy of input file"
648 rm -i ${fileraw}
649 echo "iii : ${fileraw_strict} contains a copy of input file without comments"
650 rm -i ${fileraw_strict}
651;;
652esac
653#
654echo " iii : you have a some new or modified bibliographic references in ${fileou} (biblioentry)"
655echo " iii : you can add them in ${fileou}" #++ filename path
656echo " iii : modify date in ${fileou}" #++ filename path
657echo " iii : but please take care of id last part (after underscore) that may"
658echo " 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.
659#
660exit 0
Note: See TracBrowser for help on using the repository browser.