- Timestamp:
- 03/13/08 14:23:35 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bibopa.sh
r46 r47 55 55 # 56 56 # example : 57 # $ ./bibopa.sh - i data/biball.txt -t raw58 # $ ./bibopa.sh - i data/mail2007-04-25T08:58:16Z.txt -t mailbody59 # $ ./bibopa.sh - i data/petitpolyfp.bib -t bibtex57 # $ ./bibopa.sh -p birefnemo -i data/biball.txt -t raw 58 # $ ./bibopa.sh -p bibrefnemo -i data/mail2007-04-25T08:58:16Z.txt -t mailbody 59 # $ ./bibopa.sh -p polyfortran -i data/petitpolyfp.bib -t bibtex -l fr 60 60 # 61 61 # see also mailtouser.sh … … 69 69 # ++ option debug 70 70 # $Id$ 71 # fplod 2008-03-12T16:11:07Z aedon.locean-ipsl.upmc.fr (Darwin) 72 # add -p option (to overide bibrefnemo in file name and id) 73 # add -l option by default en 71 74 # fplod 2008-03-11T11:25:27Z aedon.locean-ipsl.upmc.fr (Darwin) 72 75 # add bibtex entry (not finished)++ … … 111 114 fi 112 115 # 113 usage=" Usage : ${command} -i filein -t type" 114 # 115 minargcount=4 116 usage=" Usage : ${command} -i filein -t type -p project -l lang" 117 # 118 # default 119 lang=en 120 # 121 minargcount=6 116 122 echo " narg ${#}" 117 123 if [ ${#} -lt ${minargcount} ] 118 124 then 119 echo "eee : not enought arguments"120 echo "${usage}"121 exit 1125 echo "eee : not enought arguments" 126 echo "${usage}" 127 exit 1 122 128 fi 123 129 # … … 131 137 -t) # type 132 138 type=${2} 139 shift 140 ;; 141 -p) 142 project=${2} 143 shift 144 ;; 145 -l) 146 lang=${2} 133 147 shift 134 148 ;; … … 150 164 if [ ! -f ${filein} ] 151 165 then 152 echo "eee : ${filein} not found"153 exit 1166 echo "eee : ${filein} not found" 167 exit 1 154 168 fi 155 169 # … … 274 288 <!DOCTYPE bibliography PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" 275 289 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> 276 <bibliography id="bib refnemo" lang="en">290 <bibliography id="bib${project}ref" lang="${lang}"> 277 291 <bibliographyinfo> 278 292 <date>$( date -u +"%Y-%m-%dT%H:%M:%SZ" )</date> … … 322 336 # parsing bibtex line 323 337 bibtex=1 324 # ++325 338 # before the first , 326 339 tmp=${line%%,*} … … 329 342 refid=${tmp#*{} 330 343 # ++ test if refid already exist 331 auths=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(author * = *{\)\(.*\)\(}\)/\2/") 332 echo "auths $auths" # genre Michael Metcalf and John Reid and Malcolm Cohen 344 # check if author field is there 345 echo ${endline} | grep -q "author" 346 hasauthor=${?} 347 if [ ${hasauthor} -eq 0 ] 348 then 349 auths=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(author * = *{\)\(.*\)\(}\)/\2/") 350 echo "auths $auths" # genre Michael Metcalf and John Reid and Malcolm Cohen 351 else 352 echo "pas d'auteurs" # ++ 353 fi 333 354 endline=${endline#*,} 334 355 title=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(title * = *{\)\(.*\)\(}\)/\2/") … … 338 359 endline=${endline#*,} 339 360 publisher=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(publisher * = *{\)\(.*\)\(}\)/\2/") 340 341 ## first author before the first and 342 first=${auths%%and*} 343 # its surname after the last " " ++ pas vrai double nom et pb blanc dans la syntaxe 344 # firstsn=${first##* } . ok en interactif . pas ok en script 345 firstsn=$( echo ${first} | awk '{print $2}') 346 echo "firstsn $firstsn" 347 # its firstname before the first " " 348 firstfn=${first%% *} 361 endline=${endline#*,} 362 edition=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(edition * = *{\)\(.*\)\(}\)/\2/") 363 endline=${endline#*,} 364 isbn=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(isbn * = *{\)\(.*\)\(}\)/\2/") 365 endline=${endline#*,} 366 pag=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(page * = *{\)\(.*\)\(}\)/\2/") 367 368 if [ ${hasauthor} -eq 1 ] 369 then 370 ## first author before the first and 371 first=${auths%%and*} 372 # its surname after the last " " ++ pas vrai double nom et pb blanc dans la syntaxe 373 # firstsn=${first##* } . ok en interactif . pas ok en script 374 firstsn=$( echo ${first} | awk '{print $2}') 375 echo "firstsn $firstsn" 376 # its firstname before the first " " 377 firstfn=${first%% *} 378 fi 349 379 fi 350 380 … … 357 387 ${orgline} 358 388 --> 389 EOF 390 if [ ${hasauthor} -eq 1 ] 391 then 392 cat <<EOF >> ${fileou} 359 393 <authorgroup> 360 394 <author> <personname> <surname>${firstsn}</surname> <firstname>${firstfn}</firstname> </personname> </author> … … 378 412 next="" 379 413 fi 380 read a381 414 fi 382 415 echo "previous ${previous}" … … 400 433 # get the first next author; before the first "and" 401 434 next=${next%%and *} 402 echo "next 2= ${next}"403 read a404 405 435 # its surname after the last " " ++ pas vrai double nom et pb blanc dans la syntaxe 406 436 # nextsn=${next##* } . ok en interactif . pas ok en script … … 425 455 done 426 456 echo " </authorgroup>" >> ${fileou} 457 fi 427 458 428 459 # end of the line ; after the first : … … 443 474 echo "eee: Journal not found " 444 475 echo "${endline}" 445 exit 446 fi 476 exit 1 477 #+++ following lines are not yet validate 478 # it might be a book, a manual, a conference, etc. ++ 479 echo " <title>${title}</title>" >> ${fileou} 480 echo " <biblioid class=\"isbn\">${isbn}</biblioid>" >> ${fileou} 481 cat <<EOF >> ${fileou} 482 <biblioset relation="nojournal"> 483 <title>${title}</title> 484 <pagenums>${pag}</pagenums> 485 <pubdate>${year}</pubdate> 486 </biblioset> 487 EOF 488 cat <<EOF >> ${fileou} 489 </biblioentry> 490 491 EOF 492 fi # end of if jfound empty (ie not an article) 493 if [ "${jfound}" != "" ] 494 then 447 495 ## title 448 496 # before the first : … … 519 567 520 568 521 569 fi # end of if jfound not empty 522 570 l=$(( ${l} + 1 )) 523 571 … … 551 599 # 552 600 echo " iii : you have a some new or modified bibliographic references in ${fileou} (biblioentry)" 553 echo " iii : you can add them in bibrefnemo.xml" #++ filename path554 echo " iii : modify date in bibrefnemo.xml" #++ filename path601 echo " iii : you can add them in ${fileou}" #++ filename path 602 echo " iii : modify date in ${fileou}" #++ filename path 555 603 echo " iii : but please take care of id last part (after underscore) that may" 556 604 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.
Note: See TracChangeset
for help on using the changeset viewer.