1 | #!/bin/bash |
---|
2 | #+ |
---|
3 | # |
---|
4 | # NAME |
---|
5 | # ==== |
---|
6 | # |
---|
7 | # bibopa.sh - transform a bibliography file in DocBook 5 format |
---|
8 | # |
---|
9 | # SYNOPSIS |
---|
10 | # ======== |
---|
11 | # |
---|
12 | # :: |
---|
13 | # |
---|
14 | # $ bibopa.sh -i filein -t type -o order -p project -l lang |
---|
15 | # |
---|
16 | # |
---|
17 | # DESCRIPTION |
---|
18 | # =========== |
---|
19 | # |
---|
20 | # |
---|
21 | # Each entry in the same input file must follows the same order for authors |
---|
22 | # except the first one. |
---|
23 | # |
---|
24 | # With ``fs`` in option order you will correctly process raw entry with |
---|
25 | # firstname and surname in this order for authors except the first one. |
---|
26 | # |
---|
27 | # If raw entry uses surname and firstname order, you should use ``sf``. |
---|
28 | # |
---|
29 | # :: |
---|
30 | # |
---|
31 | # Behera, S. K., J. Luo, S. Masson, S. Rao, S. Gualdi, P. Delecluse, A. |
---|
32 | # Navarra and T. Yamagata, 2004 : Paramount Impact of the Indian Ocean |
---|
33 | # Dipole on the East African Short Rains: A CGCM Study, J. Climate, In |
---|
34 | # press. |
---|
35 | # |
---|
36 | # |
---|
37 | # donnerait |
---|
38 | # |
---|
39 | # :: |
---|
40 | # |
---|
41 | # <biblioentry xml:id="behara2004"> |
---|
42 | # <authorgroup> |
---|
43 | # <author><surname>Behera</surname> <firstname>S. K.</firstname> </author> |
---|
44 | # <author><firstname>J.</firstname> <surname>Luo</surname></author> |
---|
45 | # <author><firstname>S.</firstname> <surname>Masson</surname></author> |
---|
46 | # <author><firstname>S.</firstname> <surname>Rao</surname></author> |
---|
47 | # <author><firstname>S.</firstname> <surname>Gualdi</surname></author> |
---|
48 | # <author><firstname>P.</firstname> <surname>Delecluse</surname></author> |
---|
49 | # <author><firstname>A.</firstname> <surname>Navara</surname></author> |
---|
50 | # <author><firstname>T.</firstname> <surname>Yamagata</surname></author> |
---|
51 | # </authorgroup> |
---|
52 | # <date>2004</date> |
---|
53 | # <title>Paramount Impact of the Indian Ocean Dipole on the East African |
---|
54 | # Short Rains: A CGCM Study</title> |
---|
55 | # <publishername>J. Climate</publishername> |
---|
56 | # <biblioid class="doi">doi</biblioid> |
---|
57 | # <bibliomisc role="pseudoref">In press.</bibliomisc> |
---|
58 | # <bibliomisc role="internalref">from |
---|
59 | # http://www.lodyc.jussieu.fr/~opatlod/NEMO_v1/6_Menu/2_page/index.html |
---|
60 | # 2007-03-29T16:24:31Z fplod by hand</bibliomisc> |
---|
61 | # </biblioentry> |
---|
62 | # |
---|
63 | # |
---|
64 | # :: |
---|
65 | # |
---|
66 | # @book{MetReiCoh2004 , |
---|
67 | # author = {Michael Metcalf and |
---|
68 | # John Reid and Malcolm Cohen}, |
---|
69 | # title = {Fortran 95/2003 explained}, |
---|
70 | # year = {2004}, |
---|
71 | # publisher = {Oxford University Press}, |
---|
72 | # edition = {Third}, |
---|
73 | # ISBN = {0-19-852693-8}, |
---|
74 | # pages = {434} |
---|
75 | # } |
---|
76 | # |
---|
77 | # |
---|
78 | # donnerait |
---|
79 | # |
---|
80 | # :: |
---|
81 | # |
---|
82 | # <biblioentry xml:id="MetReiCoh2004"> |
---|
83 | # <authorgroup> |
---|
84 | # <author><firstname>Michael</firstname> <surname>Metcalf</surname></author> |
---|
85 | # <author><firstname>John</firstname> <surname>Reid</surname></author> |
---|
86 | # <author><firstname>Malcolm</firstname> <surname>Cohen</surname></author> |
---|
87 | # </authorgroup> |
---|
88 | # <date>2004}</date> |
---|
89 | # <title>Fortran 95/2003 explained</title> |
---|
90 | # <publisher><publishername>Oxford University Press</publishername></publisher> |
---|
91 | # <biblioid class="isbn">0-19-852693-8</biblioid> |
---|
92 | # <pagenums>434</pagenums> |
---|
93 | # <edition>Third</edition> |
---|
94 | # |
---|
95 | # |
---|
96 | # EXAMPLES |
---|
97 | # ======== |
---|
98 | # |
---|
99 | # To transform the NEMO bibliography file in raw format: |
---|
100 | # |
---|
101 | # :: |
---|
102 | # |
---|
103 | # $ ./bibopa.sh -p birefnemo -i data/biball.txt -t raw |
---|
104 | # |
---|
105 | # |
---|
106 | # To transform a bibliography file in mailbody format: |
---|
107 | # |
---|
108 | # :: |
---|
109 | # |
---|
110 | # $ ./bibopa.sh -p bibrefnemo -i data/mail2007-05-10T09:01:56Z -t mailbody |
---|
111 | # |
---|
112 | # |
---|
113 | # To transform a bibliography file in bibtex format in french: |
---|
114 | # |
---|
115 | # :: |
---|
116 | # |
---|
117 | # $ ./bibopa.sh -p polyfortran -i data/petitpolyfp.bib -t bibtex -l fr |
---|
118 | # |
---|
119 | # |
---|
120 | # To transform the SUPERBIB demo bibliography file in raw format: |
---|
121 | # |
---|
122 | # :: |
---|
123 | # |
---|
124 | # $ ./bibopa.sh -p demo1 -i data/bibdemo1.txt -t raw -l fr |
---|
125 | # |
---|
126 | # |
---|
127 | # SEE ALSO |
---|
128 | # ======== |
---|
129 | # |
---|
130 | # mailtouser.sh_ |
---|
131 | # |
---|
132 | # .. _mailtouser.sh : mailtouser.sh.html |
---|
133 | # |
---|
134 | # FILES |
---|
135 | # ===== |
---|
136 | # |
---|
137 | # original location |
---|
138 | # ~~~~~~~~~~~~~~~~~ |
---|
139 | # |
---|
140 | # /usr/home/fplod/incas/bibnemo/src/bibnemomaf/bibopa.sh sur cerbere.locean-ipsl.upmc.fr |
---|
141 | # |
---|
142 | # |
---|
143 | # TODO |
---|
144 | # ==== |
---|
145 | # |
---|
146 | # gestion des comments |
---|
147 | # |
---|
148 | # gestion des id existants (cf à la fin) |
---|
149 | # |
---|
150 | # option debug |
---|
151 | # |
---|
152 | # should use iconv instead of recode |
---|
153 | # for portability issue but not found yet the "flat" fonctionnality in |
---|
154 | # iconv |
---|
155 | # |
---|
156 | # write something in the logfile ! |
---|
157 | # |
---|
158 | # EVOLUTIONS |
---|
159 | # ========== |
---|
160 | # |
---|
161 | # |
---|
162 | # |
---|
163 | # $Id$ |
---|
164 | # |
---|
165 | # - fplod 2009-03-13T09:35:42Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
166 | # |
---|
167 | # * add "High Performance Computing in Science and Engineering" |
---|
168 | # * add "Annals of Glaciology" |
---|
169 | # * add "Journal of Physical Oceanography" |
---|
170 | # |
---|
171 | # - fplod 2009-01-15T10:36:18Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
172 | # |
---|
173 | # * add description of ``-o`` option |
---|
174 | # * add journal "PNAS" |
---|
175 | # * add journal "Lettre PIGB-PMRC" |
---|
176 | # |
---|
177 | # - fplod 2009-01-14T15:27:48Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
178 | # |
---|
179 | # * add journal "Water Resources Research" |
---|
180 | # * add journal "Climate Research" |
---|
181 | # * add conf "Colloque du GIS « Climat-Environnement-Sociétés »" |
---|
182 | # * add journal "Agricultural and Forest Meteorology" |
---|
183 | # * add conf "VIIth IAHS Scientific Assembly" |
---|
184 | # * add conf "AGU fall Meeting" |
---|
185 | # * add journal "Phil. Trans. Roy. Soc. B" |
---|
186 | # * add journal "Phil. Trans. Roy. Soc. B" |
---|
187 | # * add conf "4th Alexander Von Humboldt International Conference" |
---|
188 | # * add journal/conf "??" (Should not be used too much !) |
---|
189 | # * add journal "Nature Geosciences" |
---|
190 | # * add journal "International Journal of Climatology" |
---|
191 | # * add journal "Journal of Hydrology" |
---|
192 | # * add journal "Revue de l'Énergie" |
---|
193 | # * add journal "Clim. Res." |
---|
194 | # * add journal "Hydrol. Earth Sys. Sci." |
---|
195 | # * add journal "Ambio" |
---|
196 | # * add journal "Theoretical and applied climatology" |
---|
197 | # * add journal "Remote Sensing of Environnement" |
---|
198 | # |
---|
199 | # - fplod 2008-10-28T11:40:19Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
200 | # |
---|
201 | # * add journal "Progress In Oceanography" |
---|
202 | # * add journal "Climatic Change" |
---|
203 | # * add journal "Ocean Dynamics" |
---|
204 | # * add journal "Phil. Trans. Roy. Soc. A" |
---|
205 | # * add journal "Izvestiya Atmospheric and Oceanic Physics" |
---|
206 | # * add journal "Journal of Hydrometeorology" |
---|
207 | # * add journal "Remote Sensing of Environment" |
---|
208 | # * add journal "Oceanology" |
---|
209 | # * add journal "Water Resour. Res." |
---|
210 | # * add journal "Advances in Atmospheric Sciences" |
---|
211 | # * add journal "Quaternary Science Reviews" |
---|
212 | # * replace "Elsevier Oceanography Series" by "Elsevier Oceanographic Series" |
---|
213 | # * bug fix : unclosed date tag |
---|
214 | # * trouble with flat conversion for id building ... |
---|
215 | # * remove interactivity at then end (allowing redirection of stderr and |
---|
216 | # stdout) |
---|
217 | # * strip blank lines |
---|
218 | # * bug fix : counting nb of occurences of "," technique ... to be improved |
---|
219 | # |
---|
220 | # - fplod 2008-09-16T15:19:59Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
221 | # |
---|
222 | # * comments in ReStructured Text |
---|
223 | # |
---|
224 | # - fplod 2008-05-16T10:33:16Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
225 | # |
---|
226 | # * add parameter -o for firstname/surname order in bibtex file |
---|
227 | # |
---|
228 | # - fplod 2008-05-15T15:15:04Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
229 | # |
---|
230 | # * new way of processing bibtex file : external/bibtex2xml.py |
---|
231 | # |
---|
232 | # - fplod 2008-04-30T07:11:58Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
233 | # |
---|
234 | # * chgt for dbk5 out |
---|
235 | # * xmlto 0.0.18 does'nt like this docbook release. remove |
---|
236 | # * usage of xml (xmlstarlet) for validation |
---|
237 | # * bug fix |
---|
238 | # * add journal names from demo1 |
---|
239 | # * fplod 2008-03-12T16:11:07Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
240 | # * add -p option (to overide bibrefnemo in file name and id) |
---|
241 | # * add -l option by default en |
---|
242 | # |
---|
243 | # - fplod 2008-03-11T11:25:27Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
244 | # |
---|
245 | # * add bibtex entry (not finished) |
---|
246 | # |
---|
247 | # - fplod 2007-06-20T17:18:02Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
248 | # |
---|
249 | # * <bibliomisc role="id"> replace by <biblioid class="doi"> |
---|
250 | # |
---|
251 | # - smasson 2007-06-07T16:43:42Z arete.locean-ipsl.upmc.fr (Darwin) |
---|
252 | # |
---|
253 | # * Add journals |
---|
254 | # |
---|
255 | # - fplod 2007-05-10T09:17:09Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
256 | # |
---|
257 | # * dernières touches |
---|
258 | # |
---|
259 | # - fplod 2007-04-25T10:59:49Z cerbere.locean-ipsl.upmc.fr (Linux) |
---|
260 | # |
---|
261 | # * add a filein parameter and an option for mailbody |
---|
262 | # * comments (line begininig with #) are now possible |
---|
263 | # |
---|
264 | # - Sebastien Masson avril 2007 |
---|
265 | # |
---|
266 | # * creation |
---|
267 | # |
---|
268 | #- |
---|
269 | |
---|
270 | rmbl () { |
---|
271 | echo "${1}" | sed -e "s/^ *//" | sed -e "s/ *$//" |
---|
272 | } |
---|
273 | cleanname () { |
---|
274 | echo "${1}" | sed -e "s/^ *//" \ |
---|
275 | -e "s/^ *,//" \ |
---|
276 | -e "s/^ *;//" \ |
---|
277 | -e "s/^ *\.//" \ |
---|
278 | -e "s/ *$//" \ |
---|
279 | -e "s/, *$//" \ |
---|
280 | -e "s/; *$//" \ |
---|
281 | -e "s/\. *$//" |
---|
282 | } |
---|
283 | # |
---|
284 | system=$(uname) |
---|
285 | case "${system}" in |
---|
286 | AIX|IRIX64) |
---|
287 | echo " www : no specific posix checking" |
---|
288 | ;; |
---|
289 | *) |
---|
290 | set -o posix |
---|
291 | ;; |
---|
292 | esac |
---|
293 | command=$(basename ${0}) |
---|
294 | log_date=$(date -u +"%Y%m%dT%H%M%SZ") |
---|
295 | log=/tmp/$(basename ${command} .sh).log.${log_date} |
---|
296 | # |
---|
297 | # test if xsltproc is available |
---|
298 | tool=xsltproc |
---|
299 | type ${tool} 1> /dev/null 2>&1 |
---|
300 | status=${?} |
---|
301 | if [ ${status} -ne 0 ] |
---|
302 | then |
---|
303 | echo " eee : ${tool} not found" |
---|
304 | exit 1 |
---|
305 | fi |
---|
306 | unset status |
---|
307 | unset tool |
---|
308 | # |
---|
309 | # test if xml is available |
---|
310 | tool=xml |
---|
311 | type ${tool} 1> /dev/null 2>&1 |
---|
312 | status=${?} |
---|
313 | if [ ${status} -ne 0 ] |
---|
314 | then |
---|
315 | echo " eee : ${tool} not found" |
---|
316 | exit 1 |
---|
317 | fi |
---|
318 | unset status |
---|
319 | unset tool |
---|
320 | # |
---|
321 | # test if python is available |
---|
322 | tool=python |
---|
323 | type ${tool} 1> /dev/null 2>&1 |
---|
324 | status=${?} |
---|
325 | if [ ${status} -ne 0 ] |
---|
326 | then |
---|
327 | echo " eee : ${tool} not found" |
---|
328 | exit 1 |
---|
329 | fi |
---|
330 | unset status |
---|
331 | unset tool |
---|
332 | # |
---|
333 | # test if recode is available |
---|
334 | tool=recode |
---|
335 | type ${tool} 1> /dev/null 2>&1 |
---|
336 | status=${?} |
---|
337 | if [ ${status} -ne 0 ] |
---|
338 | then |
---|
339 | echo " eee : ${tool} not found" |
---|
340 | exit 1 |
---|
341 | fi |
---|
342 | unset status |
---|
343 | unset tool |
---|
344 | # |
---|
345 | usage=" Usage : ${command} -i filein -t type -o order -p project -l lang" |
---|
346 | # |
---|
347 | # default |
---|
348 | lang=en |
---|
349 | order="fs" # firstname surname |
---|
350 | # |
---|
351 | minargcount=6 |
---|
352 | #echo " narg ${#}" |
---|
353 | if [ ${#} -lt ${minargcount} ] |
---|
354 | then |
---|
355 | echo "eee : not enought arguments" |
---|
356 | echo "${usage}" |
---|
357 | exit 1 |
---|
358 | fi |
---|
359 | unset minargcount |
---|
360 | # |
---|
361 | while [ ! -z "${1}" ] |
---|
362 | do |
---|
363 | case ${1} in |
---|
364 | -i) # filein |
---|
365 | filein=${2} |
---|
366 | shift |
---|
367 | ;; |
---|
368 | -t) # type |
---|
369 | type=${2} |
---|
370 | shift |
---|
371 | ;; |
---|
372 | -o) # order of firstname surname in bibtex file |
---|
373 | order=${2} |
---|
374 | shift |
---|
375 | ;; |
---|
376 | -p) |
---|
377 | project=${2} |
---|
378 | shift |
---|
379 | ;; |
---|
380 | -l) |
---|
381 | lang=${2} |
---|
382 | shift |
---|
383 | ;; |
---|
384 | -h) |
---|
385 | echo "${usage}" |
---|
386 | exit 0 |
---|
387 | ;; |
---|
388 | *) # other choice |
---|
389 | echo "${usage}" |
---|
390 | exit 1 |
---|
391 | ;; |
---|
392 | esac |
---|
393 | shift # next flag |
---|
394 | done |
---|
395 | unset usage |
---|
396 | # |
---|
397 | set -u |
---|
398 | # |
---|
399 | # check for filein |
---|
400 | if [ ! -f ${filein} ] |
---|
401 | then |
---|
402 | echo "eee : ${filein} not found" |
---|
403 | exit 1 |
---|
404 | fi |
---|
405 | # |
---|
406 | case ${type} in |
---|
407 | raw) # file like data/biball.txt |
---|
408 | fileraw=${filein} |
---|
409 | fileou=$( basename ${filein} .txt).xml |
---|
410 | ;; |
---|
411 | mailbody) # file like data/mail2007-04-25T08:58:16Z.txt |
---|
412 | fileraw=/tmp/$(basename ${filein}).raw |
---|
413 | fileou=$( basename ${filein} .txt).xml |
---|
414 | echo "# from ${filein}" > ${fileraw} |
---|
415 | echo "# ${log_date}" >> ${fileraw} |
---|
416 | echo "# corrections" >> ${fileraw} |
---|
417 | grep "correction_.*=" ${filein} | grep -v "correction_.*=$" | \ |
---|
418 | sed -e "s/correction_.*=//">> ${fileraw} |
---|
419 | echo "# new references" >> ${fileraw} |
---|
420 | awk "/newreferences=/,/comments=/" ${filein} | sed -e "s/newreferences=//" -e "/comments=/d" >> ${fileraw} |
---|
421 | #more ${fileraw} # ++ if debug |
---|
422 | #read a #++ if debug |
---|
423 | ;; |
---|
424 | bibtex) # file like data/petitpoly.bib |
---|
425 | fileraw=/tmp/$(basename ${filein}).raw |
---|
426 | awk -f join_endcomma.awk ${filein} > ${fileraw} |
---|
427 | fileou=$( basename ${filein} .bib).xml |
---|
428 | ;; |
---|
429 | *) |
---|
430 | echo "eee : type should be raw, mailbody or bibtex" |
---|
431 | exit 1 |
---|
432 | ;; |
---|
433 | esac |
---|
434 | # |
---|
435 | # check for output |
---|
436 | if [ -f ${fileou} ] |
---|
437 | then |
---|
438 | echo "eee : ${fileou} already exist" |
---|
439 | exit 1 |
---|
440 | fi |
---|
441 | # |
---|
442 | ij=1 |
---|
443 | jlist[${ij}]="J. Climate" |
---|
444 | ij=$(( ${ij} + 1)) |
---|
445 | jlist[${ij}]="Journal of Climate" |
---|
446 | ij=$(( ${ij} + 1)) |
---|
447 | jlist[${ij}]="Ocean Modelling" |
---|
448 | ij=$(( ${ij} + 1)) |
---|
449 | jlist[${ij}]="Geophys. Res. Lett." |
---|
450 | ij=$(( ${ij} + 1)) |
---|
451 | jlist[${ij}]="J. Geophys. Res." |
---|
452 | ij=$(( ${ij} + 1)) |
---|
453 | jlist[${ij}]="Tellus A" |
---|
454 | ij=$(( ${ij} + 1)) |
---|
455 | jlist[${ij}]="Tellus B" |
---|
456 | ij=$(( ${ij} + 1)) |
---|
457 | jlist[${ij}]="J. Phys. Oceanogr." |
---|
458 | ij=$(( ${ij} + 1)) |
---|
459 | jlist[${ij}]="Clim. Dyn." |
---|
460 | ij=$(( ${ij} + 1)) |
---|
461 | jlist[${ij}]="Clim. Res." |
---|
462 | ij=$(( ${ij} + 1)) |
---|
463 | jlist[${ij}]="Climate Dynamics" |
---|
464 | ij=$(( ${ij} + 1)) |
---|
465 | jlist[${ij}]="Dyn. Atmos. Oceans" |
---|
466 | ij=$(( ${ij} + 1)) |
---|
467 | jlist[${ij}]="Mon. Wea. Rev." |
---|
468 | ij=$(( ${ij} + 1)) |
---|
469 | jlist[${ij}]="Global Biogeochem. Cycles" |
---|
470 | ij=$(( ${ij} + 1)) |
---|
471 | jlist[${ij}]="Nonlinear Processes in Geophysics" |
---|
472 | ij=$(( ${ij} + 1)) |
---|
473 | jlist[${ij}]="Ocean Science" |
---|
474 | ij=$(( ${ij} + 1)) |
---|
475 | jlist[${ij}]="J. Mar. Systems" |
---|
476 | ij=$(( ${ij} + 1)) |
---|
477 | jlist[${ij}]="J. Atmos. Sc." |
---|
478 | ij=$(( ${ij} + 1)) |
---|
479 | jlist[${ij}]="Proc. Royal Soc." |
---|
480 | ij=$(( ${ij} + 1)) |
---|
481 | jlist[${ij}]="Bull. Amer. Meteorol. Soc." |
---|
482 | ij=$(( ${ij} + 1)) |
---|
483 | jlist[${ij}]="Ocean Dyn." |
---|
484 | ij=$(( ${ij} + 1)) |
---|
485 | jlist[${ij}]="Geophysical Monograph Series, Earth's Climate: The Ocean-Atmosphere Interaction" |
---|
486 | ij=$(( ${ij} + 1)) |
---|
487 | jlist[${ij}]="Paleoceanography" |
---|
488 | ij=$(( ${ij} + 1)) |
---|
489 | jlist[${ij}]="Annales Geophysicae" |
---|
490 | ij=$(( ${ij} + 1)) |
---|
491 | jlist[${ij}]="Annals of Geophys." |
---|
492 | ij=$(( ${ij} + 1)) |
---|
493 | jlist[${ij}]="Deep Sea Research Part II: Topical Studies in Oceanography" |
---|
494 | ij=$(( ${ij} + 1)) |
---|
495 | jlist[${ij}]="Deep Sea Res. II" |
---|
496 | ij=$(( ${ij} + 1)) |
---|
497 | jlist[${ij}]="Atmospheric Chemistry and Physics" |
---|
498 | ij=$(( ${ij} + 1)) |
---|
499 | jlist[${ij}]="Atmospheric Chemistry and Physics Discussions" |
---|
500 | ij=$(( ${ij} + 1)) |
---|
501 | jlist[${ij}]="Earth Plan. Sc. Lett." |
---|
502 | ij=$(( ${ij} + 1)) |
---|
503 | jlist[${ij}]="J. Mar. Res." |
---|
504 | ij=$(( ${ij} + 1)) |
---|
505 | jlist[${ij}]="PCMDI Report Series" |
---|
506 | ij=$(( ${ij} + 1)) |
---|
507 | jlist[${ij}]="J. Mar. Syst." |
---|
508 | ij=$(( ${ij} + 1)) |
---|
509 | jlist[${ij}]="Note du Pole de Modelisation" |
---|
510 | ij=$(( ${ij} + 1)) |
---|
511 | jlist[${ij}]="Calculateurs Paralleles" |
---|
512 | ij=$(( ${ij} + 1)) |
---|
513 | jlist[${ij}]="Note Scientifique du Pole de Modelisation" |
---|
514 | ij=$(( ${ij} + 1)) |
---|
515 | jlist[${ij}]="Lecture Notes in Computer Science" |
---|
516 | ij=$(( ${ij} + 1)) |
---|
517 | jlist[${ij}]="Prog. Oceanogr." |
---|
518 | ij=$(( ${ij} + 1)) |
---|
519 | jlist[${ij}]="Deep Sea Research Part I: Oceanographic Research Papers" |
---|
520 | ij=$(( ${ij} + 1)) |
---|
521 | jlist[${ij}]="Deep Sea Res. I" |
---|
522 | ij=$(( ${ij} + 1)) |
---|
523 | jlist[${ij}]="IEEE Trans. Geosci. Remote Sensing" |
---|
524 | ij=$(( ${ij} + 1)) |
---|
525 | jlist[${ij}]="ECMWF Tech. Memorandum" |
---|
526 | ij=$(( ${ij} + 1)) |
---|
527 | jlist[${ij}]="J. Environ. Radioactivity" |
---|
528 | ij=$(( ${ij} + 1)) |
---|
529 | jlist[${ij}]="Int. WOCE Newsletter" |
---|
530 | ij=$(( ${ij} + 1)) |
---|
531 | jlist[${ij}]="C. R. Acad. Sci. Paris" |
---|
532 | ij=$(( ${ij} + 1)) |
---|
533 | jlist[${ij}]="C. R. Acad. Sci. Paris, Earth and Planetary Sciences" |
---|
534 | ij=$(( ${ij} + 1)) |
---|
535 | jlist[${ij}]="In The mathematics of models for climatology and environment" |
---|
536 | ij=$(( ${ij} + 1)) |
---|
537 | jlist[${ij}]="Oceanol. Acta" |
---|
538 | ij=$(( ${ij} + 1)) |
---|
539 | jlist[${ij}]="The global atmosphere and ocean system" |
---|
540 | ij=$(( ${ij} + 1)) |
---|
541 | jlist[${ij}]="NATO Advanced Study Institute" |
---|
542 | ij=$(( ${ij} + 1)) |
---|
543 | jlist[${ij}]="WCRP" |
---|
544 | ij=$(( ${ij} + 1)) |
---|
545 | jlist[${ij}]="The Courier" |
---|
546 | ij=$(( ${ij} + 1)) |
---|
547 | jlist[${ij}]="Elsevier Oceanography Series" |
---|
548 | ij=$(( ${ij} + 1)) |
---|
549 | jlist[${ij}]="In Conference Proceedings of the 1988 International Conference on Supercomputing" |
---|
550 | ij=$(( ${ij} + 1)) |
---|
551 | jlist[${ij}]="In Science and engineering on Cray Supercomputers" |
---|
552 | ij=$(( ${ij} + 1)) |
---|
553 | jlist[${ij}]="In Modeling the Earth's Climate and its Variability" |
---|
554 | ij=$(( ${ij} + 1)) |
---|
555 | jlist[${ij}]="Fish. Oceanogr." |
---|
556 | ij=$(( ${ij} + 1)) |
---|
557 | jlist[${ij}]="Q. J. R. Meteor. Soc." |
---|
558 | ij=$(( ${ij} + 1)) |
---|
559 | jlist[${ij}]="In High performance computing in the geosciences" |
---|
560 | ij=$(( ${ij} + 1)) |
---|
561 | jlist[${ij}]="Int. J. Numer. Meth. in Fluids" |
---|
562 | ij=$(( ${ij} + 1)) |
---|
563 | jlist[${ij}]="Lecture notes in Physics" |
---|
564 | ij=$(( ${ij} + 1)) |
---|
565 | jlist[${ij}]="J. Meterol. Soc. Japan" |
---|
566 | ij=$(( ${ij} + 1)) |
---|
567 | jlist[${ij}]="Journal of Marine Systems" |
---|
568 | ij=$(( ${ij} + 1)) |
---|
569 | jlist[${ij}]="Canadian Journal of Fisheries and Aquatic Sciences" |
---|
570 | ij=$(( ${ij} + 1)) |
---|
571 | jlist[${ij}]="J. Atmos. Ocean. Tech." |
---|
572 | ij=$(( ${ij} + 1)) |
---|
573 | jlist[${ij}]="EOS" |
---|
574 | ij=$(( ${ij} + 1)) |
---|
575 | jlist[${ij}]="Nature" |
---|
576 | ij=$(( ${ij} + 1)) |
---|
577 | jlist[${ij}]="Nature Geosciences" |
---|
578 | ij=$(( ${ij} + 1)) |
---|
579 | jlist[${ij}]="Physics and Chemistry of the Earth, Part B: Hydrology, Oceans and Atmosphere" |
---|
580 | ij=$(( ${ij} + 1)) |
---|
581 | jlist[${ij}]="Journal of Atmospheric and Oceanic Technology" |
---|
582 | ij=$(( ${ij} + 1)) |
---|
583 | jlist[${ij}]="Lecture Notes in Computational Science Engineering" |
---|
584 | ij=$(( ${ij} + 1)) |
---|
585 | jlist[${ij}]="In Greenhouse Gas Control Technologies" |
---|
586 | ij=$(( ${ij} + 1)) |
---|
587 | jlist[${ij}]="Chemical Geology" |
---|
588 | ij=$(( ${ij} + 1)) |
---|
589 | jlist[${ij}]="Marine Geology" |
---|
590 | ij=$(( ${ij} + 1)) |
---|
591 | jlist[${ij}]="Developments in Paleoenvironmental Research" |
---|
592 | ij=$(( ${ij} + 1)) |
---|
593 | jlist[${ij}]="Science" |
---|
594 | ij=$(( ${ij} + 1)) |
---|
595 | jlist[${ij}]="In Mediterranean Climate Variability" |
---|
596 | ij=$(( ${ij} + 1)) |
---|
597 | jlist[${ij}]="Global and Planetary Change" |
---|
598 | ij=$(( ${ij} + 1)) |
---|
599 | jlist[${ij}]="Physical Review Letters" |
---|
600 | ij=$(( ${ij} + 1)) |
---|
601 | jlist[${ij}]="Progress In Oceanography" |
---|
602 | ij=$(( ${ij} + 1)) |
---|
603 | jlist[${ij}]="Climatic Change" |
---|
604 | ij=$(( ${ij} + 1)) |
---|
605 | jlist[${ij}]="Ocean Dynamics" |
---|
606 | ij=$(( ${ij} + 1)) |
---|
607 | jlist[${ij}]="Phil. Trans. Roy. Soc. A" |
---|
608 | ij=$(( ${ij} + 1)) |
---|
609 | jlist[${ij}]="Phil. Trans. Roy. Soc. B" |
---|
610 | ij=$(( ${ij} + 1)) |
---|
611 | jlist[${ij}]="Izvestiya Atmospheric and Oceanic Physics" |
---|
612 | ij=$(( ${ij} + 1)) |
---|
613 | jlist[${ij}]="Journal of Hydrometeorology" |
---|
614 | ij=$(( ${ij} + 1)) |
---|
615 | jlist[${ij}]="Journal of Hydrology" |
---|
616 | ij=$(( ${ij} + 1)) |
---|
617 | jlist[${ij}]="Remote Sensing of Environment" |
---|
618 | ij=$(( ${ij} + 1)) |
---|
619 | jlist[${ij}]="Oceanology" |
---|
620 | ij=$(( ${ij} + 1)) |
---|
621 | jlist[${ij}]="Water Resour. Res." |
---|
622 | ij=$(( ${ij} + 1)) |
---|
623 | jlist[${ij}]="Water Resources Research" |
---|
624 | ij=$(( ${ij} + 1)) |
---|
625 | jlist[${ij}]="Advances in Atmospheric Sciences" |
---|
626 | ij=$(( ${ij} + 1)) |
---|
627 | jlist[${ij}]="Quaternary Science Reviews" |
---|
628 | ij=$(( ${ij} + 1)) |
---|
629 | jlist[${ij}]="AGU monograph Ocean Circulation Mechanisms and Impacts" |
---|
630 | ij=$(( ${ij} + 1)) |
---|
631 | jlist[${ij}]="Climate Research" |
---|
632 | ij=$(( ${ij} + 1)) |
---|
633 | jlist[$ij]="Colloque du GIS « Climat-Environnement-Sociétés »" |
---|
634 | ij=$(( ${ij} + 1)) |
---|
635 | jlist[$ij]="Agricultural and Forest Meteorology" |
---|
636 | ij=$(( ${ij} + 1)) |
---|
637 | jlist[$ij]="VIIth IAHS Scientific Assembly" |
---|
638 | ij=$(( ${ij} + 1)) |
---|
639 | jlist[$ij]="AGU fall Meeting" |
---|
640 | ij=$(( ${ij} + 1)) |
---|
641 | jlist[$ij]="4th Alexander Von Humboldt International Conference" |
---|
642 | ij=$(( ${ij} + 1)) |
---|
643 | jlist[$ij]="International Journal of Climatology" |
---|
644 | ij=$(( ${ij} + 1)) |
---|
645 | jlist[$ij]="Revue de l'Énergie" |
---|
646 | ij=$(( ${ij} + 1)) |
---|
647 | jlist[$ij]="Hydrol. Earth Sys. Sci." |
---|
648 | ij=$(( ${ij} + 1)) |
---|
649 | jlist[$ij]="Ambio" |
---|
650 | ij=$(( ${ij} + 1)) |
---|
651 | jlist[$ij]="Theoretical and applied climatology" |
---|
652 | ij=$(( ${ij} + 1)) |
---|
653 | jlist[$ij]="Remote Sensing of Environnement" |
---|
654 | ij=$(( ${ij} + 1)) |
---|
655 | jlist[$ij]="PNAS" |
---|
656 | ij=$(( ${ij} + 1)) |
---|
657 | jlist[$ij]="Lettre PIGB-PMRC" |
---|
658 | ij=$(( ${ij} + 1)) |
---|
659 | jlist[$ij]="High Performance Computing in Science and Engineering" |
---|
660 | ij=$(( ${ij} + 1)) |
---|
661 | jlist[$ij]="Annals of Glaciology" |
---|
662 | ij=$(( ${ij} + 1)) |
---|
663 | jlist[$ij]="Journal of Physical Oceanography" |
---|
664 | ij=$(( ${ij} + 1)) |
---|
665 | jlist[$ij]="??" |
---|
666 | # |
---|
667 | # following Journal name are fake ones for demo1 : references extracted from |
---|
668 | # Cantratrix Sopronica L. written by Georges Perec |
---|
669 | #find in http://www-rocq.inria.fr/who/Marc.Thiriet/PsFil/Biblio/cantatrix.ps |
---|
670 | ij=$(( ${ij} + 1)) |
---|
671 | jlist[$ij]="Res. Proc. neurophysiol. Fanatic Soc." |
---|
672 | ij=$(( ${ij} + 1)) |
---|
673 | jlist[$ij]="New Records Ass. J." |
---|
674 | ij=$(( ${ij} + 1)) |
---|
675 | jlist[$ij]="Am. J. Allegrol." |
---|
676 | ij=$(( ${ij} + 1)) |
---|
677 | jlist[$ij]="J. Neurochem. Neurocytol. Enzymol." |
---|
678 | ij=$(( ${ij} + 1)) |
---|
679 | jlist[$ij]="Hammersmith J." |
---|
680 | ij=$(( ${ij} + 1)) |
---|
681 | jlist[$ij]="Nasa Rept." |
---|
682 | ij=$(( ${ij} + 1)) |
---|
683 | jlist[$ij]="C.r. Assoc. Conc. Lam." |
---|
684 | ij=$(( ${ij} + 1)) |
---|
685 | jlist[$ij]="Gaz. med. franco-rus." |
---|
686 | ij=$(( ${ij} + 1)) |
---|
687 | jlist[$ij]="Amer. J. music. Deciency" |
---|
688 | # |
---|
689 | # strip comments and blank lines |
---|
690 | fileraw_strict=/tmp/$(basename ${fileraw})_strict |
---|
691 | grep -v "^#" ${fileraw} | grep -v "^%" | sed "/^$/d" > ${fileraw_strict} |
---|
692 | # following line is not compatible with XML header ++ |
---|
693 | # comments for memory (why did I write this line !?) |
---|
694 | # iconv -f ISO-8859-1 -t UTF-8 ${fileraw_strict} > ${fileraw_strict}2 |
---|
695 | # mv ${fileraw_strict}2 ${fileraw_strict} |
---|
696 | case ${type} in |
---|
697 | bibtex) |
---|
698 | fileou_bibtexml=/tmp/$(basename ${fileraw})_bibtexml |
---|
699 | python ./external/bibtex2xml.py ${fileraw_strict} > ${fileou_bibtexml} |
---|
700 | #more ${fileou_bibtexml} |
---|
701 | #read a |
---|
702 | xsltproc --output ${fileou} \ |
---|
703 | --param lang "'${lang}'" \ |
---|
704 | --param project "'${project}'" \ |
---|
705 | --param makedate "'${log_date}'" \ |
---|
706 | --param order "'${order}'" \ |
---|
707 | bibtexml2dbk.xsl ${fileou_bibtexml} |
---|
708 | rm ${fileou_bibtexml} |
---|
709 | ;; |
---|
710 | *) |
---|
711 | cat <<EOF > ${fileou} |
---|
712 | <?xml version='1.0' encoding='ISO-8859-1'?> |
---|
713 | <bibliography |
---|
714 | version="5.0" |
---|
715 | xmlns="http://docbook.org/ns/docbook" |
---|
716 | xml:id="bib${project}ref" |
---|
717 | xml:lang="${lang}"> |
---|
718 | |
---|
719 | <info> |
---|
720 | <date>${log_date}</date> |
---|
721 | </info> |
---|
722 | EOF |
---|
723 | totlines=$( wc -l ${fileraw_strict} | awk '{print $1}' ) |
---|
724 | l=1 |
---|
725 | while [ ${l} -le ${totlines} ] |
---|
726 | do |
---|
727 | # extract one line |
---|
728 | line=$( sed -n ${l}p ${fileraw_strict} ) |
---|
729 | orgline=$( echo ${line} | sed -e "s/--/- -/g" ) |
---|
730 | line=$( echo ${line} | sed -e "s/</\</g" -e "s/>/\>/g" ) |
---|
731 | # parsing non bibtex line |
---|
732 | bibtex=0 |
---|
733 | # before the first : |
---|
734 | tmp=${line%%:*} |
---|
735 | # before the last , |
---|
736 | auths=${tmp%,*}, |
---|
737 | # replace " and " by "," |
---|
738 | auths=$( echo "${auths}" | sed -e "s/ and /,/g" ) |
---|
739 | # replace " et " by "," |
---|
740 | auths=$( echo "${auths}" | sed -e "s/ et /,/g" ) |
---|
741 | # after the last , |
---|
742 | year=${tmp##*,} |
---|
743 | year=$( rmbl "${year}" ) |
---|
744 | ## first author before the first ., |
---|
745 | first=${auths%%.,*}. |
---|
746 | # its firstname after the last , |
---|
747 | firstfn=${first##*,} |
---|
748 | firstfn=$( rmbl "${firstfn}" ) |
---|
749 | # its surname ; before the first , |
---|
750 | firstsn=${first%%,*} |
---|
751 | firstsn=$( rmbl "${firstsn}" ) |
---|
752 | ## ref id |
---|
753 | firstsn_flat=$( echo "${firstsn}" | recode -d -f ISO-8859-15..flat ) |
---|
754 | # echo "firstsn : ${firstsn}" # ++ debug |
---|
755 | # echo "firstsn_flat : ${firstsn_flat}" #++ debug |
---|
756 | # test if no encoding problem after ISO-8859-15 to flat conversion |
---|
757 | firstsn_test1=$(echo "${firstsn_flat}" | tr -d "[:alpha:]" | tr -d " " | tr -d "'" | tr -d "-") |
---|
758 | #echo "firstsn_test1 : ${firstsn_test1}" # ++ debug |
---|
759 | if [ ! -z "${firstsn_test1}" ] |
---|
760 | then |
---|
761 | echo "www : pb on ISO-8859-15 to flat conversion" |
---|
762 | echo "www : on ${firstsn}" |
---|
763 | echo "www : trying UTF-8 to flat conversion ..." |
---|
764 | firstsn_flat=$( echo "${firstsn}" | recode -d -f UTF-8..flat ) |
---|
765 | # test if no encoding problem after UTF-8 to flat conversion |
---|
766 | firstsn_test2=$(echo "${firstsn_flat}" | tr -d "[:alpha:]" | tr -d " " | tr -d "'") |
---|
767 | #echo "firstsn_test2 : A${firstsn_test2}A" # ++ debug |
---|
768 | if [ ! -z "${firstsn_test2}" ] |
---|
769 | then |
---|
770 | echo "eee : pb on flat conversion of ${firstsn}" |
---|
771 | exit 1 |
---|
772 | fi |
---|
773 | fi |
---|
774 | firstsn_lower=$( echo "${firstsn_flat}" | tr "[:upper:]" "[:lower:]") |
---|
775 | firstsn_nopunct=$( echo "${firstsn_lower}" | tr -s " " "_" | tr -s "'" "_") |
---|
776 | refid="${firstsn_nopunct}${year}" |
---|
777 | unset firstsn_lower |
---|
778 | unset firstsn_flat |
---|
779 | unset firstsn_test1 |
---|
780 | unset firstsn_test2 |
---|
781 | num=$( grep -c "<biblioentry xml:id=\"${refid}_[0-9][0-9]\">" ${fileou} ) |
---|
782 | num=$(( ${num} + 1 )) |
---|
783 | [ ${num} -le 9 ] && num=0${num} |
---|
784 | refid=${refid}_${num} |
---|
785 | hasauthor=1 |
---|
786 | |
---|
787 | cat <<EOF >> ${fileou} |
---|
788 | <biblioentry xml:id="${refid}"> |
---|
789 | <!-- date |
---|
790 | $( date -u +"%Y%m%dT%H%M%SZ" ) |
---|
791 | --> |
---|
792 | <!-- original text |
---|
793 | ${orgline} |
---|
794 | --> |
---|
795 | EOF |
---|
796 | if [ ${hasauthor} -eq 1 ] |
---|
797 | then |
---|
798 | cat <<EOF >> ${fileou} |
---|
799 | <authorgroup> |
---|
800 | <author> <personname> <surname>${firstsn}</surname> <firstname>${firstfn}</firstname> </personname> </author> |
---|
801 | EOF |
---|
802 | |
---|
803 | ## other authors.. |
---|
804 | if [ ${bibtex} -eq 0 ] |
---|
805 | then |
---|
806 | previous=${first}, |
---|
807 | # next authors... |
---|
808 | next=${auths##*${previous}} |
---|
809 | fi |
---|
810 | if [ ${bibtex} -eq 1 ] |
---|
811 | then |
---|
812 | previous=${first}"and " |
---|
813 | # next authors... |
---|
814 | #echo "auths ${auths}" |
---|
815 | next=${auths##*${previous}} |
---|
816 | if [ "${next}and " = "${previous}" ] |
---|
817 | then |
---|
818 | next="" |
---|
819 | fi |
---|
820 | fi |
---|
821 | #echo "previous ${previous}" |
---|
822 | #echo "next ${next}" |
---|
823 | # while the next author is not empty |
---|
824 | while [ "${next}" != "" ] |
---|
825 | do |
---|
826 | if [ ${bibtex} -eq 0 ] |
---|
827 | then |
---|
828 | # get the first next author; before the first , |
---|
829 | next=${next%%,*} |
---|
830 | # its surname ; after the last . |
---|
831 | nextsn=${next##*.} |
---|
832 | nextsn=$( rmbl "${nextsn}" ) |
---|
833 | # its firstname ; before the last . |
---|
834 | nextfn=${next%.*}. |
---|
835 | nextfn=$( rmbl "${nextfn}" ) |
---|
836 | fi |
---|
837 | if [ ${bibtex} -eq 1 ] |
---|
838 | then |
---|
839 | # get the first next author; before the first "and" |
---|
840 | next=${next%%and *} |
---|
841 | # its surname after the last " " ++ pas vrai double nom et pb blanc dans la syntaxe |
---|
842 | # nextsn=${next##* } . ok en interactif . pas ok en script |
---|
843 | nextsn=$( echo ${next} | awk '{print $2}') |
---|
844 | #echo "nextsn $nextsn" |
---|
845 | # its nextname before the first " " |
---|
846 | nextfn=${next%% *} |
---|
847 | fi |
---|
848 | # |
---|
849 | echo " <author> <personname> <surname>${nextsn}</surname> <firstname>${nextfn}</firstname> </personname> </author>" >> ${fileou} |
---|
850 | #echo " <author> <personname> <surname>${nextsn}</surname> <firstname>${nextfn}</firstname> </personname> </author>" #++debug |
---|
851 | if [ ${bibtex} -eq 0 ] |
---|
852 | then |
---|
853 | previous=${next}, |
---|
854 | next=${auths##*${previous}} |
---|
855 | fi |
---|
856 | if [ ${bibtex} -eq 1 ] |
---|
857 | then |
---|
858 | previous=${next}"and " |
---|
859 | next=${auths##*${previous}} |
---|
860 | fi |
---|
861 | done |
---|
862 | echo " </authorgroup>" >> ${fileou} |
---|
863 | fi |
---|
864 | |
---|
865 | # end of the line ; after the first : |
---|
866 | endline=${line#*:} |
---|
867 | ## find the journal |
---|
868 | j=1 |
---|
869 | jfound="" |
---|
870 | jlistsize=${#jlist[@]} |
---|
871 | while [[ ${j} -le ${jlistsize} && "${jfound}" == "" ]] |
---|
872 | do |
---|
873 | ok=$( echo ${endline} | grep -ci "${jlist[j]} *," ) |
---|
874 | [ ${ok} -eq 1 ] && jfound="${jlist[j]}" |
---|
875 | j=$(( ${j} + 1 )) |
---|
876 | done |
---|
877 | unset ok |
---|
878 | if [ "${jfound}" == "" ] |
---|
879 | then |
---|
880 | echo "eee: Journal not found " |
---|
881 | echo "${endline}" |
---|
882 | # uncomment next line for debug |
---|
883 | # set # ++ debug |
---|
884 | exit 1 |
---|
885 | #+++ following lines are not yet validate |
---|
886 | # it might be a book, a manual, a conference, etc. ++ |
---|
887 | echo " <title>${title}</title>" >> ${fileou} |
---|
888 | cat <<EOF >> ${fileou} |
---|
889 | <biblioset relation="nojournal"> |
---|
890 | <title>${title}</title> |
---|
891 | <pagenums>${pag}</pagenums> |
---|
892 | <pubdate>${year}</pubdate> |
---|
893 | </biblioset> |
---|
894 | EOF |
---|
895 | cat <<EOF >> ${fileou} |
---|
896 | </biblioentry> |
---|
897 | |
---|
898 | EOF |
---|
899 | fi # end of if jfound empty (ie not an article) |
---|
900 | if [ "${jfound}" != "" ] |
---|
901 | then |
---|
902 | ## title |
---|
903 | # before the first : |
---|
904 | title=${endline%%${jfound}*} |
---|
905 | title=$( cleanname "${title}" ) |
---|
906 | echo " <title>${title}</title>" >> ${fileou} |
---|
907 | ## end |
---|
908 | ## end of the line ; after the first ${jfound} |
---|
909 | endline=${endline#*${jfound}} |
---|
910 | endline=$( cleanname "${endline}" ) |
---|
911 | ## doi |
---|
912 | endline=$( echo ${endline} | sed -e "s/[dD][oO][iI] *\t* *: *\t* */doi:/" ) |
---|
913 | #echo "endline for doi ${endline}" |
---|
914 | ok=$( echo ${endline} | grep -ic "doi:" ) |
---|
915 | if [ ${ok} -eq 1 ] |
---|
916 | then |
---|
917 | doi=${endline##*doi:} |
---|
918 | #echo "doi : $doi" |
---|
919 | echo " <biblioid class=\"doi\">${doi}</biblioid>" >> ${fileou} |
---|
920 | unset doi |
---|
921 | endline=${endline%doi:*} |
---|
922 | endline=$( cleanname "${endline}" ) |
---|
923 | else |
---|
924 | echo "non doi: ${line}" |
---|
925 | echo "" |
---|
926 | fi |
---|
927 | num=$( echo "${endline}" | tr -dc "," | wc -c | tr -d " ") |
---|
928 | case "${num}" in |
---|
929 | 0) |
---|
930 | ### echo ${num}: ${endline} |
---|
931 | cat <<EOF >> ${fileou} |
---|
932 | <biblioset relation="journal"> |
---|
933 | <title>${jfound}</title> |
---|
934 | <pubdate>${year}</pubdate> |
---|
935 | <bibliomisc>${endline}</bibliomisc> |
---|
936 | </biblioset> |
---|
937 | EOF |
---|
938 | unset jfound |
---|
939 | unset year |
---|
940 | ;; |
---|
941 | |
---|
942 | 1) |
---|
943 | ### echo ${num}: ${endline} |
---|
944 | vol=${endline%,*} |
---|
945 | vol=$( cleanname "${vol}" ) |
---|
946 | pag=${endline##*,} |
---|
947 | pag=$( cleanname "${pag}" ) |
---|
948 | cat <<EOF >> ${fileou} |
---|
949 | <biblioset relation="journal"> |
---|
950 | <title>${jfound}</title> |
---|
951 | <volumenum>${vol}</volumenum><pagenums>${pag}</pagenums> |
---|
952 | <pubdate>${year}</pubdate> |
---|
953 | </biblioset> |
---|
954 | EOF |
---|
955 | unset vol |
---|
956 | unset pag |
---|
957 | unset jfound |
---|
958 | unset year |
---|
959 | ;; |
---|
960 | 2) |
---|
961 | vol=${endline%,*} |
---|
962 | vol=$( cleanname "${vol}" ) |
---|
963 | iss=${vol##*,} |
---|
964 | iss=$( cleanname "${iss}" ) |
---|
965 | vol=${vol%,*} |
---|
966 | vol=$( cleanname "${vol}" ) |
---|
967 | pag=${endline##*,} |
---|
968 | pag=$( cleanname "${pag}" ) |
---|
969 | cat <<EOF >> ${fileou} |
---|
970 | <biblioset relation="journal"> |
---|
971 | <title>${jfound}</title> |
---|
972 | <volumenum>${vol}</volumenum><issuenum>${iss}</issuenum><pagenums>${pag}</pagenums> |
---|
973 | <pubdate>${year}</pubdate> |
---|
974 | </biblioset> |
---|
975 | EOF |
---|
976 | unset vol |
---|
977 | unset pag |
---|
978 | unset jfound |
---|
979 | unset year |
---|
980 | unset iss |
---|
981 | ;; |
---|
982 | 6) |
---|
983 | conftitle=${endline%%,*} |
---|
984 | endline=${endline#*,} |
---|
985 | confdates=${endline%%,*} # day(s) month |
---|
986 | endline=${endline#*,} |
---|
987 | confdates="${confdates}, ${endline%%,*}" # day(s) month and year |
---|
988 | confdates=$( cleanname "${confdates}" ) |
---|
989 | endline=${endline#*,} |
---|
990 | confaddress=${endline%%,*} # Town |
---|
991 | endline=${endline#*,} |
---|
992 | confaddress="${confaddress}, ${endline%%,*}" # Town and country |
---|
993 | confaddress=$( cleanname "${confaddress}" ) |
---|
994 | endline=${endline#*,} |
---|
995 | publishername=${endline%%,*} |
---|
996 | publishername=$( cleanname "${publishername}" ) |
---|
997 | endline=${endline#*,} |
---|
998 | pag=${endline##*,} |
---|
999 | pag=$( cleanname "${pag}" ) |
---|
1000 | #set |
---|
1001 | #read a |
---|
1002 | cat <<EOF >> ${fileou} |
---|
1003 | <biblioset relation="conference"> |
---|
1004 | <title>${jfound}</title> |
---|
1005 | <pubdate>${year}</pubdate> |
---|
1006 | <publisher><publishername>${publishername}</publishername></publisher> |
---|
1007 | <pagenums>${pag}</pagenums> |
---|
1008 | <confgroup> |
---|
1009 | <conftitle>${conftitle}</conftitle> |
---|
1010 | <confdates>${confdates}</confdates> |
---|
1011 | <address>${confaddress}</address> |
---|
1012 | </confgroup> |
---|
1013 | </biblioset> |
---|
1014 | EOF |
---|
1015 | unset confaddress |
---|
1016 | unset conftitle |
---|
1017 | unset confdates |
---|
1018 | unset pag |
---|
1019 | unset publishername |
---|
1020 | unset year |
---|
1021 | unset jfound |
---|
1022 | ;; |
---|
1023 | 10) |
---|
1024 | publishername=${endline%%Editors,*} |
---|
1025 | publishername="${publishername} Editors" |
---|
1026 | publishername=$( cleanname "${publishername}" ) |
---|
1027 | endline=${endline#*Editors,} |
---|
1028 | vol=${endline%%,*} |
---|
1029 | vol=$( cleanname "${vol}" ) |
---|
1030 | endline=${endline#*,} |
---|
1031 | pag=${endline%%,*} |
---|
1032 | pag=$( cleanname "${pag}" ) |
---|
1033 | endline=${endline#*,} |
---|
1034 | isbn=${endline%%,*} |
---|
1035 | isbn=$(echo ${isbn} | sed -e "s/ISBN ://") |
---|
1036 | isbn=$( cleanname "${isbn}" ) |
---|
1037 | endline=${endline#*,} |
---|
1038 | agu=${endline%%,*} |
---|
1039 | agu=$(echo ${agu} | sed -e "s/AGU ://") |
---|
1040 | agu=$( cleanname "${agu}" ) |
---|
1041 | |
---|
1042 | endline=${endline#*${agu}} |
---|
1043 | endline=$( cleanname "${endline}" ) |
---|
1044 | endline=$( cleanname "${endline}" ) |
---|
1045 | |
---|
1046 | cat <<EOF >> ${fileou} |
---|
1047 | <biblioid class="isbn">${isbn}</biblioid> |
---|
1048 | <biblioid class="other" otherclass="AGU">${agu}</biblioid> |
---|
1049 | <biblioset relation="journal"> |
---|
1050 | <title>${jfound}</title> |
---|
1051 | <pubdate>${year}</pubdate> |
---|
1052 | <publisher><publishername>${publishername}</publishername></publisher> |
---|
1053 | <volumenum>${vol}</volumenum> |
---|
1054 | <pagenums>${pag}</pagenums> |
---|
1055 | <bibliomisc>${endline}</bibliomisc> |
---|
1056 | </biblioset> |
---|
1057 | EOF |
---|
1058 | unset isbn |
---|
1059 | unset agu |
---|
1060 | unset pag |
---|
1061 | unset publishername |
---|
1062 | unset year |
---|
1063 | unset jfound |
---|
1064 | unset vol |
---|
1065 | |
---|
1066 | ;; |
---|
1067 | *) |
---|
1068 | #echo "${num}: ${endline}" # ++debug |
---|
1069 | #set # ++ debug |
---|
1070 | #exit 1 #++ debug |
---|
1071 | cat <<EOF >> ${fileou} |
---|
1072 | <biblioset relation="journal"> |
---|
1073 | <title>${jfound}</title> |
---|
1074 | <pubdate>${year}</pubdate> |
---|
1075 | <bibliomisc>${endline}</bibliomisc> |
---|
1076 | </biblioset> |
---|
1077 | EOF |
---|
1078 | ;; |
---|
1079 | esac |
---|
1080 | |
---|
1081 | cat <<EOF >> ${fileou} |
---|
1082 | </biblioentry> |
---|
1083 | |
---|
1084 | EOF |
---|
1085 | fi # end of if jfound not empty |
---|
1086 | unset title |
---|
1087 | unset vol |
---|
1088 | unset year |
---|
1089 | unset pag |
---|
1090 | l=$(( ${l} + 1 )) |
---|
1091 | |
---|
1092 | done |
---|
1093 | unset totlines |
---|
1094 | unset l |
---|
1095 | echo "</bibliography>" >> ${fileou} |
---|
1096 | ;; |
---|
1097 | esac # end of case bibtex vs other for processing |
---|
1098 | |
---|
1099 | xml val --err \ |
---|
1100 | --xsd http://www.docbook.org/xml/5.0/xsd/docbook.xsd \ |
---|
1101 | ${fileou} 1> xmlstarlet.log 2>&1 |
---|
1102 | |
---|
1103 | # clean |
---|
1104 | echo "iii : xslstarlet.log contains sdtout and stderr from xml command on ${fileou}" |
---|
1105 | echo "iii : which was done just to check consistence of ${fileou}" |
---|
1106 | more xmlstarlet.log |
---|
1107 | # |
---|
1108 | case ${type} in |
---|
1109 | raw) |
---|
1110 | echo "iii : ${fileraw_strict} contains a copy of input file without comments" |
---|
1111 | ;; |
---|
1112 | mailbody) |
---|
1113 | echo "iii : ${fileraw} contains a copy of input file" |
---|
1114 | echo "iii : ${fileraw_strict} contains a copy of input file without comments" |
---|
1115 | ;; |
---|
1116 | esac |
---|
1117 | # |
---|
1118 | echo " iii : you have a some new or modified bibliographic references in ${fileou} (biblioentry)" |
---|
1119 | echo " iii : you can add them in ${fileou}" #++ filename path |
---|
1120 | echo " iii : modify date in ${fileou}" #++ filename path |
---|
1121 | echo " iii : but please take care of id last part (after underscore) that may" |
---|
1122 | echo " 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. |
---|
1123 | # |
---|
1124 | exit 0 |
---|