3 prev='' next='' idoff=0
6 { "${0%/*}"/cgilite/html-sh.sed || cat; } \
10 tag="${tag}${line%%>*}"
12 if [ "$line" = "${line%%>*}" ]; then
13 # $line did not contain ">" and thus was added to $tag entirely
14 if ! line="$(line)"; then
21 # $line is shortened by segment added to $tag
26 ### Image embedding for Inline styles
27 while expr "$tag" : '.*<[^>]*style="[^"]*url("\?[^)]\+\.\(png\|jpg\|jpeg\|gif\|svg\)"\?)'; do
30 file="${tag#${pre}url(}" file="${file%)$post}"
31 file="${file#"}" file="${file%"}"
32 echo Inlining Image "$file" >&2
33 if [ -r "$file" ]; then
34 tag="${pre}url('data:image/${file##*.};base64,$(base64 <"${file}" |tr -d \\n)')${post}"
40 *\<head\>*|\*\<head\ *\>) # Inline styles into head
41 printf '%s<meta name="viewport" content="width=device-width">
42 <style type="text/css"><!--\n' "${tag%${tag#*<head*>}}"
43 cat "${0%/*}/clickslide.css"
44 printf '\n--></style>%s' "${tag#*<head*>}"
45 tag='' depth=$((depth + 1))
47 *\<slide\ *id=\"?*\"*\>*) # Count slide id, insert "next" button
49 next="${tag#*<slide }" next="${next#*id=\"}" next="${next%\"*}"
50 next="autoslide${idoff}"
51 idoff="$((idoff + 1))"
52 printf '%s<a class="nextslide" href="#%s">next</a><div class="slide" count="%i" id="%s" %s' \
53 "${tag%<slide *}" "$next" "$idoff" "$next" "${tag#*<slide }"
54 tag='' depth=$((depth + 1))
56 *\<slide\ *\>*|*\<slide\>*)
58 next="autoslide${idoff}"
59 idoff="$((idoff + 1))"
60 printf '%s<a class="nextslide" href="#%s">next</a><div class="slide" count="%i" id="%s" %s' \
61 "${tag%<slide*}" "$next" "$idoff" "$next" "${tag#*<slide}"
62 tag='' depth=$((depth + 1))
64 *\</slide\>*) # Insert "previous" button
65 printf '%s</div><a class="prevslide" href="#%s">previous</a>%s' \
66 "${tag%</slide>*}" "$prev" "${tag#*</slide>}"
67 tag='' depth=$((depth - 1))
69 *\<body*\>*) # Insert toplevel link
70 printf '%s<a href="#" class="toplevel">overview</a>' "$tag"
71 tag='' depth=$((depth + 1))
73 *\</body*\>*) # Insert total slide count
74 printf '<span class="count">%i</span>%s' "$idoff" "$tag"
75 tag='' depth=$((depth - 1))
77 *\<*class=\"uncover\"*\>*) # Insert checkboxes in "uncover" lists
78 #printf '%s<li></li>' "$tag"
80 tag='' depth=$((depth + 1))
85 tag='' depth=$((depth - 1))
86 [ $depth -lt $ucdepth ] && ucdepth=-1
89 if [ $ucdepth = $depth ]; then
90 printf '%s<input type="checkbox" class="uncover"/><%s' "${tag%<*}" "${tag#*<}"
94 [ "${tag}" = "${tag%/>}" ] && depth=$((depth + 1))