summaryrefslogtreecommitdiff
path: root/src/haddock/haddock-script.csh
blob: dd96a0f886dd1063ca2d9c951bb696e91480209c (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/tcsh

######################################################################
# Author: Peter Ljunglöf
# Time-stamp: "2005-02-18, 14:26"
# CVS $Date: 2005/02/18 19:21:06 $
# CVS $Author: peb $
#
# a script for producing documentation through Haddock
######################################################################

set base = `pwd`
set docdir = $base/haddock
set resourcedir = $base/haddock-resources

#set dirs = (. api compile grammar infra shell source canonical useGrammar cf newparsing parsers notrace cfgm speech visualization for-hugs for-ghc)

set files = (`find $base -name '*.hs' -not -path '*/conversions/*' -not -path '*/parsing/*' -not -path '*/for-*' -not -path '*/haddock*' -not -name 'Lex[GC]*' -not -name 'Par[GC]*'` $base/for-ghc-nofud/*.hs)

######################################################################

echo 1. Creating and cleaning Haddock directory
echo -- $docdir

mkdir -p $docdir
rm -r $docdir/*

######################################################################

# echo
# echo 2. Selecting and soft linking Haskell files 

# foreach d ($dirs) 
#     echo -- Directory: $d
#     cd $base/$d
#     foreach f (*.hs) 
#         ln -fs $base/$d/$f $docdir/$f
# 	# tr "\240" " " < $f > $docdir/$f
#     end
# end

######################################################################

# set rmfiles = {Lex,Par}{CFG,GF,GFC}.hs

# echo
# echo 2. Removing unnecessary files

# cd $docdir
# echo -- `ls $rmfiles`
# rm $rmfiles

######################################################################

echo
echo 2. Invoking Haddock

# cd $docdir
haddock -o $docdir -h -t 'Grammatical Framework' $files

######################################################################

echo
echo 3. Restructuring to HTML framesets

cd $docdir
echo -- Substituting for frame targets inside html files
mv index.html index-frame.html
foreach f (*.html) 
    perl -pe 's/<HEAD/<HEAD><BASE TARGET="contents"/; s/"index.html"/"index-frame.html"/; s/(<A HREF = "\S*index\S*.html")/$1 TARGET="index"/' $f > tempfile
    mv tempfile $f
end

cd $resourcedir
echo -- Copying resource files:
echo -- `ls *.*`
cp *.* $docdir

######################################################################

echo
echo 4. Finished
echo -- The documentation is located at:
echo -- $docdir/index.html

cd $base