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