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
Line 
1#!/bin/bash -x
2#
3# update :
4# $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 2006-09-07T08:10:23Z aedon.locean-ipsl.upmc.fr (Darwin)
11# main is rename to websaxo.html
12# fplod 2006-08-29T14:01:11Z aedon.locean-ipsl.upmc.fr (Darwin)
13# add main which needs xmllint processing to resolve xinclude
14# fplod 2006-08-18T13:38:31Z aedon.locean-ipsl.upmc.fr (Darwin)
15# add faqsaxo which needs xmllint processing to resolve xinclude
16# fplod 2006-07-21T08:25:05Z aedon.locean-ipsl.upmc.fr (Darwin)
17# add prerequisites for mini_notice production
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
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
27# fplod 2006-06-07T13:55:07Z aedon.locean-ipsl.upmc.fr (Darwin)
28# add infoupdatekwd
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
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
33# for tar file instead of ~/SAXO_SRC/ ie home of Sebatien Masson on
34# arete.lodyc.jussieu.fr
35# !!! saxo@forge.ipsl.jussieu.fr password is needed
36# fplod 2006-05-31T10:34:18Z aedon.locean-ipsl.upmc.fr (Darwin)
37# . add creation of all_plots.html using firststeps.html
38# . remplace ~/SAXO_SRC/SRC/Documentation/xmldoc/figpng by ./figpng/
39# we suppose that this shell script is launched when we are in
40# <working space of saxo>/SRC/Documentation/xmldoc/
41#
42set -u
43#
44case $( whoami ) in
45    smasson)
46        lgforge=smasson
47    ;;
48    floseb)
49        lgforge=smasson
50    ;;
51    *)
52        lgforge=saxo
53    ;;
54esac
55#
56case "${1}" in
57   getsaxo)
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}
67      echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times"
68      # find the most recent SAXO_SRC_yyyymmdd.tar.gz in
69      # /ipsl/forge/projets/saxo/download/
70      infosrc=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_SRC_*.tar.gz  | head -n 1)
71      filesrc=$(echo ${infosrc} | awk '{print $NF}')
72      szsrc=$(echo ${infosrc} | awk '{print $5}')
73      # ndate is the date in the file SAXO_SRC_*.tar.gz
74      ndate=${filesrc##*_}
75      ndate=${ndate%.tar.gz}
76      # find the most recent SAXO_DATA_yyyymmdd.tar.gz in
77      # /ipsl/forge/projets/saxo/download/
78      infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1)
79      filedata=$(echo ${infodata} | awk '{print $NF}')
80      szdata=$(echo ${infodata} | awk '{print $5}')
81      # ndate2 is the date in the file SAXO_DATA_*.tar.gz
82      ndate2=${filedata##*_}
83      ndate2=${ndate2%.tar.gz}
84   ;;
85   infoupdatekwd)
86      grep "^  old = \[old, .* new = \[new" ../../ForOldVersion/updatekwd.pro | \
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
89   ;;
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   ;;
95   mini_notice)
96      # production of images with frames and callouts
97      # ./forxxxdoc.sh 0101
98      # ./forxxxdoc.sh 0201
99   ;;
100   *)
101      echo "iii : no prerequisites needed"
102   ;;
103esac
104
105# figures lists
106cd ./figpng
107
108#
109figsplt_lev=""
110for i in tst_plt_lev_[0-9][0-9].png
111do
112  figsplt_lev="${figsplt_lev} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
113done
114figspltz_lev=""
115for i in tst_pltz_lev_[0-9][0-9].png
116do
117  figspltz_lev="${figspltz_lev} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
118done
119figspltt_lev=""
120for i in tst_pltt_lev_[0-9][0-9].png
121do
122  figspltt_lev="${figspltt_lev} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
123done
124#
125figsplt_orca2=""
126for i in tst_plt_orca2_[0-9][0-9].png
127do
128  figsplt_orca2="${figsplt_orca2} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
129done
130figspltz_orca2=""
131for i in tst_pltz_orca2_[0-9][0-9].png
132do
133  figspltz_orca2="${figspltz_orca2} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
134done
135figspltt_orca2=""
136for i in tst_pltt_orca2_[0-9][0-9].png
137do
138  figspltt_orca2="${figspltt_orca2} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
139done
140#
141figsplt_orca05=""
142for i in tst_plt_orca05_[0-9][0-9].png
143do
144  figsplt_orca05="${figsplt_orca05} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
145done
146figspltz_orca05=""
147for i in tst_pltz_orca05_[0-9][0-9].png
148do
149  figspltz_orca05="${figspltz_orca05} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
150done
151figspltt_orca05=""
152for i in tst_pltt_orca05_[0-9][0-9].png
153do
154  figspltt_orca05="${figspltt_orca05} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
155done
156##
157#
158figsplt_lev_stride=""
159for i in tst_plt_lev_stride_[0-9][0-9].png
160do
161  figsplt_lev_stride="${figsplt_lev_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
162done
163figspltz_lev_stride=""
164for i in tst_pltz_lev_stride_[0-9][0-9].png
165do
166  figspltz_lev_stride="${figspltz_lev_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
167done
168figspltt_lev_stride=""
169for i in tst_pltt_lev_stride_[0-9][0-9].png
170do
171  figspltt_lev_stride="${figspltt_lev_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
172done
173#
174figsplt_orca2_stride=""
175for i in tst_plt_orca2_stride_[0-9][0-9].png
176do
177  figsplt_orca2_stride="${figsplt_orca2_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
178done
179figspltz_orca2_stride=""
180for i in tst_pltz_orca2_stride_[0-9][0-9].png
181do
182  figspltz_orca2_stride="${figspltz_orca2_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
183done
184figspltt_orca2_stride=""
185for i in tst_pltt_orca2_stride_[0-9][0-9].png
186do
187  figspltt_orca2_stride="${figspltt_orca2_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
188done
189#
190figsplt_orca05_stride=""
191for i in tst_plt_orca05_stride_[0-9][0-9].png
192do
193  figsplt_orca05_stride="${figsplt_orca05_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
194done
195figspltz_orca05_stride=""
196for i in tst_pltz_orca05_stride_[0-9][0-9].png
197do
198  figspltz_orca05_stride="${figspltz_orca05_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
199done
200figspltt_orca05_stride=""
201for i in tst_pltt_orca05_stride_[0-9][0-9].png
202do
203  figspltt_orca05_stride="${figspltt_orca05_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>"
204done
205##
206cd .. # ie <working space of saxo>/SRC/Documentation/xmldoc
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#
220case "${1}" in
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 \
226          -e s/"\&szallsvn\;"/${szallsvn}/g \
227          -e s/"\&szsrcsvn\;"/${szsrcsvn}/g \
228          -e s/"\&szdatasvn\;"/${szdatasvn}/g \
229          ${1}.xml > ${1}_${$}.xml
230   ;;
231   firststeps)
232      sed -e s/"\&figsplt_lev\;"/"${figsplt_lev}"/g \
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   ;;
252   infoupdatekwd)
253      sed -e "/-- rows from updatekwd.pro --/r /tmp/rowskwd.xml" \
254          ${1}.xml > ${1}_${$}.xml
255      /bin/rm /tmp/rowskwd.xml
256   ;;
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   ;;
262   faqsaxo|websaxo)
263      # resolve xinclude
264      xmllint --xinclude \
265              --output ${1}_${$}.xml ${1}.xml
266   ;;
267   *)
268      cp ${1}.xml ${1}_${$}.xml
269      echo "iii : no xml transformation needed"
270   ;;
271esac
272#
273CLASSPATH="${CLASSPATH}:\
274/sw/share/java/saxon/saxon.jar:\
275/sw/share/xml/xsl/docbook-xsl/extensions/saxon653.jar"
276export CLASSPATH
277#
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#
287case "${1}" in
288   firststeps)
289      java com.icl.saxon.StyleSheet -o all_plots_${$}.xml ${1}_${$}.xml  \
290      all_plots_docbook.xsl
291      java com.icl.saxon.StyleSheet -o all_plots.html all_plots_${$}.xml  \
292      saxo_html.xsl \
293      section.autolabel=1 html.stylesheet="style.css saxo.css" css.decoration=1
294      rm -f all_plots_${$}.xml
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
298      ;;
299   websaxo)
300      sed -e s?"../../saxo/browser/trunk/SRC/Documentation/xmldoc/"??g \
301          -e s?"../../saxo/browser/trunk/SRC/Documentation/idldoc_html_output/"?"../idldoc_html_output/"?g \
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
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        ;;
311esac
312#
313# use of tidy to have a W3C compliant html file
314tidy -m ${1}.html
315#
316# clean
317rm -f ${1}_${$}.xml
318rm titlepage.saxo.xsl
319#
320# exit
321exit 0
Note: See TracBrowser for help on using the repository browser.