1
0
Fork 0
postfix/mantools/readme2html
Daniel Baumann 75cf244379
Adding upstream version 3.10.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-21 14:19:32 +02:00

36 lines
600 B
Bash
Executable file

#!/bin/sh
# Crude script to convert plain READMEs to HTML
echo '<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
"https://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Title Here</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>Title Here</h1>'
sed '
s/&/\&amp;/g
s/</\&lt;/g
s/>/\&gt;/g
' "$@" | awk '
/^====+$/ { print "<h2>" line "</h2>"; line = ""; getline; next }
NF == 0 { print line; print $0; print "<p>"; line = $0; next }
{ print line; line = $0 }
END { print line }
'
echo '
</body>
</html>'