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

Last change on this file since 258 was 258, checked in by pinsard, 17 years ago

correction for links in documentations. cf 62

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