summaryrefslogtreecommitdiff
path: root/gendocs.sh
blob: 996596c322b5db0ea08100fc7bf73fe36929b371 (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
#!/bin/bash

# Documentation generator
# =======================

# the purpose of this script is to generate html documentation from the source code of specified files.

# requirements
# ============

# this script requires pylit to be installed and the rst2html command to be available

# pre generation
# ==============

# make sure the script terminates on errors

set -e

# skip pregeneration if we get any commandline parameters

if [ $# == 0 ]
then

# list of files to generate documentation for. the format is always::

#   "$0 filename language"

# the following languages are available:
# - c
# - c++
# - css
# - python
# - shell
# - slang
# - latex

    $0 SConscript python
    $0 gendocs.sh shell

# exit program after running all the generation steps

    exit
fi

# generation
# ==========

# inform the user of which file we're processing

echo "--- generating docs for $1"

# run pylit to convert source code to restructured text

pylit $1 --language $2 $1.txt

# run rst2html to convert restructured text to html

rst2html.py $1.txt --stylesheet docs/style.css > docs/$1.html

# clean up the restructured text file

rm $1.txt