source: trunk/SRC/Documentation/xmldoc/makehtml.sh @ 376

Last change on this file since 376 was 345, checked in by pinsard, 16 years ago

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

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 11.6 KB
RevLine 
[161]1#!/bin/bash -x
[85]2#
[255]3# update :
[123]4# $Id$
[139]5#
6# ++ one day we can add accessibility check with tidy with -access 3
[255]7# diagnostics are not so good so far because tidy (HTML Tidy for Mac OS X
[139]8# released on 1 September 2005) doesn't handle carriage returns
9#
[345]10# fplod 2008-04-16T09:02:05Z aedon.locean-ipsl.upmc.fr (Darwin)
11# this file is not used anymore. see makefile.
[255]12# fplod 2007-06-27T11:54:26Z aedon.locean-ipsl.upmc.fr (Darwin)
13# replacing saxon by xalan because of better results on callouts
[188]14# fplod 2006-09-20T16:28:32Z aedon.locean-ipsl.upmc.fr (Darwin)
15# remove ?format=raw
[183]16# fplod 2006-09-18T12:53:07Z aedon.locean-ipsl.upmc.fr (Darwin)
[185]17# add status checking in xml processing
[170]18# fplod 2006-09-07T08:10:23Z aedon.locean-ipsl.upmc.fr (Darwin)
19# main is rename to websaxo.html
[164]20# fplod 2006-08-29T14:01:11Z aedon.locean-ipsl.upmc.fr (Darwin)
21# add main which needs xmllint processing to resolve xinclude
[161]22# fplod 2006-08-18T13:38:31Z aedon.locean-ipsl.upmc.fr (Darwin)
23# add faqsaxo which needs xmllint processing to resolve xinclude
[144]24# fplod 2006-07-21T08:25:05Z aedon.locean-ipsl.upmc.fr (Darwin)
25# add prerequisites for mini_notice production
[139]26# fplod 2006-07-12T11:57:24Z aedon.locean-ipsl.upmc.fr (Darwin)
27# add style.css
28# fplod 2006-07-11T08:25:30Z aedon.locean-ipsl.upmc.fr (Darwin)
29# use of tidy and titlepage.saxo.xml
[255]30# replace /sw/share/xml/xsl/docbook-xsl/html/docbook.xsl
[139]31# by saxo_html.xsl
[123]32# fplod 2006-07-05T13:18:56Z aedon.locean-ipsl.upmc.fr (Darwin)
33# add infoupdatecm
34# add sort and varname in production of infoupdatekwd
[92]35# fplod 2006-06-07T13:55:07Z aedon.locean-ipsl.upmc.fr (Darwin)
36# add infoupdatekwd
[86]37# fplod 2006-06-02T14:37:47Z aedon.locean-ipsl.upmc.fr (Darwin)
[255]38# take only one tar file : the most recent using modification time
[85]39# fplod 2006-06-02T10:00:41Z aedon.locean-ipsl.upmc.fr (Darwin)
[255]40# http://forge.ipsl.jussieu.fr/saxo/download/ is the new directory reference
41# for tar file instead of ~/SAXO_SRC/ ie home of Sebatien Masson on
[291]42# arete.locean-ipsl.jussieu.fr
[85]43# !!! saxo@forge.ipsl.jussieu.fr password is needed
[79]44# fplod 2006-05-31T10:34:18Z aedon.locean-ipsl.upmc.fr (Darwin)
45# . add creation of all_plots.html using firststeps.html
[87]46# . remplace ~/SAXO_SRC/SRC/Documentation/xmldoc/figpng by ./figpng/
[255]47# we suppose that this shell script is launched when we are in
[79]48# <working space of saxo>/SRC/Documentation/xmldoc/
49#
[65]50set -u
[79]51#
[100]52case $( whoami ) in
53    smasson)
54        lgforge=smasson
55    ;;
56    floseb)
57        lgforge=smasson
58    ;;
59    *)
60        lgforge=saxo
61    ;;
62esac
63#
[79]64case "${1}" in
[84]65   getsaxo)
[183]66      # size of SRC and DATA with .svn
[87]67      szallsvn=$( du -sh ../../.. | awk '{print $1}' )
68      szallsvn=${szallsvn%*M}
69      # size of SRC with .svn
70      szsrcsvn=$( du -sh ../../../SRC | awk '{print $1}' )
71      szsrcsvn=${szsrcsvn%*M}
72      # size of DATA with .svn
73      szdatasvn=$( du -sh ../../../DATA | awk '{print $1}' )
74      szdatasvn=${szdatasvn%*M}
[100]75      echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times"
[255]76      # find the most recent SAXO_SRC_yyyymmddrxxx.tar.gz in
[85]77      # /ipsl/forge/projets/saxo/download/
[100]78      infosrc=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_SRC_*.tar.gz  | head -n 1)
[85]79      filesrc=$(echo ${infosrc} | awk '{print $NF}')
80      szsrc=$(echo ${infosrc} | awk '{print $5}')
[87]81      # ndate is the date in the file SAXO_SRC_*.tar.gz
[85]82      ndate=${filesrc##*_}
[79]83      ndate=${ndate%.tar.gz}
[255]84      # find the most recent SAXO_DATA_yyyymmddrxxx.tar.gz in
[85]85      # /ipsl/forge/projets/saxo/download/
[100]86      infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1)
[85]87      filedata=$(echo ${infodata} | awk '{print $NF}')
88      szdata=$(echo ${infodata} | awk '{print $5}')
[87]89      # ndate2 is the date in the file SAXO_DATA_*.tar.gz
[85]90      ndate2=${filedata##*_}
[79]91      ndate2=${ndate2%.tar.gz}
92   ;;
[92]93   infoupdatekwd)
94      grep "^  old = \[old, .* new = \[new" ../../ForOldVersion/updatekwd.pro | \
[123]95        sort | \
96      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
[92]97   ;;
[123]98   infoupdatecm)
99      grep "IF NOT key_forgetold AND n_elements(" ../../ForOldVersion/updateold.pro | \
100        sort | \
101      sed -e "s/\(^.* THEN \)\(.*\)\( = \)\(.*\)/<row><entry colname='old'><varname>\2<\/varname><\/entry> <entry colname='new'><varname>\4<\/varname><\/entry><\/row>/" > /tmp/rowscm.xml
102   ;;
[144]103   mini_notice)
104      # production of images with frames and callouts
[149]105      # ./forxxxdoc.sh 0101
106      # ./forxxxdoc.sh 0201
[144]107   ;;
[79]108   *)
[144]109      echo "iii : no prerequisites needed"
[79]110   ;;
111esac
112
[65]113# figures lists
[79]114cd ./figpng
[65]115
116#
117figsplt_lev=""
118for i in tst_plt_lev_[0-9][0-9].png
119do
[188]120  figsplt_lev="${figsplt_lev} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]121done
122figspltz_lev=""
123for i in tst_pltz_lev_[0-9][0-9].png
124do
[188]125  figspltz_lev="${figspltz_lev} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]126done
127figspltt_lev=""
128for i in tst_pltt_lev_[0-9][0-9].png
129do
[188]130  figspltt_lev="${figspltt_lev} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]131done
132#
133figsplt_orca2=""
134for i in tst_plt_orca2_[0-9][0-9].png
135do
[188]136  figsplt_orca2="${figsplt_orca2} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]137done
138figspltz_orca2=""
139for i in tst_pltz_orca2_[0-9][0-9].png
140do
[188]141  figspltz_orca2="${figspltz_orca2} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]142done
143figspltt_orca2=""
144for i in tst_pltt_orca2_[0-9][0-9].png
145do
[188]146  figspltt_orca2="${figspltt_orca2} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]147done
148#
149figsplt_orca05=""
150for i in tst_plt_orca05_[0-9][0-9].png
151do
[188]152  figsplt_orca05="${figsplt_orca05} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]153done
154figspltz_orca05=""
155for i in tst_pltz_orca05_[0-9][0-9].png
156do
[188]157  figspltz_orca05="${figspltz_orca05} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]158done
159figspltt_orca05=""
160for i in tst_pltt_orca05_[0-9][0-9].png
161do
[188]162  figspltt_orca05="${figspltt_orca05} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]163done
164##
165#
166figsplt_lev_stride=""
167for i in tst_plt_lev_stride_[0-9][0-9].png
168do
[188]169  figsplt_lev_stride="${figsplt_lev_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]170done
171figspltz_lev_stride=""
172for i in tst_pltz_lev_stride_[0-9][0-9].png
173do
[188]174  figspltz_lev_stride="${figspltz_lev_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]175done
176figspltt_lev_stride=""
177for i in tst_pltt_lev_stride_[0-9][0-9].png
178do
[188]179  figspltt_lev_stride="${figspltt_lev_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]180done
181#
182figsplt_orca2_stride=""
183for i in tst_plt_orca2_stride_[0-9][0-9].png
184do
[188]185  figsplt_orca2_stride="${figsplt_orca2_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]186done
187figspltz_orca2_stride=""
188for i in tst_pltz_orca2_stride_[0-9][0-9].png
189do
[188]190  figspltz_orca2_stride="${figspltz_orca2_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]191done
192figspltt_orca2_stride=""
193for i in tst_pltt_orca2_stride_[0-9][0-9].png
194do
[188]195  figspltt_orca2_stride="${figspltt_orca2_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]196done
197#
198figsplt_orca05_stride=""
199for i in tst_plt_orca05_stride_[0-9][0-9].png
200do
[188]201  figsplt_orca05_stride="${figsplt_orca05_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]202done
203figspltz_orca05_stride=""
204for i in tst_pltz_orca05_stride_[0-9][0-9].png
205do
[188]206  figspltz_orca05_stride="${figspltz_orca05_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]207done
208figspltt_orca05_stride=""
209for i in tst_pltt_orca05_stride_[0-9][0-9].png
210do
[188]211  figspltt_orca05_stride="${figspltt_orca05_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>"
[65]212done
213##
[79]214cd .. # ie <working space of saxo>/SRC/Documentation/xmldoc
[139]215#
216# production of titlepage.saxo.xsl
[255]217#
[139]218# si pb reseau remplacer sur mac par la ligne suivante
219titlepagexsl=http://docbook.sourceforge.net/release/xsl/current/template/titlepage.xsl
220titlepagexsl=/sw/share/xml/xsl/docbook-xsl/template/titlepage.xsl
221#
222xsltproc \
223--xinclude \
224-o titlepage.saxo.xsl \
225${titlepagexsl} \
226titlepage.saxo.xml
[183]227status=${?}
228if [ ${status} -ne 0 ]
229then
230 echo "eee : pb xsltproc sur titlepage.saxo.xml"
231 exit 1
232fi
[139]233#
[79]234case "${1}" in
[85]235   getsaxo)
236      sed -e s/"\&date\;"/${ndate}/g \
237          -e s/"\&date2\;"/${ndate2}/g \
238          -e s/"\&szsrc\;"/${szsrc}/g \
239          -e s/"\&szdata\;"/${szdata}/g \
[87]240          -e s/"\&szallsvn\;"/${szallsvn}/g \
241          -e s/"\&szsrcsvn\;"/${szsrcsvn}/g \
242          -e s/"\&szdatasvn\;"/${szdatasvn}/g \
[255]243          ${1}.xml > ${1}_${$}.xml
[85]244   ;;
[88]245   firststeps)
[84]246      sed -e s/"\&figsplt_lev\;"/"${figsplt_lev}"/g \
[79]247          -e s/"\&figsplt_orca2\;"/"${figsplt_orca2}"/g \
248          -e s/"\&figsplt_orca05\;"/"${figsplt_orca05}"/g \
249          -e s/"\&figspltz_lev\;"/"${figspltz_lev}"/g \
250          -e s/"\&figspltz_orca2\;"/"${figspltz_orca2}"/g \
251          -e s/"\&figspltz_orca05\;"/"${figspltz_orca05}"/g \
252          -e s/"\&figspltt_lev\;"/"${figspltt_lev}"/g \
253          -e s/"\&figspltt_orca2\;"/"${figspltt_orca2}"/g \
254          -e s/"\&figspltt_orca05\;"/"${figspltt_orca05}"/g \
255          -e s/"\&figsplt_lev_stride\;"/"${figsplt_lev_stride}"/g \
256          -e s/"\&figsplt_orca2_stride\;"/"${figsplt_orca2_stride}"/g \
257          -e s/"\&figsplt_orca05_stride\;"/"${figsplt_orca05_stride}"/g \
258          -e s/"\&figspltz_lev_stride\;"/"${figspltz_lev_stride}"/g \
259          -e s/"\&figspltz_orca2_stride\;"/"${figspltz_orca2_stride}"/g \
260          -e s/"\&figspltz_orca05_stride\;"/"${figspltz_orca05_stride}"/g \
261          -e s/"\&figspltt_lev_stride\;"/"${figspltt_lev_stride}"/g \
262          -e s/"\&figspltt_orca2_stride\;"/"${figspltt_orca2_stride}"/g \
263          -e s/"\&figspltt_orca05_stride\;"/"${figspltt_orca05_stride}"/g \
[255]264          ${1}.xml > ${1}_${$}.xml
[79]265   ;;
[92]266   infoupdatekwd)
[123]267      sed -e "/-- rows from updatekwd.pro --/r /tmp/rowskwd.xml" \
[255]268          ${1}.xml > ${1}_${$}.xml
[123]269      /bin/rm /tmp/rowskwd.xml
[92]270   ;;
[123]271   infoupdatecm)
272      sed -e "/-- rows from updateold.pro --/r /tmp/rowscm.xml" \
[255]273          ${1}.xml > ${1}_${$}.xml
[123]274      /bin/rm /tmp/rowscm.xml
275   ;;
[170]276   faqsaxo|websaxo)
[255]277      # resolve xinclude
[161]278      xmllint --xinclude \
279              --output ${1}_${$}.xml ${1}.xml
[183]280      status=${?}
281      if [ ${status} -ne 0 ]
282      then
283       echo "eee : pb xmllint sur ${1}.xml"
284       exit 1
285      fi
[161]286   ;;
[79]287   *)
[255]288      cp ${1}.xml ${1}_${$}.xml
[79]289      echo "iii : no xml transformation needed"
290   ;;
291esac
[65]292#
[258]293CLASSPATH=${CLASSPATH}:/usr/Xalan/xalan.jar:/usr/Xalan/xml-apis.jar:\
[255]294/usr/Xalan/xercesImpl.jar:/usr/docbook-xsl/extensions/xalan25.jar
[65]295export CLASSPATH
296#
[255]297java org.apache.xalan.xslt.Process -out ${1}.html -in ${1}_${$}.xml  \
298-xsl saxo_html.xsl \
299-param section.autolabel 1 \
300-param html.stylesheet "style.css saxo.css" \
301-param css.decoration 1
[183]302status=${?}
303if [ ${status} -ne 0 ]
304then
[258]305 echo "eee : pb xalan sur ${1}_${$}.xml"
[183]306 exit 1
307fi
[139]308#
[79]309case "${1}" in
310   firststeps)
[188]311      # process all_plots
[258]312      java org.apache.xalan.xslt.Process -out all_plots_${$}.xml \
313      -in  ${1}_${$}.xml  \
314      -xsl all_plots_docbook.xsl
315      java org.apache.xalan.xslt.Process -out all_plots.html \
316      -in  all_plots_${$}.xml \
317      -xsl saxo_html.xsl \
318      -param section.autolabel 1 \
319      -param html.stylesheet "style.css saxo.css" \
320      -param css.decoration 1
[79]321      rm -f all_plots_${$}.xml
[158]322      ;;
[170]323   websaxo)
[94]324      sed -e s?"../../saxo/browser/trunk/SRC/Documentation/xmldoc/"??g \
[100]325          -e s?"../../saxo/browser/trunk/SRC/Documentation/idldoc_html_output/"?"../idldoc_html_output/"?g \
[94]326          -e s?"../../saxo/browser/trunk"?"http://forge.ipsl.jussieu.fr/saxo/browser/trunk"?g \
[255]327          ${1}.html > ${1}_${$}.html
[94]328      mv ${1}_${$}.html ${1}.html
[158]329      ;;
[79]330esac
[255]331#
[139]332# use of tidy to have a W3C compliant html file
333tidy -m ${1}.html
334#
335# clean
[79]336rm -f ${1}_${$}.xml
[139]337rm titlepage.saxo.xsl
338#
339# exit
340exit 0
Note: See TracBrowser for help on using the repository browser.