fix typos, logic error, default in man page
[tor.git] / doc / asciidoc-helper.sh
blob33e1360a71c035e891ab96c99bcf1cf07d3eeb60
1 #!/bin/sh
3 # Copyright (c) The Tor Project, Inc.
4 # See LICENSE for licensing information
5 # Run this to generate .html.in or .1.in files from asciidoc files.
6 # Arguments:
7 # html|man asciidocpath outputfile
9 set -e
11 if [ $# != 3 ]; then
12 exit 1;
15 output=$3
17 if [ "$1" = "html" ]; then
18 input=${output%%.html.in}.1.txt
19 base=${output%%.html.in}
21 if [ "$2" != none ]; then
22 "$2" -d manpage -o $output $input;
23 else
24 echo "==================================";
25 echo;
26 echo "You need asciidoc installed to be able to build the manpage.";
27 echo "To build without manpages, use the --disable-asciidoc argument";
28 echo "when calling configure.";
29 echo;
30 echo "==================================";
31 exit 1;
33 elif [ "$1" = "man" ]; then
34 input=${output%%.1.in}.1.txt
35 base=${output%%.1.in}
37 if test "$2" = none; then
38 echo "==================================";
39 echo;
40 echo "You need asciidoc installed to be able to build the manpage.";
41 echo "To build without manpages, use the --disable-asciidoc argument";
42 echo "when calling configure.";
43 echo;
44 echo "==================================";
45 exit 1;
47 if "$2" -f manpage $input; then
48 mv $base.1 $output;
49 else
50 cat<<EOF
51 ==================================
52 You need a working asciidoc installed to be able to build the manpage.
54 a2x is installed, but for some reason it isn't working. Sometimes
55 This happens because required docbook support files are missing.
56 Please install docbook-xsl, docbook-xml, and libxml2-utils (Debian) or
57 similar.
59 Alternatively, to build without manpages, use the --disable-asciidoc
60 argument when calling configure.
61 ==================================
62 EOF
63 exit 1;