#!/bin/sh
prev='' next='' idoff=0
+depth=0 ucdepth=-1
-"${0%/*}"/cgilite/html-sh.sed | {
+{ "${0%/*}"/cgilite/html-sh.sed || cat; } \
+| {
line="$(line)"
while :; do
tag="${tag}${line%%>*}"
fi
case $tag in
+ *\<head\>*|\*\<head\ *\>)
+ printf '%s<meta name="viewport" content="width=device-width">
+ <style type="text/css"><!--\n' "${tag%${tag#*<head*>}}"
+ cat "${0%/*}/clickslide.css"
+ printf '\n--></style>%s' "${tag#*<head*>}"
+ tag='' depth=$((depth + 1))
+ ;;
*\<slide\ *id=\"?*\"*\>*)
prev="$next"
next="${tag#*<slide }" next="${next#*id=\"}" next="${next%\"*}"
idoff="$((idoff + 1))"
printf '%s<a class="nextslide" href="#%s">next</a><div class="slide" count="%i" id="%s" %s' \
"${tag%<slide *}" "$next" "$idoff" "$next" "${tag#*<slide }"
- tag=''
+ tag='' depth=$((depth + 1))
;;
*\<slide\ *\>*|*\<slide\>*)
prev="$next"
idoff="$((idoff + 1))"
printf '%s<a class="nextslide" href="#%s">next</a><div class="slide" count="%i" id="%s" %s' \
"${tag%<slide*}" "$next" "$idoff" "$next" "${tag#*<slide}"
- tag=''
+ tag='' depth=$((depth + 1))
;;
*\</slide\>*)
printf '%s</div><a class="prevslide" href="#%s">previous</a>%s' \
"${tag%</slide>*}" "$prev" "${tag#*</slide>}"
- tag=''
+ tag='' depth=$((depth - 1))
;;
*\<*class=\"uncover\"*\>*)
- printf '%s<span></span>' "$tag"
- tag=''
+ #printf '%s<li></li>' "$tag"
+ printf '%s' "$tag"
+ tag='' depth=$((depth + 1))
+ ucdepth=$depth
;;
*\<body*\>*)
printf '%s<a href="#" class="toplevel">overview</a>' "$tag"
- tag=''
+ tag='' depth=$((depth + 1))
;;
*\</body*\>*)
printf '<span class="count">%i</span>%s' "$idoff" "$tag"
- tag=''
+ tag='' depth=$((depth - 1))
;;
- *\<*\>*)
+ *\</*\>*)
printf %s "$tag"
+ tag='' depth=$((depth - 1))
+ [ $depth -lt $ucdepth ] && ucdepth=-1
+ ;;
+ *\<*\>*)
+ if [ $ucdepth = $depth ]; then
+ printf '%s<input type="checkbox" class="uncover"/><%s' "${tag%<*}" "${tag#*<}"
+ else
+ printf %s "$tag"
+ fi
+ [ "${tag}" = "${tag%/>}" ] && depth=$((depth + 1))
tag=''
;;
*) :