source: trunk/SRC/Documentation/xmldoc/doidldoc.sh @ 327

Last change on this file since 327 was 327, checked in by pinsard, 17 years ago

modification of headers : mainly blanks around = sign for keywords in declaration of function and pro

  • Property svn:executable set to *
  • Property svn:keyword set to Id
  • Property svn:keywords set to Id
File size: 10.9 KB
Line 
1#! /bin/sh
2#
3# module :
4# build idldoc documentations
5#
6# update :
7# $Id$
8# fplod 2007-12-12T09:47:04Z aedon.locean-ipsl.upmc.fr (Darwin)
9# version
10# http://michaelgalloy.com/wp-content/uploads/2007/12/idldoc-3.0b4.zip
11# fplod 2007-12-11T09:14:04Z aedon.locean-ipsl.upmc.fr (Darwin)
12# version
13# http://michaelgalloy.com/wp-content/uploads/2007/12/idldoc-3.0b4-src.zip
14# ++ pb path
15# beginning of docbook templates writing (from html 3.0b3 tt files)
16# fplod 2007-12-10T09:28:11Z aedon.locean-ipsl.upmc.fr (Darwin)
17# test with gdl : pas possible car compatibility < 6.1
18# fplod 2007-12-04T09:21:18Z aedon.locean-ipsl.upmc.fr (Darwin)
19# version
20# http://michaelgalloy.com/wp-content/uploads/2007/12/idldoc-3.0b3.zip
21# pb parser if ; after ;-
22# ++ plus de param et keyword dans l'index
23# ++ pas w3c tilte au lieu de title, pas de charset, pas de alt, pas de summary
24# ++ css pas ok
25# ++ plus de @restrictions
26# fplod 2007-12-04T09:10:55Z aedon.locean-ipsl.upmc.fr (Darwin)
27# externalisation of idldoc issues from savesaxo.sh
28# previous release of idldoc was 2.0
29# this tool can be checked by creating doc from Michael Galloy librayry
30# available on http://www.michaelgalloy.com/lib-docs/
31# version
32#  http://michaelgalloy.com/wp-content/uploads/2007/11/idldoc-3.0b1.zip
33# pas ok ne reconnait pas les @param, @keyword
34#
35set -x
36set -u
37# ++ test si idl (car gdl inutilisable)
38application=idl
39assistant=0
40transform=0
41title="SAXO Documentation" # ++ parametre
42root="../../"
43root="/Users/fplod/SAXO_DIR_ws/SRC/" #++ à cause du cd pour éviter expand_path
44#root="/usr/home/fplod/src/mglib/" # overriding root for test ++
45#
46#
47idldoc_dir="../idldoc/" #
48idldoc_dir="/usr/home/fplod/src/idldoc-3.0b3/" # overriding idldoc_dir for ctest ++
49#idldoc_dir="/usr/home/fplod/src/idldoc-3.0b4-src/" # overriding idldoc_dir for test ++
50idldoc_dir="/usr/home/fplod/src/idldoc-3.0b4/" # overriding idldoc_dir for test ++
51template_location=${idldoc_dir}/templates/
52#++ pas fini
53#template_location=${idldoc_dir}/templates_dbk/ # overriding TEMPLATE_LOCATION++
54#
55# memorize current directory
56memopwd=$(pwd) # should be <working space>/SRC/Documentation/xmldoc
57#------------------------------------------------------------------
58#
59# build a idl file to launch idldoc
60output=../idldoc_html_output/
61#++outputtmp=/tmp/idldoc_html_output${$}/
62outputtmp=/tmp/idldoc_html_output/
63log="/tmp/idldochtml_${$}.log"
64pro="/tmp/idldochtml_${$}.pro"
65
66#+++ a remettre pour dbk template_location="${template_location}", $
67# !path = expand_path('+' + '${idldoc_dir}')
68cd ${idldoc_dir}
69pwd
70read a
71cat <<EOF > ${pro}
72idldoc,root="${root}",title="${title}", $
73LOG_FILE="${log}", $
74output="${outputtmp}", $
75template_location="${template_location}", $
76COMMENT_STYLE="latex", $
77overview="../../overview", /statistics
78exit
79EOF
80more ${pro}
81read a
82# launch idl with the file built above
83IDL_STARTUP=${pro};${application}
84/bin/rm ${pro}
85#
86if [ ${transform} -eq 1 ]
87then
88# In order to do not have to many revision in svn, we modify some
89# lines produced by idldoc :
90# - add Source link in each html file corresponding to a .pro file
91# example :
92# <td>Source</td>
93# will be replaced by
94# <td><a href="../../Calendar/caldat.pro" title="Source code of a file">Source</a></td>
95#
96# - remove date and time of idldoc production
97# examples :
98# <!-- Generated by IDLdoc 2.0 on Wed Jun  7 10:25:28 2006 -->
99# will be replaced by
100# <!-- Generated by IDLdoc 2.0 -->
101# <div id="tagline">Produced by IDLdoc 2.0 on Wed Jun  7 10:54:37 2006.</div
102# will be replaced by
103# <div id="tagline">Produced by IDLdoc 2.0</div>
104# <h2>Produced on Wed Jun  7 10:23:13 2006</h2>
105# will be delete
106# other lines will be deleted because the time is the time of checkout not
107# the time of revision.
108# the sequence of lines
109#<dl>
110#      <dt>Last modification:</dt>
111#       <dd>Fri Jun  2 11:46:24 2006</dd>
112#    </dl>
113# should also be removed ++ je ne sais pas dire en sed la ligne
114# suivant l'occurence de Last modification
115#
116# count of directory levels in output
117# this count will be use to format relative path later
118nblev1=$(echo ${outputtmp} | sed -e "s@/\$@@" |awk -F "/" '{print NF}')
119#
120list_html_pro=$(find ${outputtmp} -name "*.html" -exec grep -l "<title>.*\.pro" {} \;)
121for file_html in ${list_html_pro}
122do
123 # build the .pro file name
124 bfile=$(basename ${file_html} .html)
125 # retrieve the path of html file relative to memopwd (so relative to
126 # output). This path will be used in "Source" link.
127 nblev2=$(dirname ${file_html} |  sed -e "s@/\$@@" | awk -F "/" '{print NF}')
128 difflev=$((${nblev2} - ${nblev1}))
129 if [ ${difflev} -ge 2 ]
130 then
131  ilev=1
132  reloutput_html=".."
133  while [ ${ilev} -le ${difflev} ]
134  do
135   reloutput_html="${reloutput_html}/.."
136   ilev=$(( ${ilev} + 1 ))
137  done
138  relpath_html=$(dirname ${file_html} | \
139  sed \
140  -e "s@${outputtmp}@${reloutput_html}@" \
141  -e "s@\$@/@")
142  # echo "relpath ${relpath_html})"
143 else
144  relpath_html="./"
145 fi
146 # echo "relpath ${relpath_html}/${bfile}"
147 sed \
148 -e "s@<td >Source<\/td>@<td><a href=\"${relpath_html}/${bfile}.pro\" title=\"Source code of a file\">Source<\/a><\/td>@" \
149 ${file_html} > ${file_html}_modify
150 mv ${file_html}_modify ${file_html}
151done
152list_html=$(find ${outputtmp} -name "*.html")
153for file_html in ${list_html}
154do
155 sed \
156 -e "s/\(Generated by IDLdoc 2.0\)\( on .*\)\( -->\)/\1\3/" \
157 -e "s/\(Produced by IDLdoc 2.0\)\( on .*\)\(\.<\/div>\)/\1\3/" \
158 -e "/<h2>Produced on/d" \
159 -e "/Last modification:/d" \
160 -e "/<dd>... ... .* ..:..:.. ....<\/dd>/d" \
161 -e 's@<div class="value">@<div class="preformat">@' \
162 -e 's/div\#file_comments {/div\#file_comments { white-space: pre;/' \
163 -e 's@^ <fixe>@<pre>@' \
164 -e 's@^ </fixe>@</pre>@' \
165 -e 's@xhtml-transitional@xhtml1-transitional@' \
166 ${file_html} > ${file_html}_modify
167 mv ${file_html}_modify ${file_html}
168done
169# suppress ".html" in idldoc-index*.html in lines like
170# a parameter from the routine ./ReadWrite/idl-NetCDF/ncdf_read.html
171list_html=$(find ${outputtmp} -name "idldoc-index*.html")
172for file_html in ${list_html}
173do
174 sed \
175 -e "s/\(a parameter from the routine \)\(.*\)\(.html\)/\1\2/" \
176 ${file_html} > ${file_html}_modify
177 mv ${file_html}_modify ${file_html}
178done
179# replace <pro>ginette</pro> by a sequence like
180# <a href="./ginette.html">ginette</a>
181./pro2href.sh -i ${outputtmp} -r ${outputtmp} -e pro
182status=${?}
183if [ ${status} -ne 0 ]
184then
185   echo "eee : pb during ./pro2href.sh for <pro>...</pro>"
186   exit 1
187fi
188# replace <proidl>ginette</proidl> by a sequence like
189# <a href="./ginette.html">ginette</a>
190./pro2href.sh -i ${outputtmp} -r ${IDL_DIR}/help/online_help -e proidl
191status=${?}
192if [ ${status} -ne 0 ]
193then
194   echo "eee : pb during ./pro2href.sh for <proidl>...</proidl>"
195   exit 1
196fi
197fi # end of transform = 1
198#
199echo "iii : you can see log file in ${log}"
200echo "iii : and look ${outputtmp}/idldoc-warnings.html#undoc"
201#
202if [ ${assistant} -eq 1 ] 
203then
204# build a idl file to launch idldoc
205output=../idldoc_assistant_output/
206log="/tmp/idldocassistant_${$}.log"
207pro="/tmp/idldocassistant_${$}.pro"
208cat <<EOF > ${pro}
209!path = expand_path('+' + '${idldoc_dir}')
210idldoc,root="${root}",title="${title}", $
211LOG_FILE="${log}", $
212output="${outputtmp}", overview='../../overview', /statistics, /embed, /assistant
213exit
214EOF
215# launch idl with the file built above
216IDL_STARTUP=${pro};${IDL_DIR}/bin/idl
217/bin/rm ${pro}
218# In order to do not have to many revision in svn, we modify some
219# lines produced by idldoc :
220# examples :
221# <!-- Generated by IDLdoc 2.0 on Wed Jun  7 10:25:28 2006 -->
222# will be replaced by
223# <!-- Generated by IDLdoc 2.0 -->
224# <p><font color="gray" size="-3">&nbsp;&nbsp;Produced by IDLdoc 2.0 on Wed Sep 13 16:32:10 2006.</font></p>
225# will be replaced by
226# <p><font color="gray" size="-3">&nbsp;&nbsp;Produced by IDLdoc 2.0</font></p>
227# <h2>Produced on Wed Jun  7 10:23:13 2006</h2>
228# will be delete
229# other lines will be deleted because the time is the time of checkout not
230# the time of revision.
231# the sequence of lines
232#<dl>
233#      <dt>Last modification:</dt>
234#       <dd>Fri Jun  2 11:46:24 2006</dd>
235#    </dl>
236# should also be removed ++ je ne sais pas dire en sed la ligne
237# suivant l'occurence de Last modification
238# replace *_param_* in href attributes because anchors are badly written
239# with _keyword_
240#++ -e 's@\(href="#_.*\)\(_param_\)\(.*"\)@\1_keyword_\3@g' \ # ++ pb global
241#  ONLINE_HELP, book="../idldoc_assistant_output/idldoc-lib.adp", /full_path    # won't work
242# encaspulate example content in <pre> </pre> in idldoc assistant outputs
243# Examples section is supposed to start with <h3>Examples</h3>
244# and end is before <h3>Version history</h3>
245list_html=$(find ${outputtmp} -name "*.html")
246for file_html in ${list_html}
247do
248 sed \
249 -e "s/\(Generated by IDLdoc 2.0\)\( on .*\)\( -->\)/\1\3/" \
250 -e "s/\(Produced by IDLdoc 2.0\)\( on .*\)\(\.<\/font>\)/\1\3/" \
251 -e "/<h2>Produced on/d" \
252 -e "/Last modification:/d" \
253 -e "/<dd>... ... .* ..:..:.. ....<\/dd>/d" \
254 -e '/href/s@_param_@_keyword_@g' \
255 -e 's@<div class="value">@<div class="preformat">@' \
256 -e 's/div\#file_comments {/div\#file_comments { white-space: pre;/' \
257 -e 's@^ <fixe>@<pre>@' \
258 -e 's@^ </fixe>@</pre>@' \
259 -e "s@<h3>Examples</h3>@<h3>Examples</h3><pre>@" \
260 -e "s@<h3>Version history</h3>@</pre><h3>Version history</h3>@" \
261 ${file_html} > ${file_html}_modify
262 mv ${file_html}_modify ${file_html}
263done
264# replace <pro>ginette</pro> by a sequence like
265# <a href="./ginette.html">ginette</a>
266./pro2href.sh -i ${outputtmp} -r ${outputtmp} -e pro
267status=${?}
268if [ ${status} -ne 0 ]
269then
270   echo "eee : pb during ./pro2href.sh for <pro>...</pro>"
271   exit 1
272fi
273# replace <proidl>ginette</proidl> by a sequence like
274# <a href="./ginette.html">ginette</a>
275./pro2href.sh  -i ${outputtmp} -r ${IDL_DIR}/help/online_help -e proidl
276status=${?}
277if [ ${status} -ne 0 ]
278then
279   echo "eee : pb during ./pro2href.sh for <proidl>...</proidl>"
280   exit 1
281fi
282# add the directory-overview.html from dir-files.html in idldoc_html_output
283list_html=$(find ../idldoc_html_output -name dir-files.html)
284for file_html in ${list_html}
285do
286  fout=../idldoc_assistant_output/${file_html#../idldoc_html_output/*}
287  fout=${fout%/*}/directory-overview.html
288  cp ${file_html} ${fout}
289done
290# copy listings.css (needed by directory-overview.html files)
291cp ../idldoc/resource/listings.css ${outputtmp}
292# add an id in idldoc-lib.adp
293cat << EOF > /tmp/adp_modification
294<!-- \$Id\$ -->
295EOF
296sed -e "/<\/profile>/r /tmp/adp_modification" \
297 ../idldoc_assistant_output/idldoc-lib.adp > \
298 ../idldoc_assistant_output/idldoc-lib.adp_${$}
299mv ../idldoc_assistant_output/idldoc-lib.adp_${$} \
300../idldoc_assistant_output/idldoc-lib.adp
301rm /tmp/adp_modification
302echo "iii : you can see log file in ${log}"
303echo "iii : and look ${outputtmp}/idldoc-warnings.html#undoc"
304# check that the number of existing html files for each .pro file is 2!
305for i in $( find ../.. -name "*.pro" )
306do
307  nhtml=$( find ../.. -name $( basename ${i} .pro ).html | wc -l )
308  if [ ${nhtml} -ne 2 ]
309          then
310          echo "ERROR there is not 2 $( basename ${i} .pro ).html files"
311          find ../.. -name $( basename ${i} .pro ).html
312          echo
313  fi
314done
315#
316fi
317# copy of temporary outputs on final directory
318# ++ if transform
319#++mv ${outputtmp} ${output} # ++ rsync
320echo "look at ${outputtmp}/index.html" #++
321# end
322exit 0
Note: See TracBrowser for help on using the repository browser.