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

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

main documentation now use whatissaxo documentation using xmllint --xinclude

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