Don't use "try" as an identifier
[tor.git] / doc / asciidoc-helper.sh
blobea0efbefdca313950389ac55eab3688c7d263075
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 echo "==================================";
50 echo;
51 echo "a2x is installed, but some required docbook support files are";
52 echo "missing. Please install docbook-xsl, docbook-xml, and";
53 echo "libxml2-utils (Debian) or similar.";
54 echo;
55 echo "==================================";
56 exit 1;