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 | # |
---|
46 | set -u |
---|
47 | # |
---|
48 | case $( whoami ) in |
---|
49 | smasson) |
---|
50 | lgforge=smasson |
---|
51 | ;; |
---|
52 | floseb) |
---|
53 | lgforge=smasson |
---|
54 | ;; |
---|
55 | *) |
---|
56 | lgforge=saxo |
---|
57 | ;; |
---|
58 | esac |
---|
59 | # |
---|
60 | case "${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 | ;; |
---|
107 | esac |
---|
108 | |
---|
109 | # figures lists |
---|
110 | cd ./figpng |
---|
111 | |
---|
112 | # |
---|
113 | figsplt_lev="" |
---|
114 | for i in tst_plt_lev_[0-9][0-9].png |
---|
115 | do |
---|
116 | figsplt_lev="${figsplt_lev} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
117 | done |
---|
118 | figspltz_lev="" |
---|
119 | for i in tst_pltz_lev_[0-9][0-9].png |
---|
120 | do |
---|
121 | figspltz_lev="${figspltz_lev} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
122 | done |
---|
123 | figspltt_lev="" |
---|
124 | for i in tst_pltt_lev_[0-9][0-9].png |
---|
125 | do |
---|
126 | figspltt_lev="${figspltt_lev} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
127 | done |
---|
128 | # |
---|
129 | figsplt_orca2="" |
---|
130 | for i in tst_plt_orca2_[0-9][0-9].png |
---|
131 | do |
---|
132 | figsplt_orca2="${figsplt_orca2} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
133 | done |
---|
134 | figspltz_orca2="" |
---|
135 | for i in tst_pltz_orca2_[0-9][0-9].png |
---|
136 | do |
---|
137 | figspltz_orca2="${figspltz_orca2} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
138 | done |
---|
139 | figspltt_orca2="" |
---|
140 | for i in tst_pltt_orca2_[0-9][0-9].png |
---|
141 | do |
---|
142 | figspltt_orca2="${figspltt_orca2} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
143 | done |
---|
144 | # |
---|
145 | figsplt_orca05="" |
---|
146 | for i in tst_plt_orca05_[0-9][0-9].png |
---|
147 | do |
---|
148 | figsplt_orca05="${figsplt_orca05} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
149 | done |
---|
150 | figspltz_orca05="" |
---|
151 | for i in tst_pltz_orca05_[0-9][0-9].png |
---|
152 | do |
---|
153 | figspltz_orca05="${figspltz_orca05} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
154 | done |
---|
155 | figspltt_orca05="" |
---|
156 | for i in tst_pltt_orca05_[0-9][0-9].png |
---|
157 | do |
---|
158 | figspltt_orca05="${figspltt_orca05} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
159 | done |
---|
160 | ## |
---|
161 | # |
---|
162 | figsplt_lev_stride="" |
---|
163 | for i in tst_plt_lev_stride_[0-9][0-9].png |
---|
164 | do |
---|
165 | figsplt_lev_stride="${figsplt_lev_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
166 | done |
---|
167 | figspltz_lev_stride="" |
---|
168 | for i in tst_pltz_lev_stride_[0-9][0-9].png |
---|
169 | do |
---|
170 | figspltz_lev_stride="${figspltz_lev_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
171 | done |
---|
172 | figspltt_lev_stride="" |
---|
173 | for i in tst_pltt_lev_stride_[0-9][0-9].png |
---|
174 | do |
---|
175 | figspltt_lev_stride="${figspltt_lev_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
176 | done |
---|
177 | # |
---|
178 | figsplt_orca2_stride="" |
---|
179 | for i in tst_plt_orca2_stride_[0-9][0-9].png |
---|
180 | do |
---|
181 | figsplt_orca2_stride="${figsplt_orca2_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
182 | done |
---|
183 | figspltz_orca2_stride="" |
---|
184 | for i in tst_pltz_orca2_stride_[0-9][0-9].png |
---|
185 | do |
---|
186 | figspltz_orca2_stride="${figspltz_orca2_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
187 | done |
---|
188 | figspltt_orca2_stride="" |
---|
189 | for i in tst_pltt_orca2_stride_[0-9][0-9].png |
---|
190 | do |
---|
191 | figspltt_orca2_stride="${figspltt_orca2_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
192 | done |
---|
193 | # |
---|
194 | figsplt_orca05_stride="" |
---|
195 | for i in tst_plt_orca05_stride_[0-9][0-9].png |
---|
196 | do |
---|
197 | figsplt_orca05_stride="${figsplt_orca05_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
198 | done |
---|
199 | figspltz_orca05_stride="" |
---|
200 | for i in tst_pltz_orca05_stride_[0-9][0-9].png |
---|
201 | do |
---|
202 | figspltz_orca05_stride="${figspltz_orca05_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
203 | done |
---|
204 | figspltt_orca05_stride="" |
---|
205 | for i in tst_pltt_orca05_stride_[0-9][0-9].png |
---|
206 | do |
---|
207 | figspltt_orca05_stride="${figspltt_orca05_stride} \<ulink url=\"figpng\/${i}\"\>\&showfig\;\<\/ulink\>" |
---|
208 | done |
---|
209 | ## |
---|
210 | cd .. # 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 |
---|
215 | titlepagexsl=http://docbook.sourceforge.net/release/xsl/current/template/titlepage.xsl |
---|
216 | titlepagexsl=/sw/share/xml/xsl/docbook-xsl/template/titlepage.xsl |
---|
217 | # |
---|
218 | xsltproc \ |
---|
219 | --xinclude \ |
---|
220 | -o titlepage.saxo.xsl \ |
---|
221 | ${titlepagexsl} \ |
---|
222 | titlepage.saxo.xml |
---|
223 | status=${?} |
---|
224 | if [ ${status} -ne 0 ] |
---|
225 | then |
---|
226 | echo "eee : pb xsltproc sur titlepage.saxo.xml" |
---|
227 | exit 1 |
---|
228 | fi |
---|
229 | # |
---|
230 | case "${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 | ;; |
---|
287 | esac |
---|
288 | # |
---|
289 | CLASSPATH="${CLASSPATH}:\ |
---|
290 | /sw/share/java/saxon/saxon.jar:\ |
---|
291 | /sw/share/xml/xsl/docbook-xsl/extensions/saxon653.jar" |
---|
292 | export CLASSPATH |
---|
293 | # |
---|
294 | java com.icl.saxon.StyleSheet -o ${1}.html ${1}_${$}.xml \ |
---|
295 | saxo_html.xsl \ |
---|
296 | section.autolabel=1 html.stylesheet="style.css saxo.css" css.decoration=1 \ |
---|
297 | callout.graphics.extension=".png" \ |
---|
298 | callout.graphics="1" \ |
---|
299 | callout.graphics.path="images/callouts/" \ |
---|
300 | use.extensions=1 \ |
---|
301 | callouts.extension=1 |
---|
302 | status=${?} |
---|
303 | if [ ${status} -ne 0 ] |
---|
304 | then |
---|
305 | echo "eee : pb saxon sur ${1}_${$}.xml" |
---|
306 | exit 1 |
---|
307 | fi |
---|
308 | # |
---|
309 | case "${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 | ;; |
---|
326 | esac |
---|
327 | # |
---|
328 | # use of tidy to have a W3C compliant html file |
---|
329 | tidy -m ${1}.html |
---|
330 | # |
---|
331 | # clean |
---|
332 | rm -f ${1}_${$}.xml |
---|
333 | rm titlepage.saxo.xsl |
---|
334 | # |
---|
335 | # exit |
---|
336 | exit 0 |
---|