made it public

master
Edward Shen 2019-04-11 16:12:50 -04:00
parent 7ae93062e6
commit 3780d805bb
Signed by: edward
GPG Key ID: F350507060ED6C90
4 changed files with 66 additions and 12 deletions

20
README.md Normal file
View File

@ -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`

View File

@ -15,12 +15,21 @@ body, p, h1 {
}
body { margin: 1rem }
p { margin-left: 7ch; margin-bottom: 1rem }
.formatted { margin-left: 0; white-space: pre }
.formatted {
width: 80ch;
max-width: 80ch;
display: flex;
justify-content: space-between;
}
.formatted p { margin-left: 0; width:max-content }
</style>
</head>
<body>
<p class="formatted">EDWARD-SHEN(7) Edward Shen Manual EDWARD-SHEN(7)</p>
<div class="formatted">
<p>EDWARD-SHEN(7)</p>
<p>Edward Shen Manual</p>
<p>EDWARD-SHEN(7)</p>
</div>
<h1>NAME</h1>
<p>edward-shen - some random software developer</p>
<h1>SYNOPSIS</h1>
@ -54,7 +63,10 @@ Team TBD.</p>
<p>We would also like to thank all contributors and friends who had helped develop Edward Shen.</p>
<h1>COPYRIGHT</h1>
<p>This man page is under GPLv3 or later. To use Edward Shen for any purpose, please contact Edward Shen &lt;code@eddie.sh&gt; to request a license.</p>
<p class="formatted">3.2.4 2019-04-10 EDWARD-SHEN(7)</p>
<div class="formatted">
<p>3.2.4</p>
<p>2019-04-11</p>
<p>EDWARD-SHEN(7)</p>
</div>
</body>
</html>

View File

@ -15,14 +15,26 @@ body, p, h1 {
}
body { margin: 1rem }
p { margin-left: 7ch; margin-bottom: 1rem }
.formatted { margin-left: 0; white-space: pre }
.formatted {
width: 80ch;
max-width: 80ch;
display: flex;
justify-content: space-between;
}
.formatted p { margin-left: 0; width:max-content }
</style>
</head>
<body>
<p class="formatted">EDWARD-SHEN(7) Edward Shen Manual EDWARD-SHEN(7)</p>
$header$
<div class="formatted">
<p>$cmd$</p>
<p>$title$</p>
<p>$cmd$</p>
</div>
$body$
$footer$
<p class="formatted">3.2.4 2019-04-10 EDWARD-SHEN(7)</p>
<div class="formatted">
<p>$version$</p>
<p>$date$</p>
<p>$cmd$</p>
</div>
</body>
</html>

View File

@ -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"