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