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

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

add files for xxx documentation see mini_notice.html

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