[65] | 1 | #!/bin/bash |
---|
[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 | # |
---|
[144] | 10 | # fplod 2006-07-21T08:25:05Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 11 | # add prerequisites for mini_notice production |
---|
[139] | 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 |
---|
[123] | 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 |
---|
[92] | 21 | # fplod 2006-06-07T13:55:07Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 22 | # add infoupdatekwd |
---|
[86] | 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 |
---|
[85] | 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 |
---|
[87] | 27 | # for tar file instead of ~/SAXO_SRC/ ie home of Sebatien Masson on |
---|
[85] | 28 | # arete.lodyc.jussieu.fr |
---|
| 29 | # !!! saxo@forge.ipsl.jussieu.fr password is needed |
---|
[79] | 30 | # fplod 2006-05-31T10:34:18Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 31 | # . add creation of all_plots.html using firststeps.html |
---|
[87] | 32 | # . remplace ~/SAXO_SRC/SRC/Documentation/xmldoc/figpng by ./figpng/ |
---|
[79] | 33 | # we suppose that this shell script is launched when we are in |
---|
| 34 | # <working space of saxo>/SRC/Documentation/xmldoc/ |
---|
| 35 | # |
---|
[65] | 36 | set -u |
---|
[79] | 37 | # |
---|
[100] | 38 | case $( whoami ) in |
---|
| 39 | smasson) |
---|
| 40 | lgforge=smasson |
---|
| 41 | ;; |
---|
| 42 | floseb) |
---|
| 43 | lgforge=smasson |
---|
| 44 | ;; |
---|
| 45 | *) |
---|
| 46 | lgforge=saxo |
---|
| 47 | ;; |
---|
| 48 | esac |
---|
| 49 | # |
---|
[79] | 50 | case "${1}" in |
---|
[84] | 51 | getsaxo) |
---|
[87] | 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} |
---|
[100] | 61 | echo "iii : you will be asked ${lgforge}@forge.ipsl.jussieu.fr passwd two times" |
---|
[87] | 62 | # find the most recent SAXO_SRC_yyyymmdd.tar.gz in |
---|
[85] | 63 | # /ipsl/forge/projets/saxo/download/ |
---|
[100] | 64 | infosrc=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_SRC_*.tar.gz | head -n 1) |
---|
[85] | 65 | filesrc=$(echo ${infosrc} | awk '{print $NF}') |
---|
| 66 | szsrc=$(echo ${infosrc} | awk '{print $5}') |
---|
[87] | 67 | # ndate is the date in the file SAXO_SRC_*.tar.gz |
---|
[85] | 68 | ndate=${filesrc##*_} |
---|
[79] | 69 | ndate=${ndate%.tar.gz} |
---|
[87] | 70 | # find the most recent SAXO_DATA_yyyymmdd.tar.gz in |
---|
[85] | 71 | # /ipsl/forge/projets/saxo/download/ |
---|
[100] | 72 | infodata=$(ssh ${lgforge}@forge.ipsl.jussieu.fr ls -lht /ipsl/forge/projets/saxo/download/SAXO_DATA_*.tar.gz | head -n 1) |
---|
[85] | 73 | filedata=$(echo ${infodata} | awk '{print $NF}') |
---|
| 74 | szdata=$(echo ${infodata} | awk '{print $5}') |
---|
[87] | 75 | # ndate2 is the date in the file SAXO_DATA_*.tar.gz |
---|
[85] | 76 | ndate2=${filedata##*_} |
---|
[79] | 77 | ndate2=${ndate2%.tar.gz} |
---|
| 78 | ;; |
---|
[92] | 79 | infoupdatekwd) |
---|
| 80 | grep "^ old = \[old, .* new = \[new" ../../ForOldVersion/updatekwd.pro | \ |
---|
[123] | 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 |
---|
[92] | 83 | ;; |
---|
[123] | 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 | ;; |
---|
[144] | 89 | mini_notice) |
---|
| 90 | # production of images with frames and callouts |
---|
[149] | 91 | # ./forxxxdoc.sh 0101 |
---|
| 92 | # ./forxxxdoc.sh 0201 |
---|
[144] | 93 | ;; |
---|
[79] | 94 | *) |
---|
[144] | 95 | echo "iii : no prerequisites needed" |
---|
[79] | 96 | ;; |
---|
| 97 | esac |
---|
| 98 | |
---|
[65] | 99 | # figures lists |
---|
[79] | 100 | cd ./figpng |
---|
[65] | 101 | |
---|
| 102 | # |
---|
| 103 | figsplt_lev="" |
---|
| 104 | for i in tst_plt_lev_[0-9][0-9].png |
---|
| 105 | do |
---|
[81] | 106 | figsplt_lev="${figsplt_lev} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 107 | done |
---|
| 108 | figspltz_lev="" |
---|
| 109 | for i in tst_pltz_lev_[0-9][0-9].png |
---|
| 110 | do |
---|
[81] | 111 | figspltz_lev="${figspltz_lev} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 112 | done |
---|
| 113 | figspltt_lev="" |
---|
| 114 | for i in tst_pltt_lev_[0-9][0-9].png |
---|
| 115 | do |
---|
[81] | 116 | figspltt_lev="${figspltt_lev} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 117 | done |
---|
| 118 | # |
---|
| 119 | figsplt_orca2="" |
---|
| 120 | for i in tst_plt_orca2_[0-9][0-9].png |
---|
| 121 | do |
---|
[81] | 122 | figsplt_orca2="${figsplt_orca2} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 123 | done |
---|
| 124 | figspltz_orca2="" |
---|
| 125 | for i in tst_pltz_orca2_[0-9][0-9].png |
---|
| 126 | do |
---|
[81] | 127 | figspltz_orca2="${figspltz_orca2} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 128 | done |
---|
| 129 | figspltt_orca2="" |
---|
| 130 | for i in tst_pltt_orca2_[0-9][0-9].png |
---|
| 131 | do |
---|
[81] | 132 | figspltt_orca2="${figspltt_orca2} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 133 | done |
---|
| 134 | # |
---|
| 135 | figsplt_orca05="" |
---|
| 136 | for i in tst_plt_orca05_[0-9][0-9].png |
---|
| 137 | do |
---|
[81] | 138 | figsplt_orca05="${figsplt_orca05} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 139 | done |
---|
| 140 | figspltz_orca05="" |
---|
| 141 | for i in tst_pltz_orca05_[0-9][0-9].png |
---|
| 142 | do |
---|
[81] | 143 | figspltz_orca05="${figspltz_orca05} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 144 | done |
---|
| 145 | figspltt_orca05="" |
---|
| 146 | for i in tst_pltt_orca05_[0-9][0-9].png |
---|
| 147 | do |
---|
[81] | 148 | figspltt_orca05="${figspltt_orca05} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 149 | done |
---|
| 150 | ## |
---|
| 151 | # |
---|
| 152 | figsplt_lev_stride="" |
---|
| 153 | for i in tst_plt_lev_stride_[0-9][0-9].png |
---|
| 154 | do |
---|
[81] | 155 | figsplt_lev_stride="${figsplt_lev_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 156 | done |
---|
| 157 | figspltz_lev_stride="" |
---|
| 158 | for i in tst_pltz_lev_stride_[0-9][0-9].png |
---|
| 159 | do |
---|
[81] | 160 | figspltz_lev_stride="${figspltz_lev_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 161 | done |
---|
| 162 | figspltt_lev_stride="" |
---|
| 163 | for i in tst_pltt_lev_stride_[0-9][0-9].png |
---|
| 164 | do |
---|
[81] | 165 | figspltt_lev_stride="${figspltt_lev_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 166 | done |
---|
| 167 | # |
---|
| 168 | figsplt_orca2_stride="" |
---|
| 169 | for i in tst_plt_orca2_stride_[0-9][0-9].png |
---|
| 170 | do |
---|
[81] | 171 | figsplt_orca2_stride="${figsplt_orca2_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 172 | done |
---|
| 173 | figspltz_orca2_stride="" |
---|
| 174 | for i in tst_pltz_orca2_stride_[0-9][0-9].png |
---|
| 175 | do |
---|
[81] | 176 | figspltz_orca2_stride="${figspltz_orca2_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 177 | done |
---|
| 178 | figspltt_orca2_stride="" |
---|
| 179 | for i in tst_pltt_orca2_stride_[0-9][0-9].png |
---|
| 180 | do |
---|
[81] | 181 | figspltt_orca2_stride="${figspltt_orca2_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 182 | done |
---|
| 183 | # |
---|
| 184 | figsplt_orca05_stride="" |
---|
| 185 | for i in tst_plt_orca05_stride_[0-9][0-9].png |
---|
| 186 | do |
---|
[81] | 187 | figsplt_orca05_stride="${figsplt_orca05_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 188 | done |
---|
| 189 | figspltz_orca05_stride="" |
---|
| 190 | for i in tst_pltz_orca05_stride_[0-9][0-9].png |
---|
| 191 | do |
---|
[81] | 192 | figspltz_orca05_stride="${figspltz_orca05_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 193 | done |
---|
| 194 | figspltt_orca05_stride="" |
---|
| 195 | for i in tst_pltt_orca05_stride_[0-9][0-9].png |
---|
| 196 | do |
---|
[81] | 197 | figspltt_orca05_stride="${figspltt_orca05_stride} \<ulink url=\"figpng\/${i}?format=raw\"\>\&showfig\;\<\/ulink\>" |
---|
[65] | 198 | done |
---|
| 199 | ## |
---|
[79] | 200 | cd .. # ie <working space of saxo>/SRC/Documentation/xmldoc |
---|
[139] | 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 | # |
---|
[79] | 214 | case "${1}" in |
---|
[85] | 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 \ |
---|
[87] | 220 | -e s/"\&szallsvn\;"/${szallsvn}/g \ |
---|
| 221 | -e s/"\&szsrcsvn\;"/${szsrcsvn}/g \ |
---|
| 222 | -e s/"\&szdatasvn\;"/${szdatasvn}/g \ |
---|
[85] | 223 | ${1}.xml > ${1}_${$}.xml |
---|
| 224 | ;; |
---|
[88] | 225 | firststeps) |
---|
[84] | 226 | sed -e s/"\&figsplt_lev\;"/"${figsplt_lev}"/g \ |
---|
[79] | 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 | ;; |
---|
[92] | 246 | infoupdatekwd) |
---|
[123] | 247 | sed -e "/-- rows from updatekwd.pro --/r /tmp/rowskwd.xml" \ |
---|
[92] | 248 | ${1}.xml > ${1}_${$}.xml |
---|
[123] | 249 | /bin/rm /tmp/rowskwd.xml |
---|
[92] | 250 | ;; |
---|
[123] | 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 | ;; |
---|
[79] | 256 | *) |
---|
| 257 | cp ${1}.xml ${1}_${$}.xml |
---|
| 258 | echo "iii : no xml transformation needed" |
---|
| 259 | ;; |
---|
| 260 | esac |
---|
[65] | 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 | # |
---|
[139] | 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 | # |
---|
[79] | 276 | case "${1}" in |
---|
| 277 | firststeps) |
---|
[139] | 278 | java com.icl.saxon.StyleSheet -o all_plots_${$}.xml ${1}_${$}.xml \ |
---|
[79] | 279 | all_plots_docbook.xsl |
---|
| 280 | java com.icl.saxon.StyleSheet -o all_plots.html all_plots_${$}.xml \ |
---|
[139] | 281 | saxo_html.xsl \ |
---|
| 282 | section.autolabel=1 html.stylesheet="style.css saxo.css" css.decoration=1 |
---|
[79] | 283 | rm -f all_plots_${$}.xml |
---|
[88] | 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 |
---|
[158] | 287 | ;; |
---|
[94] | 288 | main) |
---|
| 289 | sed -e s?"../../saxo/browser/trunk/SRC/Documentation/xmldoc/"??g \ |
---|
[100] | 290 | -e s?"../../saxo/browser/trunk/SRC/Documentation/idldoc_html_output/"?"../idldoc_html_output/"?g \ |
---|
[94] | 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 |
---|
[158] | 294 | ;; |
---|
| 295 | mini_notice) |
---|
| 296 | # not very nice... but useful !! |
---|
| 297 | sed -e s/".png\""/".png?format=raw\""/g ${1}.html > ${1}_${$}.html |
---|
| 298 | mv ${1}_${$}.html ${1}.html |
---|
| 299 | ;; |
---|
[79] | 300 | esac |
---|
[139] | 301 | # |
---|
| 302 | # use of tidy to have a W3C compliant html file |
---|
| 303 | tidy -m ${1}.html |
---|
| 304 | # |
---|
| 305 | # clean |
---|
[79] | 306 | rm -f ${1}_${$}.xml |
---|
[139] | 307 | rm titlepage.saxo.xsl |
---|
| 308 | # |
---|
| 309 | # exit |
---|
| 310 | exit 0 |
---|