diff options
Diffstat (limited to 'scripts/markdown-mine')
-rwxr-xr-x | scripts/markdown-mine | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/scripts/markdown-mine b/scripts/markdown-mine new file mode 100755 index 0000000..6505be7 --- /dev/null +++ b/scripts/markdown-mine @@ -0,0 +1,64 @@ +#!/bin/bash + +begin_of_html() { + cat > "$1" <<EOF +<!DOCTYPE html> +<html> +<head> +<meta http-equiv="content-type" content="text/html; charset=utf-8"> +<style> +html, body { + padding: 10px; + padding-left: 4%; + padding-right: 4%; + font-family: monospace; + font-size: 13px; +} + +a { + text-decoration: none; + color: #ab2323; + font-size: 0.95em; + font-weight: bold; +} + +h1 { + font-size: 32px; + padding:3px; +} + +h2 { + border-bottom: 1px solid #dedede; + padding:1px; +} +</style> +</head> +<body> +EOF +} + +_OUTFILE="$2" +_INFILE="$1" + +main() { + begin_of_html "$_OUTFILE" + /usr/bin/markdown "$_INFILE" >> "$_OUTFILE" + echo "</body>" >> "$_OUTFILE" +} + +case $1 in + --help|-h) + echo "$0 file.md out.html" + exit 0 + ;; + *) + if [[ $# -ne 2 ]] + then + echo "Invalid arguments!" + echo "$0 file.md out.html" + else + main + fi + exit 1 + ;; +esac |