You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
345 B

#!/usr/bin/env bash
if [[ $# -ne 2 ]]; then
echo "USAGE: ./man-to-html INPUT OUTPUT"
exit 1
fi
set -euo pipefail
eval "meta=($(head -n 1 "$1" | sed "s/.TH //"))"
pandoc -f man -t html \
--template man-template \
-M title="${meta[4]}" -M date="${meta[2]}" \
-M version="${meta[3]}" -M cmd="${meta[0]^^}(${meta[1]})" \
"$1" > "$2"