~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to tools/build_html_index.sh

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
# generates HTML man pages docs/html/index.html
4
 
# (c) The GRASS Development Team, and Markus Neteler, 2003, 2004, 2005, 2006, 2009
5
 
 
6
 
## TODO: better fix this in include/Make/Html.make, see RT bug #5361
7
 
 
8
 
# exclude following list of modules from help index:
9
 
 
10
 
EXCLUDEMODS="\
11
 
d.font.freetype \
12
 
d.paint.labels \
13
 
d.text.freetype \
14
 
i.ask \
15
 
i.find \
16
 
p.out.vrml \
17
 
photo.elev \
18
 
photo.target \
19
 
r.cats \
20
 
r.watershed.ram \
21
 
r.watershed.seg \
22
 
v.topo.check \
23
 
helptext.html \
24
 
gis.m \
25
 
wxGUI.*"
26
 
 
27
 
# these modules don't use G_parser()
28
 
check_for_desc_override()
29
 
{
30
 
    case "$BASENAME" in
31
 
        g.parser)
32
 
            SHORTDESC="Provides automated parser, GUI, and help support for GRASS scipts."
33
 
            ;;
34
 
        r.mapcalc)
35
 
            SHORTDESC="Raster map calculator."
36
 
            ;;
37
 
        r3.mapcalc)
38
 
            SHORTDESC="3D raster map calculator."
39
 
            ;;
40
 
        r.li.daemon)
41
 
            SHORTDESC="Support module for r.li landscape index calculations."
42
 
            ;;
43
 
    esac
44
 
}
45
 
 
46
 
 
47
 
############# nothing to configure below ############
48
 
 
49
 
# regex-proof module skip list
50
 
EXCLUDEHTML="`echo "$EXCLUDEMODS" | tr ' ' '|' | sed -e 's+\.+\\\\.+g' -e 's+|+\\\\|+g'`"
51
 
 
52
 
#fetch the ARCH for store the files:
53
 
ARCH="`cat ../include/Make/Platform.make | grep '^ARCH'  | sed 's+ ++g' | cut -d'=' -f2`"
54
 
GEMDIR="../gem"
55
 
HTMLDIR="../dist.$ARCH/docs/html"
56
 
GRASSVERSION=`cat ../dist.$ARCH/etc/VERSIONNUMBER`
57
 
GRASS_MMVER=`cut -d . -f 1-2 ../dist.$ARCH/etc/VERSIONNUMBER`
58
 
MACOSX=`echo $ARCH | grep -i darwin`
59
 
 
60
 
 
61
 
write_html_header()
62
 
