#!/usr/bin/awk -f # Read gemtext and output strict xhtml # v19 # each blank line after a blank line is an empty

# extra : convert --- to
# extra : lines starting with // are comments # # CHANGELOG: # * add logo according to hyperlink protocol # logo in # * extra : lines starting with // are comments # * removed   since it is not xml # * changed default for linklogo : disabled # ''foo'' -> foo # * removed ''code'' # * removed linklogos in # * added anchors to headers # * do everything in memory to allow top-printing toc # * fix possible duplicate id # * fix bug for closing " } } # code block /^```/ { if (pre) { print "" } else { print "
" }
	pre = (pre + 1) % 2 # toggle pre
	next
}

pre {
	print htmlescape($0)
	next
}


# empty line
/^$/ {
	if (blank) { print "

" } blank = 1 next } /^\*/ { if (ul == 0) { ul = 1; print "" } }