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

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

modification of some .xml (add Id, aspell checking), add style.css file and titlepage technique

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