{
63
 
# $1: filename
64
 
# $2: page title
65
 
# $3: is it main index
66
 
 
67
 
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
68
 
<html>
69
 
<head>
70
 
 <title>$2</title>
71
 
 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
72
 
 <meta name=\"Author\" content=\"GRASS Development Team\">" > "$1"
73
 
if [ "$3" ] && [ "$MACOSX" ] ; then
74
 
        echo " <meta name=\"AppleTitle\" content=\"GRASS GIS $GRASSVERSION Help\">
75
 
 <meta name=\"AppleIcon\" content=\"GRASS-$GRASS_MMVER/grass_icon.png\">
76
 
 <meta name=\"robots\" content=\"anchors\">" >> "$1"
77
 
fi
78
 
echo " <link rel=\"stylesheet\" href=\"grassdocs.css\" type=\"text/css\">
79
 
</head>
80
 
<body bgcolor=\"#FFFFFF\">
81
 
 
82
 
<!-- this file is generated by tools/build_html_index.sh -->
83
 
 
84
 
<img src=\"grass_logo.png\" alt=\"GRASS logo\"><hr align=center size=6 noshade>
85
 
 
86
 
<h2>GRASS GIS $GRASSVERSION Reference Manual</h2>
87
 
 
88
 
<p><b>Geographic Resources Analysis Support System</b>, commonly
89
 
referred to as <a href=\"http://grass.osgeo.org\">GRASS</a>, is a <a
90
 
href=\"http://en.wikipedia.org/wiki/Geographic_information_system\">Geographic
91
 
Information System</a> (GIS) used for geospatial data management and
92
 
analysis, image processing, graphics/maps production, spatial
93
 
modeling, and visualization. GRASS is currently used in academic and
94
 
commercial settings around the world, as well as by many governmental
95
 
agencies and environmental consulting companies.</p>
96
 
 
97
 
<p>This reference manual details the use of modules distributed with
98
 
Geographic Resources Analysis Support System (GRASS), an open source (GNU
99
 
GPL'ed), image processing and geographic information system (GIS).</p>
100
 
 
101
 
" >> "$1"
102
 
}
103
 
 
104
 
 
105
 
write_html_cmd_overview()
106
 
{
107
 
BOXCOLOR="#e1ecd0"
108
 
echo "
109
 
<!-- the files grass6.html & helptext.html file live in lib/init/ -->
110
 
<table border=\"0\" cellspacing=\"8\" align=\"center\">
111
 
  <tbody>
112
 
    <tr>
113
 
      <td valign=\"top\" bgcolor=\"$BOXCOLOR\" class="box"><h3>&nbsp;Quick Introduction</h3>
114
 
      <ul>
115
 
       <li><a href=\"helptext.html\">How to start with GRASS</a></li>
116
 
      </ul>
117
 
     <p>
118
 
      <ul>
119
 
       <li><a href=\"projectionintro.html\">Intro projections and spatial transformations</a></li>
120
 
       <li><a href=\"rasterintro.html\">Intro 2D raster map processing</a></li>
121
 
       <li><a href=\"raster3dintro.html\">Intro 3D raster map (voxel) processing</a></li>
122
 
       <li><a href=\"imageryintro.html\">Intro image processing</a></li>
123
 
       <li><a href=\"vectorintro.html\">Intro vector map processing and network analysis</a></li>
124
 
       <li><a href=\"databaseintro.html\">Intro database management</a></li>
125
 
      </ul></td>
126
 
      <td valign=\"top\" bgcolor=\"$BOXCOLOR\" class="box"><h3>&nbsp;Display/Graphical User Interfaces</h3>
127
 
       <ul>
128
 
        <li><a href=\"wxGUI.html\">wxGUI</a> wxPython-based GUI frontend</li>
129
 
        <li><a href=\"gis.m.html\">gis.m</a> and <a href=d.m.html>d.m</a> TCL/TK-based GUI frontend</li>
130
 
       </ul>
131
 
 
132
 
       <ul>
133
 
        <li><a href=\"display.html\">Display commands manual</a></li>
134
 
        <li><a href=\"displaydrivers.html\">Display drivers</a></li>
135
 
       </ul>
136
 
 
137
 
       <ul>
138
 
        <li><a href=\"nviz.html\">nviz</a> 3D visualization and animation tool</li>
139
 
        <li><a href=\"xganim.html\">xganim</a> tool  for animating a raster map series</li>
140
 
       </ul></td>
141
 
    </tr>
142
 
    <tr>
143
 
      <td valign=\"top\" bgcolor=\"$BOXCOLOR\" class="box"><h3>&nbsp;Raster and voxel processing</h3>
144
 
       <ul>
145
 
        <li><a href=\"raster.html\">Raster commands manual</a></li>
146
 
        <li><a href=\"raster3D.html\">Raster3D commands manual</a></li>
147
 
      </ul></td>
148
 
      <td valign=\"top\" bgcolor=\"$BOXCOLOR\" class="box"><h3>&nbsp;Image processing</h3>
149
 
       <ul>
150
 
        <li><a href=\"imagery.html\">Imagery commands manual</a></li>
151
 
      </ul></td>
152
 
    </tr>
153
 
    <tr>
154
 
      <td valign=\"top\" bgcolor=\"$BOXCOLOR\" class="box"><h3>&nbsp;Vector processing</h3>
155
 
       <ul>
156
 
        <li><a href=\"vector.html\">Vector commands manual</a></li>
157
 
      </ul></td>
158
 
      <td valign=\"top\" bgcolor=\"$BOXCOLOR\" class="box"><h3>&nbsp;Database</h3>
159
 
       <ul>
160
 
       <li><a href=\"sql.html\">SQL support in GRASS GIS</a></li>
161
 
       <li><a href=\"database.html\">Database commands manual</a></li>
162
 
       </ul></td>
163
 
    </tr>
164
 
    <tr>
165
 
      <td valign=\"top\" bgcolor=\"$BOXCOLOR\" class="box"><h3>&nbsp;General</h3>
166
 
      <ul>
167
 
      <li><a href=\"grass6.html\">GRASS startup manual page</a></li>
168
 
      <li><a href=\"general.html\">General commands manual</a></li>
169
 
      </ul></td>
170
 
      <td valign=\"top\" bgcolor=\"$BOXCOLOR\" class="box"><h3>&nbsp;Miscellaneous</h3>
171
 
       <ul>
172
 
        <li><a href=\"misc.html\">Misc. commands manual</a></li>
173
 
        <li><a href=\"gem/index.html\">The GRASS Extensions Manager (GEM)</a></li>
174
 
       </ul></td>
175
 
    </tr>
176
 
    <tr>
177
 
      <td valign=\"top\" bgcolor=\"$BOXCOLOR\" class="box"><h3>&nbsp;Variables</h3>
178
 
       <ul>
179
 
        <li><a href=\"variables.html\">GRASS variables and environment variables</a></li>
180
 
       </ul></td>
181
 
      <td valign=\"top\" bgcolor=\"$BOXCOLOR\" class="box"><h3>&nbsp;Printing</h3>
182
 
       <ul>
183
 
        <li><a href=\"postscript.html\">Postscript commands manual</a></li>
184
 
       </ul></td>
185
 
    </tr>
186
 
  </tbody>
187
 
</table>
188
 
 
189
 
" >> "$1"
190
 
}
191
 
 
192
 
write_html_footer()
193
 
{
194
 
# $1: filename
195
 
# $2: help index url
196
 
echo "<BR><BR>
197
 
<hr>
198
 
<p><a href=\"$2\">Help Index</a> | <a href=\"full_index.html\">Full Index</a><br>
199
 
&copy; 2003-2010 <a href=\"http://grass.osgeo.org\">GRASS Development Team</a></p>
200
 
</body>
201
 
</html>" >> "$1"
202
 
}
203
 
 
204
 
expand_module_class_name()
205
 
{
206
 
# $1: module class
207
 
 if [ "$1" = "d" ]  ; then 
208
 
    echo "display"  
209
 
  elif [ "$1" = "db" ] ; then 
210
 
    echo "database" 
211
 
  elif [ "$1" = "g" ]  ; then 
212
 
    echo "general" 
213
 
  elif [ "$1" = "i" ]  ; then 
214
 
    echo "imagery" 
215
 
  elif [ "$1" = "m" ]  ; then 
216
 
    echo "misc" 
217
 
  elif [ "$1" = "ps" ] ; then 
218
 
    echo "postscript" 
219
 
  elif [ "$1" = "p" ]  ; then 
220
 
    echo "paint" 
221
 
  elif [ "$1" = "r" ]  ; then 
222
 
    echo "raster" 
223
 
  elif [ "$1" = "r3" ]  ; then 
224
 
    echo "raster3D" 
225
 
  elif [ "$1" = "s" ]  ; then 
226
 
    echo "sites" 
227
 
  elif [ "$1" = "v" ]  ; then 
228
 
    echo "vector" 
229
 
  else 
230
 
    echo "$1"
231
 
 fi
232
 
}
233
 
 
234
 
#are we in the tools/ dir?
235
 
ls build_html_index.sh 2> /dev/null
236
 
if [ $? -eq 1 ] ; then
237
 
 echo "ERROR: this script must be run from the tools/ directory"
238
 
 exit 1
239
 
fi
240
 
 
241
 
FULLINDEX=full_index.html
242
 
 
243
 
################
244
 
 
245
 
#copy over CSS:
246
 
cp -f grassdocs.css $HTMLDIR/
247
 
mkdir -p $HTMLDIR/nviz/
248
 
cp -f grassdocs.css $HTMLDIR/nviz/
249
 
chmod a+r $HTMLDIR/grassdocs.css $HTMLDIR/nviz/grassdocs.css
250
 
#copy over GRASS logo:
251
 
cp -f grass_logo.png $HTMLDIR/
252
 
cp -f grass_logo.png $HTMLDIR/nviz/
253
 
chmod a+r $HTMLDIR/grass_logo.png $HTMLDIR/nviz/grass_logo.png
254
 
if [ "$MACOSX" ] ; then
255
 
  cp -f grass_icon.png $HTMLDIR/
256
 
  chmod a+r $HTMLDIR/grass_icon.png
257
 
fi
258
 
#copy over GEM docs:
259
 
mkdir -p $HTMLDIR/gem
260
 
cp -f $GEMDIR/docs/GEM-Manual/*.html $HTMLDIR/gem/
261
 
cp -f $GEMDIR/docs/GEM-Manual/img* $HTMLDIR/gem/
262
 
chmod a+r $HTMLDIR/gem/*.html $HTMLDIR/gem/img*
263
 
 
264
 
#process all HTML pages:
265
 
cd $HTMLDIR
266
 
 
267
 
#get list of available GRASS modules:
268
 
CMDLIST=`ls -1 *.*.html | grep -v "$FULLINDEX" | grep -v index.html | \
269
 
  grep -v gis.m.html | grep -v "\($EXCLUDEHTML\)" | cut -d'.' -f1 | sort -u | \
270
 
  grep -v photo`
271
 
CMDLISTNO=`echo $CMDLIST | wc -w | awk '{print $1}'`
272
 
 
273
 
#write main index:
274
 
echo "Generating HTML manual pages index (help system)..."
275
 
write_html_header "$FULLINDEX" "GRASS GIS $GRASSVERSION Reference Manual: Full index"
276
 
echo "Go <a href=\"index.html\">back to help overview</a><BR>" >> "$FULLINDEX"
277
 
echo "<BR><h3>Full command index:</h3>" >> "$FULLINDEX"
278
 
 
279
 
#generate main index of all modules:
280
 
echo "[ " >> "$FULLINDEX"
281
 
k=0
282
 
for i in $CMDLIST
283
 
do
284
 
  k=`expr $k + 1`
285
 
  echo -n "<b><a href=\"#$i\">$i.*</a></b>" >> "$FULLINDEX"
286
 
  if [ $k -lt $CMDLISTNO ] ; then
287
 
     echo -n " | " >> "$FULLINDEX"
288
 
  fi
289
 
done
290
 
echo " ]
291
 
<BR><BR>
292
 
" >> "$FULLINDEX"
293
 
 
294
 
echo "<table border=0>" >> "$FULLINDEX"
295
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"full_index.html#d\">d.*</a> </td><td>display commands</td></tr>" >> "$FULLINDEX"
296
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"full_index.html#db\">db.*</a> </td><td>database commands</td></tr>" >> "$FULLINDEX"
297
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"full_index.html#g\">g.*</a> </td><td>general commands</td></tr>" >> "$FULLINDEX"
298
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"full_index.html#i\">i.*</a> </td><td>imagery commands</td></tr>" >> "$FULLINDEX"
299
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"full_index.html#m\">m.*</a> </td><td>miscellaneous commands</td></tr>" >> "$FULLINDEX"
300
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"full_index.html#ps\">ps.*</a> </td><td>postscript commands</td></tr>" >> "$FULLINDEX"
301
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"full_index.html#r\">r.*</a> </td><td>raster commands</td></tr>" >> "$FULLINDEX"
302
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"full_index.html#r3\">r3.*</a> </td><td>raster3D commands</td></tr>" >> "$FULLINDEX"
303
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"full_index.html#v\">v.*</a> </td><td>vector commands</td></tr>" >> "$FULLINDEX"
304
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"gis.m.html\">gis.m</a> </td><td>GUI frontend to GIS menus and display</td></tr>" >> "$FULLINDEX"
305
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"nviz.html\">nviz</a> </td><td>visualization suite</td></tr>" >> "$FULLINDEX"
306
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"wxGUI.html\">wxGUI</a> </td><td>wxPython-based GUI frontend</td></tr>" >> "$FULLINDEX"
307
 
echo "<tr><td>&nbsp;&nbsp;<a href=\"xganim.html\">xganim</a> </td><td>raster map slideshow</td></tr>" >> "$FULLINDEX"
308
 
echo "</table>" >> "$FULLINDEX"
309
 
 
310
 
##########
311
 
#for all module groups:
312
 
for i in $CMDLIST
313
 
do 
314
 
  echo "<a name=\"$i\"></a>" >> "$FULLINDEX"
315
 
  echo "<BR><h3>$i.* commands:</h3>" >> "$FULLINDEX"
316
 
  echo "<table>" >> "$FULLINDEX"
317
 
 
318
 
  #for all modules:  
319
 
  for i in `ls -1 $i.*.html | grep -v "\($EXCLUDEHTML\)"`
320
 
  do
321
 
    BASENAME=`basename $i .html`
322
 
    SHORTDESC="`cat $i | awk '/NAME/,/SYNOPSIS/' | grep '<em>' | cut -d'-' -f2- | sed 's+^ ++g' | grep -vi 'SYNOPSIS' | head -n 1`"
323
 
    check_for_desc_override
324
 
    echo "<tr><td valign="top"><a href=\"$i\">$BASENAME</a></td> <td>$SHORTDESC</td></tr>" >> "$FULLINDEX"
325
 
  done
326
 
  echo "</table>" >> "$FULLINDEX"
327
 
done
328
 
 
329
 
write_html_footer "$FULLINDEX" index.html
330
 
# done full index
331
 
 
332
 
#next write separate module pages:
333
 
#for all module groups:
334
 
for k in $CMDLIST
335
 
do 
336
 
  MODCLASS=`expand_module_class_name $k`
337
 
  FILENAME=$MODCLASS.html
338
 
 
339
 
  write_html_header "$FILENAME" "GRASS GIS $GRASSVERSION Reference Manual: $MODCLASS"
340
 
  echo "Go <a href=\"index.html\">back to help overview</a><BR><BR><BR>" >>  "$FILENAME"
341
 
 
342
 
  echo "<b>$MODCLASS commands:</b>" >> "$FILENAME"
343
 
  echo "<table>" >> "$FILENAME"
344
 
  #for all modules:
345
 
  for k in `ls -1 $k.*.html | grep -v "\($EXCLUDEHTML\)"`
346
 
  do
347
 
    BASENAME=`basename $k .html`
348
 
    SHORTDESC="`cat $k | awk '/NAME/,/SYNOPSIS/' | grep '<em>' | cut -d'-' -f2- | sed 's+^ ++g' | grep -vi 'SYNOPSIS' | head -n 1`"
349
 
    check_for_desc_override
350
 
    echo "<tr><td valign="top"><a href=\"$k\">$BASENAME</a></td> <td>$SHORTDESC</td></tr>" >> "$FILENAME"
351
 
  done
352
 
  
353
 
  echo "</table>" >> "$FILENAME"
354
 
 
355
 
  write_html_footer "$FILENAME" index.html
356
 
done
357
 
 
358
 
#next write main page:
359
 
FILENAME=index.html
360
 
write_html_header "$FILENAME" "GRASS GIS $GRASSVERSION Reference Manual" 1
361
 
write_html_cmd_overview "$FILENAME"
362
 
 
363
 
#insert a special comment so that GEM will know where to merge docs of extensions
364
 
echo >> "$FILENAME"
365
 
echo "<!-- GEM Extensions StartHTML. Do not delete or change this comment! -->" >> "$FILENAME"
366
 
echo >> "$FILENAME"
367
 
 
368
 
 
369
 
#############
370
 
write_html_footer "$FILENAME" index.html
371
 
 
372
 
#############
373
 
echo "Generated HTML docs in $HTMLDIR/index.html"
374
 
echo "----------------------------------------------------------------------"
375
 
echo "Following modules are missing the 'description.html' file in src code:"
376
 
for i in `find . -name "*.*.html" | sort | grep -v "$FULLINDEX"  | grep -v 'index.html' | grep -v "$EXCLUDEHTML"`
377
 
do
378
 
  if grep 'DESCRIPTION' $i >/dev/null 2>&1 ; then 
379
 
    :
380
 
  else
381
 
    echo `echo $i | sed 's?./??' | sed 's/.html//'`
382
 
  fi
383
 
done
384
 
echo "----------------------------------------------------------------------"