From acc9d4587f930fdd7f7be5d3973b1e709f3ba029 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Mon, 11 Feb 2019 23:38:27 +0100 Subject: [PATCH] use shorthand html --- .gitmodules | 3 ++ autoslide.sh | 88 +++++++++++++++++++++++++++------------------------- cgilite | 1 + 3 files changed, 49 insertions(+), 43 deletions(-) create mode 100644 .gitmodules create mode 160000 cgilite diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2b34196 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "cgilite"] + path = cgilite + url = https://git.plutz.net/git/cgilite diff --git a/autoslide.sh b/autoslide.sh index a7d08bc..e2c40a8 100755 --- a/autoslide.sh +++ b/autoslide.sh @@ -3,47 +3,49 @@ last='' curr='' next='' idoff=1 -line="$(line)" -while :; do - tag="${tag}${line%%>*}" - - if [ "$line" = "${line%%>*}" ]; then - # $line did not contain ">" and thus was added to $tag entirely - if ! line="$(line)"; then - printf %s\\n "$tag" - break +"${0%/*}"/cgilite/html-sh.sed | { + line="$(line)" + while :; do + tag="${tag}${line%%>*}" + + if [ "$line" = "${line%%>*}" ]; then + # $line did not contain ">" and thus was added to $tag entirely + if ! line="$(line)"; then + printf %s\\n "$tag" + break + fi + tag="${tag} + " + else + # $line is shortened by segment added to $tag + line="${line#*>}" + tag="${tag}>" fi - tag="${tag} -" - else - # $line is shortened by segment added to $tag - line="${line#*>}" - tag="${tag}>" - fi - - case $tag in - *\*) - prev="$curr" curr="$next" - next="${tag#*previousnext*) - prev="$curr" curr="$next" - next="autoslide${idoff}" - idoff="$((idoff + 1))" - printf '%spreviousnext*) - printf %s "$tag" - tag='' - ;; - *) : - ;; - esac -done + + case $tag in + *\*) + prev="$curr" curr="$next" + next="${tag#*previousnext*) + prev="$curr" curr="$next" + next="autoslide${idoff}" + idoff="$((idoff + 1))" + printf '%spreviousnext*) + printf %s "$tag" + tag='' + ;; + *) : + ;; + esac + done +} diff --git a/cgilite b/cgilite new file mode 160000 index 0000000..441856d --- /dev/null +++ b/cgilite @@ -0,0 +1 @@ +Subproject commit 441856d88c45de3a8a12a8e3ac74f23f3d9b273b -- 2.39.2