#! /bin/sh # # module : # build idldoc documentations # # update : # $Id$ # fplod 2008-01-10T08:13:41Z aedon.locean-ipsl.upmc.fr (Darwin) # version # http://cookbook.idldev.com/idldoc-3.0rc2.zip # fplod 2008-01-03T09:59:18Z aedon.locean-ipsl.upmc.fr (Darwin) # version # http://cookbook.idldev.com/idldoc-3.0rc1.zip # fplod 2007-12-12T09:47:04Z aedon.locean-ipsl.upmc.fr (Darwin) # version # http://michaelgalloy.com/wp-content/uploads/2007/12/idldoc-3.0b4.zip # fplod 2007-12-11T09:14:04Z aedon.locean-ipsl.upmc.fr (Darwin) # version # http://michaelgalloy.com/wp-content/uploads/2007/12/idldoc-3.0b4-src.zip # ++ pb path # beginning of docbook templates writing (from html 3.0b3 tt files) # fplod 2007-12-10T09:28:11Z aedon.locean-ipsl.upmc.fr (Darwin) # test with gdl : pas possible car compatibility < 6.1 # fplod 2007-12-04T09:21:18Z aedon.locean-ipsl.upmc.fr (Darwin) # version # http://michaelgalloy.com/wp-content/uploads/2007/12/idldoc-3.0b3.zip # pb parser if ; after ;- # ++ plus de param et keyword dans l'index # ++ pas w3c tilte au lieu de title, pas de charset, pas de alt, pas de summary # ++ css pas ok # ++ plus de @restrictions # fplod 2007-12-04T09:10:55Z aedon.locean-ipsl.upmc.fr (Darwin) # externalisation of idldoc issues from savesaxo.sh # previous release of idldoc was 2.0 # this tool can be checked by creating doc from Michael Galloy librayry # available on http://www.michaelgalloy.com/lib-docs/ # version # http://michaelgalloy.com/wp-content/uploads/2007/11/idldoc-3.0b1.zip # pas ok ne reconnait pas les @param, @keyword # set -x set -u # ++ test si idl (car gdl inutilisable) application=idl assistant=0 transform=0 title="SAXO Documentation" # ++ parametre root="../../" root="/Users/fplod/SAXO_DIR_ws/SRC/" #++ à cause du cd pour éviter expand_path # ++ pb avec /Users/fplod/SAXO_DIR_ws/SRC/ToBeReviewed/UTILITAIRE/oups.pro ELEMENTS ... à cause de todo #root="/usr/home/fplod/src/mglib/" # overriding root for test ++ # # idldoc_dir="../idldoc/" # idldoc_dir="/usr/home/fplod/src/idldoc-3.0b3/" # overriding idldoc_dir for ctest ++ #idldoc_dir="/usr/home/fplod/src/idldoc-3.0b4-src/" # overriding idldoc_dir for test ++ idldoc_dir="/usr/home/fplod/src/idldoc-3.0b4/" # overriding idldoc_dir for test ++ idldoc_dir="/usr/home/fplod/src/idldoc-3.0rc2/" # overriding idldoc_dir for test ++ template_location=${idldoc_dir}/templates/ #++ pas fini template_location=${idldoc_dir}/templates_dbk/ # overriding TEMPLATE_LOCATION++ template_location=/usr/home/fplod/src/idldoc-3.0b3/templates_dbk/ # overriding TEMPLATE_LOCATION++ # # memorize current directory memopwd=$(pwd) # should be /SRC/Documentation/xmldoc #------------------------------------------------------------------ # # build a idl file to launch idldoc output=../idldoc_html_output/ #++outputtmp=/tmp/idldoc_html_output${$}/ outputtmp=/tmp/idldoc_html_output/ log="/tmp/idldochtml_${$}.log" pro="/tmp/idldochtml_${$}.pro" #+++ a remettre pour dbk template_location="${template_location}", $ #++MARKUP_STYLE="verbatim", $ # !path = expand_path('+' + '${idldoc_dir}') cd ${idldoc_dir} pwd read a cat < ${pro} idldoc,root="${root}",title="${title}", $ CHARSET="ISO-8859-15", $ LOG_FILE="${log}", $ output="${outputtmp}", $ template_prefix="dbk", $ template_location="${template_location}", $ overview="../../overview", /statistics, $ COMMENT_STYLE="assistant" exit EOF more ${pro} read a # launch idl with the file built above IDL_STARTUP=${pro};${application} /bin/rm ${pro} # if [ ${transform} -eq 1 ] then # In order to do not have to many revision in svn, we modify some # lines produced by idldoc : # - add Source link in each html file corresponding to a .pro file # example : # Source # will be replaced by # Source # # - remove date and time of idldoc production # examples : # # will be replaced by # #
Produced by IDLdoc 2.0 on Wed Jun 7 10:54:37 2006.
Produced by IDLdoc 2.0 #

