homepage/tmpl/mdwntohtml

44 lines
920 B
Bash
Executable File

#! /bin/sh
cat <<EOD
<!DOCTYPE html>
<html lang="en">
<head>
EOD
while IFS=': ' read field value; do
case "$field" in
"")
break
;;
Title)
# echo strips leading and trailing whitespace
title=$value
;;
Header)
printf " %s\n" "$value"
;;
esac
done
tmpl=$(dirname $0)
cat <<EOD
<title>$title</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="/neale/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="/neale/css/default.css">
<link rel="stylesheet" type="text/css" media="print" href="/neale/css/print.css">
<link rel="icon" type="image/png" href="/neale/face.png">
</head>
<body>
<h1>$title</h1>
EOD
cat $tmpl/head.tmpl
pandoc -f markdown -t html5
cat $tmpl/foot.tmpl
cat <<EOD
</body>
</html>
EOD