#!/bin/sh # script to convert a .md file (specified as a commandline argument) # into a html + pdf documentation using 'markdown' and 'pandoc' # exit if no argument given [ -z "$1" ] && { echo "Error: Usage: build-doc [filename]"; exit 1; } # compiling md to html (raw) markdown -o "precomp.html" "$1" # get directory of script basename="$(dirname $0)" # add code background + correct media path (for pandoc) # (made crossplatfarm by assuming BSD-like SED) sed "s/
//g;
s/<\/code><\/pre>/<\/code><\/pre><\/div>/g;
s/media\//\.\.\/media\//g;" precomp.html > tmp.html &&
mv tmp.html precomp.html
pre="
gizmo documentation
"
precomp=$(cat "precomp.html")
after="
follow this project on
github