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