X-Git-Url: http://git.plutz.net/?p=clickslide;a=blobdiff_plain;f=autoslide.sh;h=e2c40a86f47a8841f5dd53710f95f0b2786556d5;hp=a7d08bcd86e3d72433e49a35e0a42a467272c56c;hb=acc9d4587f930fdd7f7be5d3973b1e709f3ba029;hpb=6421f2b8265a18c68514d1005d39916efedb4871 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 +}