Ignore:
Timestamp:
04/16/08 11:15:20 (16 years ago)
Author:
pinsard
Message:

migration from DocBook? 4 to Docbook 5 : sources and production tools

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Documentation/xmldoc/firststeps_pre.sh

    r326 r345  
    1 #!/bin/bash -x 
     1#! /bin/sh 
     2# 
     3# module : 
     4# ++ working on firststeps.xml before processing for HTML and wiki 
    25# 
    36# update : 
    47# $Id$ 
    5 # 
    6 # ++ one day we can add accessibility check with tidy with -access 3 
    7 # diagnostics are not so good so far because tidy (HTML Tidy for Mac OS X 
    8 # released on 1 September 2005) doesn't handle carriage returns 
    9 # 
    10 # fplod 2007-06-27T11:54:26Z aedon.locean-ipsl.upmc.fr (Darwin) 
    11 # replacing saxon by xalan because of better results on callouts 
    12 # fplod 2006-09-20T16:28:32Z aedon.locean-ipsl.upmc.fr (Darwin) 
    13 # remove ?format=raw 
    14 # fplod 2006-09-18T12:53:07Z aedon.locean-ipsl.upmc.fr (Darwin) 
    15 # add status checking in xml processing 
    16 # fplod 2006-09-07T08:10:23Z aedon.locean-ipsl.upmc.fr (Darwin) 
    17 # main is rename to websaxo.html 
    18 # fplod 2006-08-29T14:01:11Z aedon.locean-ipsl.upmc.fr (Darwin) 
    19 # add main which needs xmllint processing to resolve xinclude 
    20 # fplod 2006-08-18T13:38:31Z aedon.locean-ipsl.upmc.fr (Darwin) 
    21 # add faqsaxo which needs xmllint processing to resolve xinclude 
    22 # fplod 2006-07-21T08:25:05Z aedon.locean-ipsl.upmc.fr (Darwin) 
    23 # add prerequisites for mini_notice production 
    24 # fplod 2006-07-12T11:57:24Z aedon.locean-ipsl.upmc.fr (Darwin) 
    25 # add style.css 
    26 # fplod 2006-07-11T08:25:30Z aedon.locean-ipsl.upmc.fr (Darwin) 
    27 # use of tidy and titlepage.saxo.xml 
    28 # replace /sw/share/xml/xsl/docbook-xsl/html/docbook.xsl 
    29 # by saxo_html.xsl 
    30 # fplod 2006-07-05T13:18:56Z aedon.locean-ipsl.upmc.fr (Darwin) 
    31 # add infoupdatecm 
    32 # add sort and varname in production of infoupdatekwd 
    33 # fplod 2006-06-07T13:55:07Z aedon.locean-ipsl.upmc.fr (Darwin) 
    34 # add infoupdatekwd 
    35 # fplod 2006-06-02T14:37:47Z aedon.locean-ipsl.upmc.fr (Darwin) 
    36 # take only one tar file : the most recent using modification time 
    37 # fplod 2006-06-02T10:00:41Z aedon.locean-ipsl.upmc.fr (Darwin) 
    38 # http://forge.ipsl.jussieu.fr/saxo/download/ is the new directory reference 
    39 # for tar file instead of ~/SAXO_SRC/ ie home of Sebatien Masson on 
    40 # arete.locean-ipsl.jussieu.fr 
    41 # !!! saxo@forge.ipsl.jussieu.fr password is needed 
    42 # fplod 2006-05-31T10:34:18Z aedon.locean-ipsl.upmc.fr (Darwin) 
    43 # . add creation of all_plots.html using firststeps.html 
    44 # . remplace ~/SAXO_SRC/SRC/Documentation/xmldoc/figpng by ./figpng/ 
    45 # we suppose that this shell script is launched when we are in 
    46 # <working space of saxo>/SRC/Documentation/xmldoc/ 
     8# fplod 2008-04-15T10:53:26Z aedon.locean-ipsl.upmc.fr (Darwin) 
     9# creation from makehtml.sh 
     10# adapation to docbook 5.0 
    4711# 
    4812set -u 
     13set -o posix 
    4914# 
    50 case $( whoami ) in 
    51     smasson) 
    52         lgforge=smasson 
    53     ;; 
    54     floseb) 
    55         lgforge=smasson 
    56     ;; 
    57     *) 
    58         lgforge=saxo 
    59     ;; 
    60 esac 
    61 # 
    62 case "${1}" in 
    63    getsaxo) 
    64       # size of SRC and DATA with .svn 
    65       szallsvn=$( du -sh ../../.. | awk '{print $1}' ) 
    66       szallsvn=${szallsvn%*M} 
    67       # size of SRC with .svn 
    68       szsrcsvn=$( du -sh ../../../SRC | awk '{print $1}' ) 
    69       szsrcsvn=${szsrcsvn%*M} 
    70       # size of DATA with .svn 
    71       szdatasvn=$( du -sh ../../../DATA | awk '{print $1}' ) 
    72       szdatasvn=${szdatasvn%*M} 
    73       echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times" 
    74       # find the most recent SAXO_SRC_yyyymmddrxxx.tar.gz in 
    75       # /ipsl/forge/projets/saxo/download/ 
    76       infosrc=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_SRC_*.tar.gz  | head -n 1) 
    77       filesrc=$(echo ${infosrc} | awk '{print $NF}') 
    78       szsrc=$(echo ${infosrc} | awk '{print $5}') 
    79       # ndate is the date in the file SAXO_SRC_*.tar.gz 
    80       ndate=${filesrc##*_} 
    81       ndate=${ndate%.tar.gz} 
    82       # find the most recent SAXO_DATA_yyyymmddrxxx.tar.gz in 
    83       # /ipsl/forge/projets/saxo/download/ 
    84       infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1) 
    85       filedata=$(echo ${infodata} | awk '{print $NF}') 
    86       szdata=$(echo ${infodata} | awk '{print $5}') 
    87       # ndate2 is the date in the file SAXO_DATA_*.tar.gz 
    88       ndate2=${filedata##*_} 
    89       ndate2=${ndate2%.tar.gz} 
    90    ;; 
    91    infoupdatekwd) 
    92       grep "^  old = \[old, .* new = \[new" ../../ForOldVersion/updatekwd.pro | \ 
    93         sort | \ 
    94       sed -e "s/\( old = \[old, '\)\(.*\)\('\] *& new = \[new, '\)\(.*\)\('\]\)/<row><entry colname='old'><varname>\2<\/varname><\/entry> <entry colname='new'><varname>\4<\/varname><\/entry><\/row>/" > /tmp/rowskwd.xml 
    95    ;; 
    96    infoupdatecm) 
    97       grep "IF NOT key_forgetold AND n_elements(" ../../ForOldVersion/updateold.pro | \ 
    98         sort | \ 
    99       sed -e "s/\(^.* THEN \)\(.*\)\( = \)\(.*\)/<row><entry colname='old'><varname>\2<\/varname><\/entry> <entry colname='new'><varname>\4<\/varname><\/entry><\/row>/" > /tmp/rowscm.xml 
    100    ;; 
    101    mini_notice) 
    102       # production of images with frames and callouts 
    103       # ./forxxxdoc.sh 0101 
    104       # ./forxxxdoc.sh 0201 
    105    ;; 
    106    *) 
    107       echo "iii : no prerequisites needed" 
    108    ;; 
    109 esac 
    110  
    11115# figures lists 
    11216cd ./figpng 
    113  
    11417# 
    11518figsplt_lev="" 
    11619for i in tst_plt_lev_[0-9][0-9].png 
    11720do 
    118   figsplt_lev="${figsplt_lev} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     21  figsplt_lev="${figsplt_lev} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    11922done 
    12023figspltz_lev="" 
    12124for i in tst_pltz_lev_[0-9][0-9].png 
    12225do 
    123   figspltz_lev="${figspltz_lev} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     26  figspltz_lev="${figspltz_lev} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    12427done 
    12528figspltt_lev="" 
    12629for i in tst_pltt_lev_[0-9][0-9].png 
    12730do 
    128   figspltt_lev="${figspltt_lev} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     31  figspltt_lev="${figspltt_lev} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    12932done 
    13033# 
     
    13235for i in tst_plt_orca2_[0-9][0-9].png 
    13336do 
    134   figsplt_orca2="${figsplt_orca2} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     37  figsplt_orca2="${figsplt_orca2} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    13538done 
    13639figspltz_orca2="" 
    13740for i in tst_pltz_orca2_[0-9][0-9].png 
    13841do 
    139   figspltz_orca2="${figspltz_orca2} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     42  figspltz_orca2="${figspltz_orca2} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    14043done 
    14144figspltt_orca2="" 
    14245for i in tst_pltt_orca2_[0-9][0-9].png 
    14346do 
    144   figspltt_orca2="${figspltt_orca2} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     47  figspltt_orca2="${figspltt_orca2} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    14548done 
    14649# 
     
    14851for i in tst_plt_orca05_[0-9][0-9].png 
    14952do 
    150   figsplt_orca05="${figsplt_orca05} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     53  figsplt_orca05="${figsplt_orca05} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    15154done 
    15255figspltz_orca05="" 
    15356for i in tst_pltz_orca05_[0-9][0-9].png 
    15457do 
    155   figspltz_orca05="${figspltz_orca05} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     58  figspltz_orca05="${figspltz_orca05} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    15659done 
    15760figspltt_orca05="" 
    15861for i in tst_pltt_orca05_[0-9][0-9].png 
    15962do 
    160   figspltt_orca05="${figspltt_orca05} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     63  figspltt_orca05="${figspltt_orca05} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    16164done 
    16265## 
     
    16568for i in tst_plt_lev_stride_[0-9][0-9].png 
    16669do 
    167   figsplt_lev_stride="${figsplt_lev_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     70  figsplt_lev_stride="${figsplt_lev_stride} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    16871done 
    16972figspltz_lev_stride="" 
    17073for i in tst_pltz_lev_stride_[0-9][0-9].png 
    17174do 
    172   figspltz_lev_stride="${figspltz_lev_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     75  figspltz_lev_stride="${figspltz_lev_stride} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    17376done 
    17477figspltt_lev_stride="" 
    17578for i in tst_pltt_lev_stride_[0-9][0-9].png 
    17679do 
    177   figspltt_lev_stride="${figspltt_lev_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     80  figspltt_lev_stride="${figspltt_lev_stride} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    17881done 
    17982# 
     
    18184for i in tst_plt_orca2_stride_[0-9][0-9].png 
    18285do 
    183   figsplt_orca2_stride="${figsplt_orca2_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     86  figsplt_orca2_stride="${figsplt_orca2_stride} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    18487done 
    18588figspltz_orca2_stride="" 
    18689for i in tst_pltz_orca2_stride_[0-9][0-9].png 
    18790do 
    188   figspltz_orca2_stride="${figspltz_orca2_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     91  figspltz_orca2_stride="${figspltz_orca2_stride} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    18992done 
    19093figspltt_orca2_stride="" 
    19194for i in tst_pltt_orca2_stride_[0-9][0-9].png 
    19295do 
    193   figspltt_orca2_stride="${figspltt_orca2_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     96  figspltt_orca2_stride="${figspltt_orca2_stride} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    19497done 
    19598# 
     
    197100for i in tst_plt_orca05_stride_[0-9][0-9].png 
    198101do 
    199   figsplt_orca05_stride="${figsplt_orca05_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     102  figsplt_orca05_stride="${figsplt_orca05_stride} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    200103done 
    201104figspltz_orca05_stride="" 
    202105for i in tst_pltz_orca05_stride_[0-9][0-9].png 
    203106do 
    204   figspltz_orca05_stride="${figspltz_orca05_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     107  figspltz_orca05_stride="${figspltz_orca05_stride} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    205108done 
    206109figspltt_orca05_stride="" 
    207110for i in tst_pltt_orca05_stride_[0-9][0-9].png 
    208111do 
    209   figspltt_orca05_stride="${figspltt_orca05_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" 
     112  figspltt_orca05_stride="${figspltt_orca05_stride} \<link xl:href=\"figpng\/${i}\"\>\&showfig\;\<\/link\>" 
    210113done 
    211114## 
    212115cd .. # ie <working space of saxo>/SRC/Documentation/xmldoc 
    213116# 
    214 # production of titlepage.saxo.xsl 
    215 # 
    216 # si pb reseau remplacer sur mac par la ligne suivante 
    217 titlepagexsl=http://docbook.sourceforge.net/release/xsl/current/template/titlepage.xsl 
    218 titlepagexsl=/sw/share/xml/xsl/docbook-xsl/template/titlepage.xsl 
    219 # 
    220 xsltproc \ 
    221 --xinclude \ 
    222 -o titlepage.saxo.xsl \ 
    223 ${titlepagexsl} \ 
    224 titlepage.saxo.xml 
    225 status=${?} 
    226 if [ ${status} -ne 0 ] 
    227 then 
    228  echo "eee : pb xsltproc sur titlepage.saxo.xml" 
    229  exit 1 
    230 fi 
    231 # 
    232 case "${1}" in 
    233    getsaxo) 
    234       sed -e s/"\&date\;"/${ndate}/g \ 
    235           -e s/"\&date2\;"/${ndate2}/g \ 
    236           -e s/"\&szsrc\;"/${szsrc}/g \ 
    237           -e s/"\&szdata\;"/${szdata}/g \ 
    238           -e s/"\&szallsvn\;"/${szallsvn}/g \ 
    239           -e s/"\&szsrcsvn\;"/${szsrcsvn}/g \ 
    240           -e s/"\&szdatasvn\;"/${szdatasvn}/g \ 
    241           ${1}.xml > ${1}_${$}.xml 
    242    ;; 
    243    firststeps) 
    244       sed -e s/"\&figsplt_lev\;"/"${figsplt_lev}"/g \ 
    245           -e s/"\&figsplt_orca2\;"/"${figsplt_orca2}"/g \ 
    246           -e s/"\&figsplt_orca05\;"/"${figsplt_orca05}"/g \ 
    247           -e s/"\&figspltz_lev\;"/"${figspltz_lev}"/g \ 
    248           -e s/"\&figspltz_orca2\;"/"${figspltz_orca2}"/g \ 
    249           -e s/"\&figspltz_orca05\;"/"${figspltz_orca05}"/g \ 
    250           -e s/"\&figspltt_lev\;"/"${figspltt_lev}"/g \ 
    251           -e s/"\&figspltt_orca2\;"/"${figspltt_orca2}"/g \ 
    252           -e s/"\&figspltt_orca05\;"/"${figspltt_orca05}"/g \ 
    253           -e s/"\&figsplt_lev_stride\;"/"${figsplt_lev_stride}"/g \ 
    254           -e s/"\&figsplt_orca2_stride\;"/"${figsplt_orca2_stride}"/g \ 
    255           -e s/"\&figsplt_orca05_stride\;"/"${figsplt_orca05_stride}"/g \ 
    256           -e s/"\&figspltz_lev_stride\;"/"${figspltz_lev_stride}"/g \ 
    257           -e s/"\&figspltz_orca2_stride\;"/"${figspltz_orca2_stride}"/g \ 
    258           -e s/"\&figspltz_orca05_stride\;"/"${figspltz_orca05_stride}"/g \ 
    259           -e s/"\&figspltt_lev_stride\;"/"${figspltt_lev_stride}"/g \ 
    260           -e s/"\&figspltt_orca2_stride\;"/"${figspltt_orca2_stride}"/g \ 
    261           -e s/"\&figspltt_orca05_stride\;"/"${figspltt_orca05_stride}"/g \ 
    262           ${1}.xml > ${1}_${$}.xml 
    263    ;; 
    264    infoupdatekwd) 
    265       sed -e "/-- rows from updatekwd.pro --/r /tmp/rowskwd.xml" \ 
    266           ${1}.xml > ${1}_${$}.xml 
    267       /bin/rm /tmp/rowskwd.xml 
    268    ;; 
    269    infoupdatecm) 
    270       sed -e "/-- rows from updateold.pro --/r /tmp/rowscm.xml" \ 
    271           ${1}.xml > ${1}_${$}.xml 
    272       /bin/rm /tmp/rowscm.xml 
    273    ;; 
    274    faqsaxo|websaxo) 
    275       # resolve xinclude 
    276       xmllint --xinclude \ 
    277               --output ${1}_${$}.xml ${1}.xml 
    278       status=${?} 
    279       if [ ${status} -ne 0 ] 
    280       then 
    281        echo "eee : pb xmllint sur ${1}.xml" 
    282        exit 1 
    283       fi 
    284    ;; 
    285    *) 
    286       cp ${1}.xml ${1}_${$}.xml 
    287       echo "iii : no xml transformation needed" 
    288    ;; 
    289 esac 
    290 # 
    291 CLASSPATH=${CLASSPATH}:/usr/Xalan/xalan.jar:/usr/Xalan/xml-apis.jar:\ 
    292 /usr/Xalan/xercesImpl.jar:/usr/docbook-xsl/extensions/xalan25.jar 
    293 export CLASSPATH 
    294 # 
    295 java org.apache.xalan.xslt.Process -out ${1}.html -in ${1}_${$}.xml  \ 
    296 -xsl saxo_html.xsl \ 
    297 -param section.autolabel 1 \ 
    298 -param html.stylesheet "style.css saxo.css" \ 
    299 -param css.decoration 1 
    300 status=${?} 
    301 if [ ${status} -ne 0 ] 
    302 then 
    303  echo "eee : pb xalan sur ${1}_${$}.xml" 
    304  exit 1 
    305 fi 
    306 # 
    307 case "${1}" in 
    308    firststeps) 
    309       # process all_plots 
    310       java org.apache.xalan.xslt.Process -out all_plots_${$}.xml \ 
    311       -in  ${1}_${$}.xml  \ 
    312       -xsl all_plots_docbook.xsl 
    313       java org.apache.xalan.xslt.Process -out all_plots.html \ 
    314       -in  all_plots_${$}.xml \ 
    315       -xsl saxo_html.xsl \ 
    316       -param section.autolabel 1 \ 
    317       -param html.stylesheet "style.css saxo.css" \ 
    318       -param css.decoration 1 
    319       rm -f all_plots_${$}.xml 
    320       ;; 
    321    websaxo) 
    322       sed -e s?"../../saxo/browser/trunk/SRC/Documentation/xmldoc/"??g \ 
    323           -e s?"../../saxo/browser/trunk/SRC/Documentation/idldoc_html_output/"?"../idldoc_html_output/"?g \ 
    324           -e s?"../../saxo/browser/trunk"?"http://forge.ipsl.jussieu.fr/saxo/browser/trunk"?g \ 
    325           ${1}.html > ${1}_${$}.html 
    326       mv ${1}_${$}.html ${1}.html 
    327       ;; 
    328 esac 
    329 # 
    330 # use of tidy to have a W3C compliant html file 
    331 tidy -m ${1}.html 
    332 # 
    333 # clean 
    334 rm -f ${1}_${$}.xml 
    335 rm titlepage.saxo.xsl 
     117rm firststeps_sed.xml 2> /dev/null 
     118sed -e s/"\&figsplt_lev\;"/"${figsplt_lev}"/g \ 
     119-e s/"\&figsplt_orca2\;"/"${figsplt_orca2}"/g \ 
     120-e s/"\&figsplt_orca05\;"/"${figsplt_orca05}"/g \ 
     121-e s/"\&figspltz_lev\;"/"${figspltz_lev}"/g \ 
     122-e s/"\&figspltz_orca2\;"/"${figspltz_orca2}"/g \ 
     123-e s/"\&figspltz_orca05\;"/"${figspltz_orca05}"/g \ 
     124-e s/"\&figspltt_lev\;"/"${figspltt_lev}"/g \ 
     125-e s/"\&figspltt_orca2\;"/"${figspltt_orca2}"/g \ 
     126-e s/"\&figspltt_orca05\;"/"${figspltt_orca05}"/g \ 
     127-e s/"\&figsplt_lev_stride\;"/"${figsplt_lev_stride}"/g \ 
     128-e s/"\&figsplt_orca2_stride\;"/"${figsplt_orca2_stride}"/g \ 
     129-e s/"\&figsplt_orca05_stride\;"/"${figsplt_orca05_stride}"/g \ 
     130-e s/"\&figspltz_lev_stride\;"/"${figspltz_lev_stride}"/g \ 
     131-e s/"\&figspltz_orca2_stride\;"/"${figspltz_orca2_stride}"/g \ 
     132-e s/"\&figspltz_orca05_stride\;"/"${figspltz_orca05_stride}"/g \ 
     133-e s/"\&figspltt_lev_stride\;"/"${figspltt_lev_stride}"/g \ 
     134-e s/"\&figspltt_orca2_stride\;"/"${figspltt_orca2_stride}"/g \ 
     135-e s/"\&figspltt_orca05_stride\;"/"${figspltt_orca05_stride}"/g \ 
     136firststeps.xml > firststeps_sed.xml 
    336137# 
    337138# exit 
Note: See TracChangeset for help on using the changeset viewer.