html::special () { $SED ' s|\&|\&|g; s|<|\<|g; s|>|\>|g; ' <<< "$@" } html::make_paragraph () { local -r text="$1"; shift test -n "$text" && echo "

$(html::special "$text")

" } html::make_heading () { local -r text=$($SED -E 's/^#+ //' <<< "$1"); shift local -r level="$1"; shift echo "$(html::special "$text")" } html::make_quote () { local -r quote="${1/> }" echo "

$(html::special "$quote")

" } html::make_img () { local link="$1"; shift local descr="$1"; shift if [ -z "$descr" ]; then echo -n "" else echo -n "$descr:" echo -n "\"$descr\"" fi echo "
" } html::make_link () { local link="$1"; shift local descr="$1"; shift grep -F -q '://' <<< "$link" || link=${link/.gmi/.html} test -z "$descr" && descr="$link" echo "$descr
" } html::fromgmi () { local -i is_list=0 local -i is_plain=0 while IFS='' read -r line; do if [ $is_list -eq 1 ]; then if [[ "$line" == '* '* ]]; then echo "
  • ${line/\* /}
  • " else is_list=0 echo "" fi continue elif [ $is_plain -eq 1 ]; then if [[ "$line" == '```'* ]]; then echo "" is_plain=0 else html::special "$line" fi continue fi case "$line" in '* '*) is_list=1 echo "