1#!/bin/sh 2 3# Crude script to convert plain READMEs to HTML 4 5echo '<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" 6 "http://www.w3.org/TR/html4/loose.dtd"> 7 8<html> 9 10<head> 11 12<title>Title Here</title> 13 14<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> 15 16</head> 17 18<body> 19 20<h1>Title Here</h1>' 21 22sed ' 23 s/&/\&/g 24 s/</\</g 25 s/>/\>/g 26' "$@" | awk ' 27/^====+$/ { print "<h2>" line "</h2>"; line = ""; getline; next } 28NF == 0 { print line; print $0; print "<p>"; line = $0; next } 29 { print line; line = $0 } 30END { print line } 31' 32 33echo ' 34</body> 35 36</html>' 37