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

Last change on this file since 181 was 170, checked in by pinsard, 18 years ago

Main document (websaxo.html) availabe on SRC directory

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