aboutsummaryrefslogtreecommitdiff
path: root/doc/asciidoc-helper.sh
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2010-01-18 22:15:38 +0100
committerSebastian Hahn <sebastian@torproject.org>2010-01-27 12:13:05 +0100
commit9fe1c000b0b1a91acf605ef71a538da7b7218fe9 (patch)
tree717008dd8a0d06d0c850e0bcbb3e981a297c72f0 /doc/asciidoc-helper.sh
parent3efadcd0d5373cc38986cdf93d03a1d99ec8aee0 (diff)
downloadtor-9fe1c000b0b1a91acf605ef71a538da7b7218fe9.tar
tor-9fe1c000b0b1a91acf605ef71a538da7b7218fe9.tar.gz
Allow generating documentation from asciidoc in the Makefile
Diffstat (limited to 'doc/asciidoc-helper.sh')
-rwxr-xr-xdoc/asciidoc-helper.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/doc/asciidoc-helper.sh b/doc/asciidoc-helper.sh
new file mode 100755
index 000000000..90a003d49
--- /dev/null
+++ b/doc/asciidoc-helper.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# Copyright (c) The Tor Project, Inc.
+# See LICENSE for licensing information
+# Run this to generate .html.in or .1.in files from asciidoc files.
+# Arguments:
+# html|man asciidocpath sedpath outputfile
+
+set -e
+
+if [ $# != 4 ]; then
+ exit 1;
+fi
+
+output=$4
+input=`echo $output | $3 -e 's/html\.in$/1\.txt/g' -e 's/1\.in$/1\.txt/g'`
+base=`echo $output | $3 -e 's/\.html\.in$//g' -e 's/\.1\.in$//g'`
+
+if [ "$1" = "html" ]; then
+ if [ "$2" != none ]; then
+ "$2" -d manpage -o $output $input;
+ else
+ echo "==================================";
+ echo;
+ echo "The manpage in html form for $base will ";
+ echo "NOT be available, because asciidoc doesn't appear to be ";
+ echo "installed!";
+ echo;
+ echo "==================================";
+ fi
+elif [ "$1" = "man" ]; then
+ if test "$2" != none; then
+ if $2 -f manpage $input; then
+ mv $base.1 $output;
+ else
+ echo "==================================";
+ echo;
+ echo "a2x is installed, but some required docbook support files are";
+ echo "missing. Please install docbook-xsl and docbook-xml (Debian)";
+ echo "or similar.";
+ echo;
+ echo "==================================";
+ fi;
+ else
+ echo "==================================";
+ echo;
+ echo "The manpage for $base will NOT be ";
+ echo "available, because a2x doesn't appear to be installed!";
+ echo;
+ echo "==================================";
+ fi
+fi
+
+touch $output; \