#!/bin/sh # # Converts a given .gmi file into an HTML document, which is output to stdout # The content of the .gmi is placed inside a
 tag, with hyperlinks inserted over => links
#

convert() {
	# - The first line sanitises the input, so < and > are ignored
	# - The second line replaces "=> URL NAME" links with an equivalent hyperlink
	cat "$1" | \
		sed 's//\>\;/ ; s/\\n/\\\\n/ ; s/\\t/\\\\t/' | \
		sed 's/=\>\; [[:blank:]]*\([a-zA-Z0-9.:/_-]*\) [[:blank:]]*\(.*\)/=> \2<\/a>/'
}

echo "


	
		$(basename "$1" .gmi)
	

	
		
$(convert "$1")
"