explain an argument in a function comment
[tor.git] / doc / asciidoc-helper.sh
blob00f8b8d07f66999a8d558e78457f3443e0ca051f
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}
20 if [ "$2" != none ]; then
21 "$2" -d manpage -o $output $input;
22 else
23 echo "==================================";
24 echo;
25 echo "You need asciidoc installed to be able to build the manpage.";
26 echo "To build without manpages, use the --disable-asciidoc argument";
27 echo "when calling configure.";
28 echo;
29 echo "==================================";
30 exit 1;
32 elif [ "$1" = "man" ]; then
33 input=${output%%.1.in}.1.txt
34 base=${output%%.1.in}
36 if test "$2" = none; then
37 echo "==================================";
38 echo;
39 echo "You need asciidoc installed to be able to build the manpage.";
40 echo "To build without manpages, use the --disable-asciidoc argument";
41 echo "when calling configure.";
42 echo;
43 echo "==================================";
44 exit 1;
46 if "$2" -f manpage $input; then
47 mv $base.1 $output;
48 else
49 cat<<EOF
50 ==================================
51 You need a working asciidoc installed to be able to build the manpage.
53 a2x is installed, but for some reason it isn't working. Sometimes
54 This happens because required docbook support files are missing.
55 Please install docbook-xsl, docbook-xml, and libxml2-utils (Debian) or
56 similar.
58 Alternatively, to build without manpages, use the --disable-asciidoc
59 argument when calling configure.
60 ==================================
61 EOF
62 exit 1;