Changeset 67
- Timestamp:
- 05/16/08 12:24:13 (16 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/biblioentry_xml.xsl
r66 r67 13 13 update : 14 14 $Id$ 15 fplod 2008-05-15T09:18:54Z aedon.locean-ipsl.upmc.fr (Darwin) 16 correction on separators between authors for bibtex 15 17 fplod 2008-05-14T08:51:10Z aedon.locean-ipsl.upmc.fr (Darwin) 16 18 introducting bibtex (latex) output … … 24 26 add category choices 25 27 fplod 2008-04-29T15:41:56Z aedon.locean-ipsl.upmc.fr (Darwin) 26 chgt for dbk5 in 28 chgt for dbk5 in 27 29 fplod 2008-04-29T09:10:31Z aedon.locean-ipsl.upmc.fr (Darwin) 28 30 chgt for dbk5 out … … 37 39 factorisation de biblioentry 38 40 fplod 2007-05-14T15:48:04Z aedon.locean-ipsl.upmc.fr (Darwin) 39 correction to add biblioentry/date (replace biblioentry/biblioset/pubdate) 41 correction to add biblioentry/date (replace biblioentry/biblioset/pubdate) 40 42 when "in press" 41 43 fplod 2007-05-04T07:59:34Z aedon.locean-ipsl.upmc.fr (Darwin) … … 258 260 259 261 <xsl:template match="d:authorgroup" mode="raw"> 260 <xsl:apply-templates select="d:author" />261 <xsl:apply-templates select="d:corpauthor" />262 <xsl:apply-templates select="d:author" mode="raw"/> 263 <xsl:apply-templates select="d:corpauthor" mode="raw"/> 262 264 </xsl:template> 263 265 … … 265 267 <xsl:text>, </xsl:text> 266 268 <xsl:text>author = {</xsl:text> 267 <xsl:apply-templates select="d:author" />268 <xsl:apply-templates select="d:corpauthor" />269 <xsl:text>} 270 </xsl:template> 271 272 <xsl:template match="d:author ">269 <xsl:apply-templates select="d:author" mode="bibtex"/> 270 <xsl:apply-templates select="d:corpauthor" mode="bibtex"/> 271 <xsl:text>}</xsl:text> 272 </xsl:template> 273 274 <xsl:template match="d:author|d:corpauthor" mode="raw"> 273 275 <!-- 274 276 1er auteur Nom, prénom les autres Prenom Nom … … 327 329 </xsl:template> 328 330 329 <xsl:template match="d:corpauthor"> 330 <!-- 331 une virgule entre les auteurs sauf entre les deux derniers 331 <xsl:template match="d:author|d:corpauthor" mode="bibtex"> 332 <!-- 333 1er auteur Nom prénom les autres Prenom Nom 334 and entre les auteurs 335 --> 336 <xsl:value-of select="d:personname/d:firstname"/><xsl:text> </xsl:text> 337 <xsl:value-of select="d:personname/d:surname"/> 338 339 <!-- 340 and entre les auteurs 332 341 --> 333 342 <xsl:choose> 334 <xsl:when test="count(following-sibling::*) > 1"> <!-- plusieurs suivants --> 335 <xsl:text>, </xsl:text> 336 </xsl:when> 337 <xsl:when test="count(following-sibling::*) = 1"> 338 <xsl:text> and </xsl:text> <!-- un suivant --> 343 <xsl:when test="count(following-sibling::*) > 0"> <!-- un suivant--> 344 <xsl:text> and </xsl:text> 339 345 </xsl:when> 340 346 </xsl:choose> 341 <xsl:value-of select="normalize-space(.)"/>342 347 </xsl:template> 343 348 … … 361 366 <xsl:text>, journal = {</xsl:text> 362 367 <xsl:value-of select="normalize-space(.)"/> 363 <xsl:text>} 368 <xsl:text>}</xsl:text> 364 369 </xsl:template> 365 370 … … 370 375 371 376 <xsl:template match="d:biblioset[@relation='conference']/d:title" mode="bibtex"> 372 <xsl:text>, inproceedings= {</xsl:text>373 <xsl:value-of select="normalize-space(.)"/> 374 <xsl:text>} 377 <xsl:text>, booktitle = {</xsl:text> 378 <xsl:value-of select="normalize-space(.)"/> 379 <xsl:text>}</xsl:text> 375 380 </xsl:template> 376 381 … … 383 388 <xsl:text>, publisher = {</xsl:text> 384 389 <xsl:value-of select="normalize-space(.)"/> 385 <xsl:text>} 390 <xsl:text>}</xsl:text> 386 391 </xsl:template> 387 392 … … 393 398 <xsl:template match="d:pubdate" mode="bibtex"> 394 399 <xsl:text>, year = {</xsl:text> 395 <xsl:value-of select="normalize-space(.)"/> 396 <xsl:text>} 400 <xsl:value-of select="normalize-space(.)"/> 401 <xsl:text>}</xsl:text> 397 402 </xsl:template> 398 403 399 404 <xsl:template match="d:date"> 400 405 <xsl:message terminate="no"> 401 eee : date 406 eee : date 402 407 <xsl:value-of select="normalize-space(.)"/> exists in node 403 408 <xsl:value-of select="ancestor::d:biblioentry/@xml:id"/> … … 413 418 <xsl:template match="d:volumenum" mode="bibtex"> 414 419 <xsl:text>, volume = {</xsl:text> 415 <xsl:value-of select="normalize-space(.)"/> 416 <xsl:text>} 420 <xsl:value-of select="normalize-space(.)"/> 421 <xsl:text>}</xsl:text> 417 422 </xsl:template> 418 423 … … 424 429 <xsl:template match="d:issuenum" mode="bibtex"> 425 430 <xsl:text>, number = {</xsl:text> 426 <xsl:value-of select="normalize-space(.)"/> 427 <xsl:text>} 431 <xsl:value-of select="normalize-space(.)"/> 432 <xsl:text>}</xsl:text> 428 433 </xsl:template> 429 434 … … 436 441 <xsl:text>, pages = {</xsl:text> 437 442 <xsl:value-of select="normalize-space(.)"/> 438 <xsl:text>} 443 <xsl:text>}</xsl:text> 439 444 </xsl:template> 440 445 … … 447 452 <xsl:text>, isbn = {</xsl:text> 448 453 <xsl:value-of select="normalize-space(.)"/> 449 <xsl:text>} 454 <xsl:text>}</xsl:text> 450 455 </xsl:template> 451 456 … … 463 468 <xsl:text> : </xsl:text> 464 469 <xsl:value-of select="normalize-space(.)"/> 465 <xsl:text>} 470 <xsl:text>}</xsl:text> 466 471 </xsl:template> 467 472 468 473 <xsl:template match="d:biblioid[@class='doi']" mode="bibtex"> 469 <xsl:message terminate="no">470 BBBB471 </xsl:message>472 474 <xsl:choose> 473 475 <xsl:when test=". = '???'"> 474 <xsl:message> iii : no doi found for 476 <xsl:message> iii : no doi found for 475 477 <xsl:value-of select="ancestor::d:biblioentry/@xml:id"/> 476 478 </xsl:message> … … 483 485 </xsl:otherwise> 484 486 </xsl:choose> 485 <xsl:text>} 487 <xsl:text>}</xsl:text> 486 488 </xsl:template> 487 489 … … 532 534 <xsl:text>, address = {</xsl:text> 533 535 <xsl:value-of select="normalize-space(.)"/> 534 <xsl:text>} 536 <xsl:text>}</xsl:text> 535 537 </xsl:template> 536 538 … … 539 541 <xsl:when test="@class='doi'"> 540 542 <xsl:apply-templates select="." mode="bibtex"/> 541 <xsl:message terminate="no">542 AAAA <xsl:value-of select="normalize-space(.)"/>543 </xsl:message>544 543 </xsl:when> 545 544 <xsl:when test="@class='isbn'"> … … 548 547 <xsl:when test="@class='other'"> 549 548 <xsl:apply-templates select="." mode="bibtex"/> 550 <xsl:message terminate="no">551 CCCC <xsl:value-of select="normalize-space(.)"/>552 </xsl:message>553 549 </xsl:when> 554 550 <xsl:otherwise> … … 584 580 <xsl:text>, note = {</xsl:text> 585 581 <xsl:value-of select="normalize-space(.)"/> 586 <xsl:text>} 582 <xsl:text>}</xsl:text> 587 583 </xsl:when> 588 584 <xsl:otherwise> … … 593 589 <xsl:text>, note = {</xsl:text> 594 590 <xsl:value-of select="normalize-space(.)"/> 595 <xsl:text>} 591 <xsl:text>}</xsl:text> 596 592 </xsl:otherwise> 597 593 </xsl:choose> -
trunk/bibopa.sh
r66 r67 70 70 # ++ option debug 71 71 # $Id$ 72 # fplod 2008-05-15T15:15:04Z aedon.locean-ipsl.upmc.fr (Darwin) 73 # new way of processing bibtex file : external/bibtex2xml.py 72 74 # fplod 2008-04-30T07:11:58Z aedon.locean-ipsl.upmc.fr (Darwin) 73 75 # chgt for dbk5 out … … 191 193 raw) # file like data/biball.txt 192 194 fileraw=${filein} 195 fileou=$( basename ${filein} .txt).xml 193 196 ;; 194 197 mailbody) # file like data/mail2007-04-25T08:58:16Z.txt 195 198 fileraw=/tmp/$(basename ${filein}).raw 199 fileou=$( basename ${filein} .txt).xml 196 200 echo "# from ${filein}" > ${fileraw} 197 201 echo "# ${log_date}" >> ${fileraw} … … 206 210 bibtex) # file like data/petitpoly.bib 207 211 fileraw=/tmp/$(basename ${filein}).raw 208 awk -f join_endcomma.awk ${filein} >> ${fileraw} 209 #more ${fileraw} # ++ if debug 210 #read a #++ if debug 212 awk -f join_endcomma.awk ${filein} > ${fileraw} 213 fileou=$( basename ${filein} .bib).xml 211 214 ;; 212 215 *) … … 217 220 # 218 221 # check for output 219 fileou=$( basename ${filein} .txt).xml220 222 if [ -f ${fileou} ] 221 223 then … … 401 403 jlist[$ij]="Amer. J. music. Deciency" 402 404 # 405 # 406 # strip comments 407 fileraw_strict=/tmp/$(basename ${fileraw})_strict 408 grep -v "^#" ${fileraw} | grep -v "^%" > ${fileraw_strict} 409 case ${type} in 410 bibtex) 411 fileou_bibtexml=/tmp/$(basename ${fileraw})_bibtexml 412 python ./external/bibtex2xml.py ${fileraw_strict} > ${fileou_bibtexml} 413 xsltproc --output ${fileou} \ 414 --param lang "'${lang}'" \ 415 --param project "'${project}'" \ 416 --param makedate "'${log_date}'" \ 417 bibtexml2dbk.xsl ${fileou_bibtexml} 418 #++ firstname surname 419 rm ${fileou_bibtexml} 420 ;; 421 *) 403 422 cat <<EOF > ${fileou} 404 423 <?xml version='1.0' encoding='ISO-8859-1'?> … … 410 429 411 430 <info> 412 <date>$ ( date -u +"%Y-%m-%dT%H:%M:%SZ" )</date>431 <date>${log_date}<date> 413 432 </info> 414 433 EOF 415 unset lang416 #417 # strip comments418 fileraw_strict=/tmp/$(basename ${fileraw})_strict419 grep -v "^#" ${fileraw} | grep -v "^%" > ${fileraw_strict}420 434 totlines=$( wc -l ${fileraw_strict} | awk '{print $1}' ) 421 435 l=1 … … 426 440 orgline=$( echo ${line} | sed -e "s/--/- -/g" ) 427 441 line=$( echo ${line} | sed -e "s/</\</g" -e "s/>/\>/g" ) 428 # detect if bibtex or not bibtex (starting with @)429 if [ ${line:0:1} != "@" ]430 then431 442 # parsing non bibtex line 432 443 bibtex=0 … … 457 468 refid=${refid}_${num} 458 469 hasauthor=1 459 else460 # parsing bibtex line461 bibtex=1462 # before the first ,463 tmp=${line%%,*}464 endline=${line#*,}465 # refid is after { and before the first comma466 refid=${tmp#*{}467 # ++ test if refid already exist468 # check if author field is there469 echo ${endline} | grep -q "author"470 hasauthor=${?}471 if [ ${hasauthor} -eq 0 ]472 then473 auths=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(author * = *{\)\(.*\)\(}\)/\2/")474 #echo "auths $auths" # genre Michael Metcalf and John Reid and Malcolm Cohen475 else476 echo "pas d'auteurs" # ++477 fi478 endline=${endline#*,}479 title=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(title * = *{\)\(.*\)\(}\)/\2/")480 #echo "title : ${title}"481 endline=${endline#*,}482 #echo ${endline} | awk -F "," '{print $1}' #++debug483 year=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(year * = *{\)\(.*\)\(}\)/\2/")484 endline=${endline#*,}485 publisher=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(publisher * = *{\)\(.*\)\(}\)/\2/")486 endline=${endline#*,}487 edition=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(edition * = *{\)\(.*\)\(}\)/\2/")488 endline=${endline#*,}489 isbn=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(isbn * = *{\)\(.*\)\(}\)/\2/")490 endline=${endline#*,}491 pag=$( echo ${endline} | awk -F "," '{print $1}' | sed -e "s/\(page * = *{\)\(.*\)\(}\)/\2/")492 493 if [ ${hasauthor} -eq 1 ]494 then495 ## first author before the first and496 first=${auths%%and*}497 # its surname after the last " " ++ pas vrai double nom et pb blanc dans la syntaxe498 # firstsn=${first##* } . ok en interactif . pas ok en script499 firstsn=$( echo ${first} | awk '{print $2}')500 #echo "firstsn $firstsn"501 # its firstname before the first " "502 firstfn=${first%% *}503 fi504 fi505 470 506 471 cat <<EOF >> ${fileou} … … 599 564 echo "eee: Journal not found " 600 565 echo "${endline}" 601 #++set602 #++exit 1566 set 567 exit 1 603 568 #+++ following lines are not yet validate 604 569 # it might be a book, a manual, a conference, etc. ++ … … 810 775 unset l 811 776 echo "</bibliography>" >> ${fileou} 777 ;; 778 esac # end of case bibtex vs other for processing 812 779 813 780 xml val --err \ -
trunk/makefile
r66 r67 178 178 -@rm -fr $(DIRWWW)/ 179 179 -@rm -f $(DIRTMP)/bibdemo1_dbk5_1.txt 180 -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.txt 180 -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.bib 181 -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.tex 181 182 -@rm -f $(DIRTMP)/bibdemo1_dbk5_1.xml 182 183 -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.xml 183 -@rm -f $(DIRTMP)/bibdemo1_dbk5.bib 184 -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.bbl 185 -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.blg 186 -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.out 187 -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.aux 188 -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.dvi 189 -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.log 184 190 -@rm -f $(DIRTMP)/bibnemo1.xml 185 191 -@rm -f $(DIRTMP)/bibnemo1.txt … … 553 559 test_raw_demo1_1 \ 554 560 test_raw_demo1_2 \ 561 test_raw_demo1_2_tex \ 555 562 test_raw_nemo1 \ 556 563 test_raw_nemoall … … 560 567 $(DIRTMP)/bibdemo1_dbk5_1.xml \ 561 568 $(DIRTMP)/bibdemo1_dbk5_1.txt 569 @echo "test from xml to xml via raw form" 562 570 diff -b $(DIRTMP)/bibdemo1_dbk5_1.xml $(DIRSRC)/data/bibdemo1_dbk5.xml | more 563 571 rm -i $(DIRTMP)/bibdemo1_dbk5_1.xml $(DIRTMP)/bibdemo1_dbk5_1.txt … … 577 585 $(DIRSRC)/bibopa.sh -p demo1 -i $(DIRTMP)/bibdemo1_dbk5_1.txt -t raw -l fr 578 586 587 test_raw_demo1_2_tex : \ 588 $(DIRTMP)/bibdemo1_dbk5_2.dvi 589 @echo "test from xml to latex via bibtex form" 590 591 $(DIRTMP)/bibdemo1_dbk5_2.dvi : \ 592 $(DIRTMP)/bibdemo1_dbk5_2.tex \ 593 $(DIRTMP)/bibdemo1_dbk5_2.bib 594 cd $(DIRTMP)/ 595 latex bibdemo1_dbk5_2 596 bibtex bibdemo1_dbk5_2 597 latex bibdemo1_dbk5_2 598 599 $(DIRTMP)/bibdemo1_dbk5_2.tex : \ 600 $(DIRSRC)/data/superbib01.tex 601 @sed -e "s/bibliography{superbib01}/bibliography{bibdemo1_dbk5_2}/" \ 602 $(DIRSRC)/data/superbib01.tex > $(DIRTMP)/bibdemo1_dbk5_2.tex 603 579 604 test_raw_demo1_2 : \ 580 605 $(DIRSRC)/data/bibdemo1_dbk5.xml \ 581 606 $(DIRTMP)/bibdemo1_dbk5_2.xml \ 582 $(DIRTMP)/bibdemo1_dbk5_2.txt 607 $(DIRTMP)/bibdemo1_dbk5_2.bib 608 @echo "test from xml to xml via bibtex form" 583 609 diff -b $(DIRTMP)/bibdemo1_dbk5_2.xml $(DIRSRC)/data/bibdemo1_dbk5.xml | more 584 rm -i $(DIRTMP)/bibdemo1_dbk5_2.xml $(DIRTMP)/bibdemo1_dbk5_2. txt585 586 $(DIRTMP)/bibdemo1_dbk5_2. txt: \610 rm -i $(DIRTMP)/bibdemo1_dbk5_2.xml $(DIRTMP)/bibdemo1_dbk5_2.bib 611 612 $(DIRTMP)/bibdemo1_dbk5_2.bib : \ 587 613 $(DIRSRC)/data/bibdemo1_dbk5.xml \ 588 614 $(DIRSRC)/superbib02_txt.xsl \ … … 594 620 595 621 $(DIRTMP)/bibdemo1_dbk5_2.xml : \ 596 $(DIRTMP)/bibdemo1_dbk5_2. txt\622 $(DIRTMP)/bibdemo1_dbk5_2.bib \ 597 623 $(DIRSRC)/bibopa.sh 598 $(DIRSRC)/bibopa.sh -p demo1 -i $(DIRTMP)/bibdemo1_dbk5_2. txt-t bibtex -l fr624 $(DIRSRC)/bibopa.sh -p demo1 -i $(DIRTMP)/bibdemo1_dbk5_2.bib -t bibtex -l fr 599 625 600 626 test_raw_nemo1 : \
Note: See TracChangeset
for help on using the changeset viewer.