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