3 prev='' next='' idoff=0
8 | sed '1d; :X;$!{N;bX;}; s;\n;;g; s;=\+;;g;'
11 { "${0%/*}"/cgilite/html-sh.sed || cat; } \
15 tag="${tag}${line%%>*}"
17 if [ "$line" = "${line%%>*}" ]; then
18 # $line did not contain ">" and thus was added to $tag entirely
19 if ! line="$(line)"; then
26 # $line is shortened by segment added to $tag
31 ### Image embedding for Inline styles
32 while expr "$tag" : '.*<[^>]*style="[^"]*url("\?[^)]\+\.\(png\|jpg\|jpeg\|gif\|svg\)"\?)'; do
35 file="${tag#${pre}url(}" file="${file%)$post}"
36 file="${file#"}" file="${file%"}"
37 echo Inlining Background Image "$file" >&2
38 if [ -r "$file" ]; then
39 tag="${pre}url('data:image/${file##*.};base64,$(base64 "$file")')${post}"
43 ### Image embedding for Image tags
44 while expr "$tag" : '.*<img [^>]*src="[^"]\+\.\(png\|jpg\|jpeg\|gif\|svg\)"'; do
45 pre="${tag%%src=\"*\"*}"
46 post="${tag#*src=\"*\"}"
47 file="${tag#${pre}src=\"}" file="${file%\"$post}"
48 echo Inlining Image "$file" >&2
49 if [ -r "$file" ]; then
50 tag="${pre}src=\"data:image/${file##*.};base64,$(base64 "${file}")\"${post}"
56 *\<head\>*|\*\<head\ *\>) # Inline styles into head
57 printf '%s<meta name="viewport" content="width=device-width">
58 <style type="text/css"><!--\n' "${tag%${tag#*<head*>}}"
59 cat "${0%/*}/clickslide.css"
60 printf '\n--></style>%s' "${tag#*<head*>}"
61 tag='' depth=$((depth + 1))
63 *\<slide\ *id=\"?*\"*\>*) # Count slide id, insert "next" button
65 next="${tag#*<slide }" next="${next#*id=\"}" next="${next%\"*}"
66 next="autoslide${idoff}"
67 idoff="$((idoff + 1))"
68 printf '%s<a class="nextslide" href="#%s">next</a><div class="slide" count="%i" id="%s" %s' \
69 "${tag%<slide *}" "$next" "$idoff" "$next" "${tag#*<slide }"
70 tag='' depth=$((depth + 1))
72 *\<slide\ *\>*|*\<slide\>*)
74 next="autoslide${idoff}"
75 idoff="$((idoff + 1))"
76 printf '%s<a class="nextslide" href="#%s">next</a><div class="slide" count="%i" id="%s" %s' \
77 "${tag%<slide*}" "$next" "$idoff" "$next" "${tag#*<slide}"
78 tag='' depth=$((depth + 1))
80 *\</slide\>*) # Insert "previous" button
81 printf '%s</div><a class="prevslide" href="#%s">previous</a>%s' \
82 "${tag%</slide>*}" "$prev" "${tag#*</slide>}"
83 tag='' depth=$((depth - 1))
85 *\<body*\>*) # Insert toplevel link
86 printf '%s<a href="#" class="toplevel">overview</a>' "$tag"
87 tag='' depth=$((depth + 1))
89 *\</body*\>*) # Insert total slide count
90 printf '<span class="count">%i</span>%s' "$idoff" "$tag"
91 tag='' depth=$((depth - 1))
93 *\<*class=\"uncover\"*\>*) # Insert checkboxes in "uncover" lists
94 #printf '%s<li></li>' "$tag"
96 tag='' depth=$((depth + 1))
101 tag='' depth=$((depth - 1))
102 [ $depth -lt $ucdepth ] && ucdepth=-1
105 if [ $ucdepth = $depth ]; then
106 printf '%s<input type="checkbox" class="uncover"/><%s' "${tag%<*}" "${tag#*<}"
110 [ "${tag}" = "${tag%/>}" ] && depth=$((depth + 1))