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

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

correction of getsaxo.html (wrong SRC tarfile)

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