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

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