summaryrefslogtreecommitdiff
path: root/gendocs.sh
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-05-30 01:37:57 (GMT)
committer jacob1 <jfu614@gmail.com>2013-05-30 01:37:57 (GMT)
commit3929bdaf5497696dca51803dd2b59f1099915530 (patch)
tree44e215c232b205fe1e47f62d431c38713832380d /gendocs.sh
parentd6d20defdebf72c2b27244a6d4bc8a757a669a59 (diff)
downloadpowder-3929bdaf5497696dca51803dd2b59f1099915530.zip
powder-3929bdaf5497696dca51803dd2b59f1099915530.tar.gz
Documentation for Sconscript by Doxin
Diffstat (limited to 'gendocs.sh')
-rwxr-xr-xgendocs.sh63
1 files changed, 63 insertions, 0 deletions
diff --git a/gendocs.sh b/gendocs.sh
new file mode 100755
index 0000000..996596c
--- /dev/null
+++ b/gendocs.sh
@@ -0,0 +1,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