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