blob: 7b4dd444c76545edaf6f11658d4d44b49277c222 (
plain)
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
28
29
30
31
32
33
34
35
36
|
#!/bin/sh
# Crude script to convert plain READMEs to HTML
echo '<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://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/&/\&/g
s/</\</g
s/>/\>/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>'
|