blob: d14b679358dfed7c23b8022d556326ce65ce464b (
plain) (
tree)
|
|
#!/bin/bash
function die {
echo "Error:" $*
exit 1
}
TITLE=$2
FILE=$1
[ -z "$FILE" ] && die "File missing!"
# extract title from file if missing
[ -z "$TITLE" ] && TITLE=`sed -e '/^TITLE=\(.*\)/!d' -e 's/^TITLE=\(.*\)/\1/' $FILE`
# if no title specified used file name
[ -z "$TITLE" ] && TITLE=$FILE
# check environment for markdown binary
[ -z "$MARKDOWN" ] && MARKDOWN=markdown2
cat <<EOF
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="verify-v1" content="pZNmf5XyUUfAPdlSPbFSavMUsLgVsmBYOXzOhbIy2gw=" />
<link rel="stylesheet" type="text/css" href="../inc/format-doc.css"/>
<title>$TITLE</title>
</head>
<body>
EOF
$MARKDOWN --extra code-friendly "$FILE"
cat <<EOF
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-3184628-1";
urchinTracker();
</script>
</body>
</html>
EOF
|