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

Last change on this file since 291 was 291, checked in by pinsard, 17 years ago

small changes (lodyc became locean, trailing blanks)

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