#!/bin/bash

TO_INSERT="$(markdown_py $1)"
HEADLINE="$(head -n 1 $1)"
STRIPPED_HEAD=${HEADLINE:2}
UUID="$(uuidgen)"

awk -v uuid="$UUID" -v stripped_head="$STRIPPED_HEAD" -v to_insert="$TO_INSERT" '{sub(/REPLACE/,stripped_head);
sub(/inserthere/,to_insert);
sub(/REPUUID/,uuid); print}' template.html
