#!/bin/bash # Path to directory where this script is # https://stackoverflow.com/a/246128/98600 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" # Render txt2tags into html file # Arguments: # 1. txt2tags source file, e.g. download/index.t2t # 2. html target filen, e.g. download/index.html function render_html { t2t=$1 html=$2 relroot="$( dirname $t2t | sed -E 's/^.\///' | sed -E 's/[^/]+/../g' )" pandoc \ --from=t2t \ --to=html5 \ --standalone \ --template="$DIR/_template.html" \ --variable="rel-root:$relroot" \ "$t2t" \ --output="$html" if [ -f "$html" ] ; then sed -i.bak "s/