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

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

introduction of FAQ material

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