#!/bin/bash # dillo-gemini # © 2019 cel @f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519 # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. This file is offered as-is, # without any warranty. read -d '>' auth read -d '>' cmd case "$cmd" in "\n" printf "Content-type: text/plain\r\n\r\n" echo Not found } render_gemini() { printf "Content-type: text/html\r\n\r\n" if which ansi2html 2>&1 >/dev/null then ansi2html else cat fi | awk ' BEGIN { print "" } /^```/ { if (!in_literal) { in_literal = 1 print "
"
			} else {
				in_literal = 0
				print "
" } next } in_literal { print next } in_list && !/^\*/ { in_list = 0 print "" } /^\*/ { if (!in_list) { in_list = 1 printf "