summaryrefslogtreecommitdiff
path: root/libraries/gen_contents_index
blob: bd628ba5513a57787e3f526e7657f11bbcebbd52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh

set -e

if [ -e base/dist ]
then
    HADDOCK_FILES=`ls -1 */dist/doc/html/*/*.haddock | sort`
else
    HADDOCK_FILES=`ls -1 */*.haddock | sort`
fi

# Automagically create the prologue for the combined index via a
# header, the package prologues (in alphabetical order of the
# packages) and a footer.
{
    cat libraries-header.txt
    echo
    # Hack to find out if we're in a build tree or installed docs
    for HADDOCK_FILE in $HADDOCK_FILES
    do
        NAME=`echo "$HADDOCK_FILE" | sed "s#/.*##"`
        if [ "$NAME" != haskell98 ]
        then
            echo "[@${NAME}@]"
            grep -v '^ *$$' "$NAME"/prologue.txt
            echo
            HADDOCK_ARGS="$HADDOCK_ARGS --read-interface=$NAME,$HADDOCK_FILE"
        fi
    done
    cat libraries-footer.txt
    echo
} > libraries.txt

# Now create the combined contents and index pages
haddock --gen-index --gen-contents -o . \
        -t "Haskell Hierarchical Libraries" \
        -p libraries.txt \
        $HADDOCK_ARGS

# Unhandled Windows help stuff?:

#libraries.HxS : libraries.txt
#	 haddock ...
#		-k libraries
#		--html-help=mshelp2
#	( cd $(HTML_DIR) && if Hxcomp -p libraries.HxC -o ../$@ ; then false ; else true ; fi ) || true
#
#libraries.chm : libraries.txt
#	haddock ...
#		-k libraries \
#		--html-help=mshelp \
#	( cd $(HTML_DIR) && if hhc libraries.hhp ; then false ; else true ; fi && mv libraries.chm .. ) || true