Produced on Wed Jun 7 10:23:13 2006

# will be delete # other lines will be deleted because the time is the time of checkout not # the time of revision. # the sequence of lines #
#
Last modification:
#
Fri Jun 2 11:46:24 2006
#
# should also be removed ++ je ne sais pas dire en sed la ligne # suivant l'occurence de Last modification # # count of directory levels in output # this count will be use to format relative path later nblev1=$(echo ${outputtmp} | sed -e "s@/\$@@" |awk -F "/" '{print NF}') # list_html_pro=$(find ${outputtmp} -name "*.html" -exec grep -l ".*\.pro" {} \;) for file_html in ${list_html_pro} do # build the .pro file name bfile=$(basename ${file_html} .html) # retrieve the path of html file relative to memopwd (so relative to # output). This path will be used in "Source" link. nblev2=$(dirname ${file_html} | sed -e "s@/\$@@" | awk -F "/" '{print NF}') difflev=$((${nblev2} - ${nblev1})) if [ ${difflev} -ge 2 ] then ilev=1 reloutput_html=".." while [ ${ilev} -le ${difflev} ] do reloutput_html="${reloutput_html}/.." ilev=$(( ${ilev} + 1 )) done relpath_html=$(dirname ${file_html} | \ sed \ -e "s@${outputtmp}@${reloutput_html}@" \ -e "s@\$@/@") # echo "relpath ${relpath_html})" else relpath_html="./" fi # echo "relpath ${relpath_html}/${bfile}" sed \ -e "s@<td >Source<\/td>@<td><a href=\"${relpath_html}/${bfile}.pro\" title=\"Source code of a file\">Source<\/a><\/td>@" \ ${file_html} > ${file_html}_modify mv ${file_html}_modify ${file_html} done list_html=$(find ${outputtmp} -name "*.html") for file_html in ${list_html} do sed \ -e "s/\(Generated by IDLdoc 2.0\)\( on .*\)\( -->\)/\1\3/" \ -e "s/\(Produced by IDLdoc 2.0\)\( on .*\)\(\.<\/div>\)/\1\3/" \ -e "/<h2>Produced on/d" \ -e "/Last modification:/d" \ -e "/<dd>... ... .* ..:..:.. ....<\/dd>/d" \ -e 's@<div class="value">@<div class="preformat">@' \ -e 's/div\#file_comments {/div\#file_comments { white-space: pre;/' \ -e 's@^ <fixe>@<pre>@' \ -e 's@^ </fixe>@</pre>@' \ -e 's@xhtml-transitional@xhtml1-transitional@' \ ${file_html} > ${file_html}_modify mv ${file_html}_modify ${file_html} done # suppress ".html" in idldoc-index*.html in lines like # a parameter from the routine ./ReadWrite/idl-NetCDF/ncdf_read.html list_html=$(find ${outputtmp} -name "idldoc-index*.html") for file_html in ${list_html} do sed \ -e "s/\(a parameter from the routine \)\(.*\)\(.html\)/\1\2/" \ ${file_html} > ${file_html}_modify mv ${file_html}_modify ${file_html} done # replace <pro>ginette</pro> by a sequence like # <a href="./ginette.html">ginette</a> ./pro2href.sh -i ${outputtmp} -r ${outputtmp} -e pro status=${?} if [ ${status} -ne 0 ] then echo "eee : pb during ./pro2href.sh for <pro>...</pro>" exit 1 fi # replace <proidl>ginette</proidl> by a sequence like # <a href="./ginette.html">ginette</a> ./pro2href.sh -i ${outputtmp} -r ${IDL_DIR}/help/online_help -e proidl status=${?} if [ ${status} -ne 0 ] then echo "eee : pb during ./pro2href.sh for <proidl>...</proidl>" exit 1 fi fi # end of transform = 1 # echo "iii : you can see log file in ${log}" echo "iii : and look ${outputtmp}/idldoc-warnings.html#undoc" # if [ ${assistant} -eq 1 ] then # build a idl file to launch idldoc output=../idldoc_assistant_output/ log="/tmp/idldocassistant_${$}.log" pro="/tmp/idldocassistant_${$}.pro" cat <<EOF > ${pro} !path = expand_path('+' + '${idldoc_dir}') idldoc,root="${root}",title="${title}", $ LOG_FILE="${log}", $ output="${outputtmp}", overview='../../overview', /statistics, /embed, /assistant exit EOF # launch idl with the file built above IDL_STARTUP=${pro};${IDL_DIR}/bin/idl /bin/rm ${pro} # In order to do not have to many revision in svn, we modify some # lines produced by idldoc : # examples : # <!-- Generated by IDLdoc 2.0 on Wed Jun 7 10:25:28 2006 --> # will be replaced by # <!-- Generated by IDLdoc 2.0 --> # <p><font color="gray" size="-3">  Produced by IDLdoc 2.0 on Wed Sep 13 16:32:10 2006.</font></p> # will be replaced by # <p><font color="gray" size="-3">  Produced by IDLdoc 2.0</font></p> # <h2>Produced on Wed Jun 7 10:23:13 2006</h2> # will be delete # other lines will be deleted because the time is the time of checkout not # the time of revision. # the sequence of lines #<dl> # <dt>Last modification:</dt> # <dd>Fri Jun 2 11:46:24 2006</dd> # </dl> # should also be removed ++ je ne sais pas dire en sed la ligne # suivant l'occurence de Last modification # replace *_param_* in href attributes because anchors are badly written # with _keyword_ #++ -e 's@\(href="#_.*\)\(_param_\)\(.*"\)@\1_keyword_\3@g' \ # ++ pb global # ONLINE_HELP, book="../idldoc_assistant_output/idldoc-lib.adp", /full_path # won't work # encaspulate example content in <pre> </pre> in idldoc assistant outputs # Examples section is supposed to start with <h3>Examples</h3> # and end is before <h3>Version history</h3> list_html=$(find ${outputtmp} -name "*.html") for file_html in ${list_html} do sed \ -e "s/\(Generated by IDLdoc 2.0\)\( on .*\)\( -->\)/\1\3/" \ -e "s/\(Produced by IDLdoc 2.0\)\( on .*\)\(\.<\/font>\)/\1\3/" \ -e "/<h2>Produced on/d" \ -e "/Last modification:/d" \ -e "/<dd>... ... .* ..:..:.. ....<\/dd>/d" \ -e '/href/s@_param_@_keyword_@g' \ -e 's@<div class="value">@<div class="preformat">@' \ -e 's/div\#file_comments {/div\#file_comments { white-space: pre;/' \ -e 's@^ <fixe>@<pre>@' \ -e 's@^ </fixe>@</pre>@' \ -e "s@<h3>Examples</h3>@<h3>Examples</h3><pre>@" \ -e "s@<h3>Version history</h3>@</pre><h3>Version history</h3>@" \ ${file_html} > ${file_html}_modify mv ${file_html}_modify ${file_html} done # replace <pro>ginette</pro> by a sequence like # <a href="./ginette.html">ginette</a> ./pro2href.sh -i ${outputtmp} -r ${outputtmp} -e pro status=${?} if [ ${status} -ne 0 ] then echo "eee : pb during ./pro2href.sh for <pro>...</pro>" exit 1 fi # replace <proidl>ginette</proidl> by a sequence like # <a href="./ginette.html">ginette</a> ./pro2href.sh -i ${outputtmp} -r ${IDL_DIR}/help/online_help -e proidl status=${?} if [ ${status} -ne 0 ] then echo "eee : pb during ./pro2href.sh for <proidl>...</proidl>" exit 1 fi # add the directory-overview.html from dir-files.html in idldoc_html_output list_html=$(find ../idldoc_html_output -name dir-files.html) for file_html in ${list_html} do fout=../idldoc_assistant_output/${file_html#../idldoc_html_output/*} fout=${fout%/*}/directory-overview.html cp ${file_html} ${fout} done # copy listings.css (needed by directory-overview.html files) cp ../idldoc/resource/listings.css ${outputtmp} # add an id in idldoc-lib.adp cat << EOF > /tmp/adp_modification <!-- \$Id\$ --> EOF sed -e "/<\/profile>/r /tmp/adp_modification" \ ../idldoc_assistant_output/idldoc-lib.adp > \ ../idldoc_assistant_output/idldoc-lib.adp_${$} mv ../idldoc_assistant_output/idldoc-lib.adp_${$} \ ../idldoc_assistant_output/idldoc-lib.adp rm /tmp/adp_modification echo "iii : you can see log file in ${log}" echo "iii : and look ${outputtmp}/idldoc-warnings.html#undoc" # check that the number of existing html files for each .pro file is 2! for i in $( find ../.. -name "*.pro" ) do nhtml=$( find ../.. -name $( basename ${i} .pro ).html | wc -l ) if [ ${nhtml} -ne 2 ] then echo "ERROR there is not 2 $( basename ${i} .pro ).html files" find ../.. -name $( basename ${i} .pro ).html echo fi done # fi # copy of temporary outputs on final directory # ++ if transform #++mv ${outputtmp} ${output} # ++ rsync echo "look at ${outputtmp}/index.html" #++ # end exit 0