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