asciidoc-helper.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 sedpath outputfile
  7. set -e
  8. if [ $# != 4 ]; then
  9. exit 1;
  10. fi
  11. output=$4
  12. input=`echo $output | $3 -e 's/html\.in$/1\.txt/g' -e 's/1\.in$/1\.txt/g'`
  13. base=`echo $output | $3 -e 's/\.html\.in$//g' -e 's/\.1\.in$//g'`
  14. if [ "$1" = "html" ]; then
  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. if test "$2" != none; then
  28. if $2 -f manpage $input; then
  29. mv $base.1 $output;
  30. else
  31. echo "==================================";
  32. echo;
  33. echo "a2x is installed, but some required docbook support files are";
  34. echo "missing. Please install docbook-xsl and docbook-xml (Debian)";
  35. echo "or similar.";
  36. echo;
  37. echo "==================================";
  38. fi;
  39. else
  40. echo "==================================";
  41. echo;
  42. echo "The manpage for $base will NOT be ";
  43. echo "available, because a2x doesn't appear to be installed!";
  44. echo;
  45. echo "==================================";
  46. fi
  47. fi
  48. touch $output; \