From: Paul Hänsch Date: Wed, 27 Feb 2019 22:20:59 +0000 (+0100) Subject: image embedding (for inline style bg images) X-Git-Url: http://git.plutz.net/?p=clickslide;a=commitdiff_plain;h=f3d10e74c2c37195dc5fac09af5ff02d13307bf3 image embedding (for inline style bg images) --- diff --git a/clickslide.css b/clickslide.css index 56313c8..174384b 100644 --- a/clickslide.css +++ b/clickslide.css @@ -1,6 +1,9 @@ * { box-sizing: border-box; margin: 0; padding: 0; + background-position: center; + background-repeat: no-repeat; + background-size: cover; } /* min-height: 240px */ body { font-size: 9px; } diff --git a/clickslide.sh b/clickslide.sh index ddc94c3..dcb01db 100755 --- a/clickslide.sh +++ b/clickslide.sh @@ -22,16 +22,29 @@ depth=0 ucdepth=-1 line="${line#*>}" tag="${tag}>" fi - + + ### Image embedding for Inline styles + while expr "$tag" : '.*<[^>]*style="[^"]*url("\?[^)]\+\.\(png\|jpg\|jpeg\|gif\|svg\)"\?)'; do + pre="${tag%%url(*)*}" + post="${tag#*url(*)}" + file="${tag#${pre}url(}" file="${file%)$post}" + file="${file#"}" file="${file%"}" + echo Inlining Image "$file" >&2 + if [ -r "$file" ]; then + tag="${pre}url('data:image/${file##*.};base64,$(base64 <"${file}" |tr -d \\n)')${post}" + fi + done >/dev/null + + ### Tag Processing case $tag in - *\*|\*\) + *\*|\*\) # Inline styles into head printf '%s %s' "${tag#*}" tag='' depth=$((depth + 1)) ;; - *\*) + *\*) # Count slide id, insert "next" button prev="$next" next="${tag#**) + *\*) # Insert "previous" button printf '%sprevious%s' \ "${tag%*}" "$prev" "${tag#*}" tag='' depth=$((depth - 1)) ;; - *\<*class=\"uncover\"*\>*) - #printf '%s
  • ' "$tag" - printf '%s' "$tag" - tag='' depth=$((depth + 1)) - ucdepth=$depth - ;; - *\*) + *\*) # Insert toplevel link printf '%soverview' "$tag" tag='' depth=$((depth + 1)) ;; - *\*) + *\*) # Insert total slide count printf '%i%s' "$idoff" "$tag" tag='' depth=$((depth - 1)) ;; + *\<*class=\"uncover\"*\>*) # Insert checkboxes in "uncover" lists + #printf '%s
  • ' "$tag" + printf '%s' "$tag" + tag='' depth=$((depth + 1)) + ucdepth=$depth + ;; *\*) printf %s "$tag" tag='' depth=$((depth - 1)) diff --git a/example/demo.short b/example/demo.short index ae866d4..5df9a71 100644 --- a/example/demo.short +++ b/example/demo.short @@ -40,8 +40,8 @@ ] ] [slide [h2 Simplifying HTML] - Maintain the flexibility of plain HTML. Decrease the verbosity of the code. [br] - [pre style="display: inline-block; width: 46%;" + Maintain the flexibility of plain HTML. Decrease verbosity of the code. [br] + [pre style="display: inline-block; width: 46%; background-image: url(exb0_light.jpg);" \ \ \Demo\ @@ -51,7 +51,7 @@ \ \ ] - [pre style="display: inline-block; width: 46%;" + [pre style="display: inline-block; width: 46%; background-image: url(exb3_light.jpg);" \[html \[head \[title Demo\]