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

Last change on this file since 376 was 345, checked in by pinsard, 16 years ago

migration from DocBook? 4 to Docbook 5 : sources and production tools

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