parent
7ae93062e6
commit
3780d805bb
@ -0,0 +1,20 @@
|
||||
# man-to-html
|
||||
|
||||
Opinionated man page (roff) to html converter.
|
||||
|
||||
### Usage
|
||||
Here's how [my man page](https://man.eddie.sh) is created:
|
||||
```bash
|
||||
./man-to-html edward-shen.man index.html edward-shen "Edward Shen Manual"
|
||||
```
|
||||
|
||||
You can also specify version number, page number, and date:
|
||||
```bash
|
||||
./man-to-html edward-shen.man index.html edward-shen "Edward Shen Manual" 4.2.0 1 "January 1st, 1970"
|
||||
|
||||
### Prereqs
|
||||
|
||||
- `pandoc`
|
||||
|
||||
|
||||
|
@ -1,8 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
title="Edward Shen Manual"
|
||||
if [[ $# -ne 4 ]]; then
|
||||
echo "USAGE: ./man-to-html INPUT OUTPUT COMMAND TITLE [ VERSION PAGE DATE ]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
version=${5:-"3.2.4"}
|
||||
page=${6:-"7"}
|
||||
date=${7:-"$(date +"%Y-%m-%d")"}
|
||||
|
||||
pandoc -f man -t html \
|
||||
--template man-template \
|
||||
-M title="$title" \
|
||||
-M title="$4" -M date="$date" \
|
||||
-M version="$version" -M cmd="${3^^}($page)" \
|
||||
"$1" > "$2"
|
||||
|
Loading…
Reference in new issue