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