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

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

remove format=raw in all html files 1/2

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