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