From 7dcbff5d337dc1666372c7b0b3c24832ec5dc00d Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 30 May 2020 13:41:12 -0500 Subject: Remove unneeded files --- fold.sh | 26 ------------ typeset_gemini.awk | 122 ----------------------------------------------------- 2 files changed, 148 deletions(-) delete mode 100644 fold.sh delete mode 100644 typeset_gemini.awk diff --git a/fold.sh b/fold.sh deleted file mode 100644 index ee88c6e..0000000 --- a/fold.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -fold() { - shopt -s checkwinsize - ( - : - : - ) - width="${1:-$COLUMNS}" - while read -r line; do - : "${line// / }" - IFS=$'\n' read -d "" -ra words <<<"${line// /$'\n'}" - ll=0 - for word in "${words[@]}"; do - wl="${#word}" - if ((ll + wl > width)); then - printf '\n' - else - ((ll += wl)) - printf '%s ' "$word" - fi - done - done -} - -fold "$@" diff --git a/typeset_gemini.awk b/typeset_gemini.awk deleted file mode 100644 index eb5b7e1..0000000 --- a/typeset_gemini.awk +++ /dev/null @@ -1,122 +0,0 @@ -BEGIN { - pre = 0 - margin = margin ? margin : 4 - # Core lines - txs = "" # text style - lns = "\033[1m" # link number style - lus = "\033[36m" # link url style - lts = "\033[4m" # link text style - pfs = "" # preformatted style - # Advanced lines - h1s = "\033[1;4m" # h1 style - h2s = "\033[1m" # h2 style - h3s = "\033[3m" # h3 style - lis = "" # list item style - # Reset - res = "\033[0m" # reset style -} -/```/ { - pre = ! pre - next -} -pre { - mark = "```" - fmt = pfs "%s" res - text = $0 -} -/^#/ { - match($0, /#+/) - mark = substr($0, RSTART, RLENGTH) - sub(/#+[[:space:]]*/, "", $0) - level = length(mark) - if (level == 1) { - fmt = h1s "%s" res - } else if (level == 2) { - fmt = h2s "%s" res - } else { - fmt = h3s "%s" res - } -} -/^=>/ { - mark = "=>" - sub(/=>[[:space:]]*/, "", $0) - desc = $1 - text = "" - for (w = 2; w <= NF; w++) { - text = text (text ? " " : "") $w - } - fmt = lns "[" (++ln) "]" res " " lts "%s" res "\t" lus "%s" res -} -/^\*[[:space:]]/ { - mark = "*" - sub(/\*[[:space:]]*/, "", $0) - fmt = lis "%s" res -} -{ - mark = mark ? mark : mark - fmt = fmt ? fmt : "%s" - text = text ? text : fold($0, " ") - desc = desc ? desc : "" - printf "%-" margin "s" fmt "\n", mark, text, desc - mark = fmt = text = desc = "" -} -function fold(str, sep, cols, out, cmd, i, j, len, chars, c, last, f, first) -{ - if (! cols) { - # checks if stdout is a tty - if (system("test -t 1")) { - cols = 80 - } else { - cmd = "tput cols" - cmd | getline cols - close(cmd) - } - } - # squeeze tabs and newlines to spaces - gsub(/[\t\n]/, " ", str) - # if "sep" is empty, just fold on cols with substr - if (! length(sep)) { - len = length(str) - out = substr(str, 1, cols) - for (i = cols + 1; i <= len; i += cols) { - out = out "\n" - for (j = 1; j < margin; j++) { - out = out " " - } - out = out substr(str, i, cols) - } - return out - # otherwise, we have to loop over every character (can't split() on sep, it - # would destroy the existing separators) - } else { - # split string into char array - len = split(str, chars, "") - # set boolean, used to assign the first line differently - first = 1 - for (i = 1; i <= len; i += last) { - f = 0 - for (c = i + cols - 1; c >= i; c--) { - if (index(sep, chars[c])) { - last = c - i + 1 - f = 1 - break - } - } - if (! f) { - last = cols - } - if (first) { - out = substr(str, i, last) - first = 0 - } else { - out = out "\n" - for (j = 0; j < margin; j++) { - out = out " " - } - out = out substr(str, i, cols) - } - } - } - # return the output - return out -} -- cgit 1.4.1-21-gabe81