X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=autoslide.sh;h=8c9ca1ef640ed42d0d72624a9c9e682b666e06f9;hb=0fc47a1856fe8e4868149f654157d86d6c3794e8;hp=a7d08bcd86e3d72433e49a35e0a42a467272c56c;hpb=6421f2b8265a18c68514d1005d39916efedb4871;p=clickslide diff --git a/autoslide.sh b/autoslide.sh index a7d08bc..8c9ca1e 100755 --- a/autoslide.sh +++ b/autoslide.sh @@ -1,49 +1,63 @@ #!/bin/sh -last='' curr='' next='' -idoff=1 +prev='' 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="$next" + next="${tag#*next
*|*\*) + prev="$next" + next="autoslide${idoff}" + idoff="$((idoff + 1))" + printf '%snext
*) + printf '%s
previous%s' \ + "${tag%*}" "$prev" "${tag#*}" + tag='' + ;; + *\<*class=\"uncover\"*\>*) + printf '%s' "$tag" + tag='' + ;; + *\*) + printf '%soverview' "$tag" + tag='' + ;; + *\<*\>*) + printf %s "$tag" + tag='' + ;; + *) : + ;; + esac + done +}