From e569faa91f0f8906c416113010c755fd5cdc79b2 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 11 May 2021 19:54:23 +0100 Subject: refactor --- lib/html.source.sh | 147 ----------------------------------------------------- 1 file changed, 147 deletions(-) delete mode 100644 lib/html.source.sh (limited to 'lib/html.source.sh') diff --git a/lib/html.source.sh b/lib/html.source.sh deleted file mode 100644 index 9fb4a301..00000000 --- a/lib/html.source.sh +++ /dev/null @@ -1,147 +0,0 @@ -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 -r gmi_file=$1 - 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 "