#!/bin/sh # Where to find the package documentation? # The documentation of a package is expected at # $packages_dir/package-name/package-version/doc/html packages_dir=archive # Where to store the index files? index_dir=docs # Used by links from the index to the documentation of the packages. # This is the (relative) path from $index_dir to $packages_dir. index_to_packages_dir=../$packages_dir # select all available haddock interface files, but only the newest version of # each package # at the same time, collect all available prolog files and create a master # prolog { for name in `ls -1 $packages_dir | sort` ; do version=`ls $packages_dir/$name/ | sort | tail -n 1` haddock_file=$packages_dir/$name/$version/doc/html/$name.haddock prolog_file=$packages_dir/$name/$version/doc/html/prolog.txt if [ "$name" != "haskell98" ] ; then if [ -e "$haddock_file" ] ; then dir=$index_to_packages_dir/$name/$version/doc/html haddock_args="$haddock_args --read-interface=$dir,$haddock_file" fi if [ -e "$prolog_file" ] ; then echo "[@${name}@]" grep -v '^ *$$' $prolog_file echo fi fi done } > libraries.txt # Now create the combined contents and index pages haddock --gen-index --gen-contents -o $index_dir \ -t "Haskell Hierarchical Libraries" \ -p libraries.txt \ $haddock_args