asciidoc-helper.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/sh
  2. # Copyright (c) The Tor Project, Inc.
  3. # See LICENSE for licensing information
  4. # Run this to generate .html.in or .1.in files from asciidoc files.
  5. # Arguments:
  6. # html|man asciidocpath outputfile
  7. set -e
  8. if [ $# != 3 ]; then
  9. exit 1;
  10. fi
  11. output=$3
  12. if [ "$1" = "html" ]; then
  13. input=${output%%.html.in}.1.txt
  14. base=${output%%.html.in}
  15. if [ "$2" != none ]; then
  16. "$2" -d manpage -o $output $input;
  17. else
  18. echo "==================================";
  19. echo;
  20. echo "The manpage in html form for $base will ";
  21. echo "NOT be available, because asciidoc doesn't appear to be ";
  22. echo "installed!";
  23. echo;
  24. echo "==================================";
  25. fi
  26. elif [ "$1" = "man" ]; then
  27. input=${output%%.1.in}.1.txt
  28. base=${output%%.1.in}
  29. if test "$2" != none; then
  30. if $2 -f manpage $input; then
  31. mv $base.1 $output;
  32. else
  33. echo "==================================";
  34. echo;
  35. echo "a2x is installed, but some required docbook support files are";
  36. echo "missing. Please install docbook-xsl and docbook-xml (Debian)";
  37. echo "or similar.";
  38. echo;
  39. echo "==================================";
  40. fi;
  41. else
  42. echo "==================================";
  43. echo;
  44. echo "The manpage for $base will NOT be ";
  45. echo "available, because a2x doesn't appear to be installed!";
  46. echo;
  47. echo "==================================";
  48. fi
  49. fi
  50. touch $output; \