1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#!/bin/bash
set -euo pipefail
asciidoctor=$1
pandoc=$2
stylesheet=$3
version=$4
input=$5
output=$6
tmpfile=$(mktemp "${TMPDIR:-/tmp}/tmp.XXXXXX")
trap 'rm -f "${tmpfile}"' EXIT
"${asciidoctor}" \
-a revnumber="${version}" \
-a icons=font \
-a toc=left \
-a sectanchors \
-a stylesheet="${stylesheet}" \
-b manpage \
-o "${tmpfile}" \
"${input}"
# Convert monospace to bold since that's typically rendered better when viewing
# the man page.
perl -pe "'s!\\\\f\\(CR(.*?)\\\\fP!\\\\fB\\1\\\\fP!g'" "${tmpfile}" >"${output}"
|