Better support for option cleanup in python package
[adesklets.git] / doc / htmldoc.sh.in
blob8351b4007d3e116eb421bf34308a6e0995cf751f
1 #! /bin/sh
3 # htmldoc.sh @VERSION@
5 #-------------------------------------------------------------------------------
6 # Copyright (C) 2004, 2005 Sylvain Fourmanoit <syfou@users.sourceforge.net>
7 #
8 # Permission is hereby granted, free of charge, to any person obtaining a copy
9 # of this software and associated documentation files (the "Software"), to
10 # deal in the Software without restriction, including without limitation the
11 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 # sell copies of the Software, and to permit persons to whom the Software is
13 # furnished to do so, subject to the following conditions:
15 # The above copyright notice and this permission notice shall be included in
16 # all copies of the Software and its documentation and acknowledgment shall be
17 # given in the documentation and software packages that this Software was
18 # used.
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 # THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24 # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #-------------------------------------------------------------------------------
28 # Beautifier script that generates decent looking and standard conforming
29 # web documentation out of the texinfo manual.
31 # Usage: ./htmldoc.sh texinfo_filename
33 # This script has been tested on:
35 # - A bourne compliant shell (bash 3.00 & ash 1.6.0)
36 # - GNU texinfo 4.7
37 # - htmltidy (http://tidy.sourceforge.net/), from 1st october 2003
38 # - GNU sed 4.09
40 # Note: this script is likely not to work out of the box, due to
41 # its uncommon dependencies.
42 # No special care have been devoted to its portability at this time
43 # because it is mainly usefull to the maintainer. Complete documentation
44 # is provided to the user already compiled both as a texinfo manual and
45 # in HTML form.
47 #-------------------------------------------------------------------------------
48 if test "x@TIDY@" == "x" || ! test -x "@TIDY@" ; then
49 echo "Could not find htmltidy." 1>&2
52 DIR=`echo "$1" | sed 's/\.texi$//'`
53 LANG=`echo "$1" | sed 's/[^_]\+_\([^\.]\+\)\.texi/\1/'`
55 @MAKEINFO@ --html $1
56 if test "$?" -ne 0; then
57 echo "Could not find file '$1' or execute makeinfo" 1>&2
58 exit 1
61 mkdir html/${LANG} 2> /dev/null
62 for file in `ls $DIR/*.html` ; do
63 (cat "$file" | @TIDY@ --tidy-mark false -quiet -asxhtml -i > html/${LANG}/`basename "$file"`) 2>&1 | \
64 sed -n "/Error:/p"
65 if test $? -ge 2 ; then
66 echo "Error. Exiting." 1>&2
67 exit 1
69 sed -i -e '/<\/head>/i<!--This style sheet is adapted from Rob Chandanais work. Have a look at it for complete details -->' -e '/<\/head>/i<style type="text\/css" media="all">@import "..\/reservoir.css";<\/style>' -e '/<body>/a<div class="Content">' -e '/<\/body>/i</div>' html/${LANG}/`basename "$file"`
70 done
72 rm -rf "$DIR"
73 exit 0