diff --git a/site/layouts/shortcodes/example.html b/site/layouts/shortcodes/example.html index 67813b70fe78b17fca618de13ac6d3941580ef55..bea1d9416a39bf003ebaf2f50480f2b10c6632a0 100644 --- a/site/layouts/shortcodes/example.html +++ b/site/layouts/shortcodes/example.html @@ -23,20 +23,21 @@ {{- if (strings.Contains $input `<svg class="bd-placeholder-img`) -}} {{- $.Scratch.Set "highlight_content" "" -}} - {{- $image_class := "" -}} {{- $modified_content := replace $input `<svg class="bd-placeholder-img` `✂ï¸<svg class="bd-placeholder-img` -}} {{- $modified_content = replace $modified_content "</svg>\n" "</svg>✂ï¸" -}} {{- $modified_content = split $modified_content "✂ï¸" -}} - {{- if (strings.Contains $input `<svg class="bd-placeholder-img `) -}} - {{- $image_class = replace $input "bd-placeholder-img " "bd-placeholder-img âœ‚ï¸ " -}} - {{- $image_class = split (replace $image_class `" width="` `✂ï¸" width="`) "✂ï¸" -}} - {{- $image_class = replace (index $image_class 1) "bd-placeholder-img-lg" "" -}} - {{- $image_class = trim $image_class " " -}} - {{- end -}} - {{- range $i, $content_chunk := $modified_content -}} + {{- $image_class := "" -}} + + {{- if (strings.Contains $content_chunk `<svg class="bd-placeholder-img `) -}} + {{- $image_class = replace $content_chunk "bd-placeholder-img " "bd-placeholder-img âœ‚ï¸ " -}} + {{- $image_class = split (replace $image_class `" width="` `✂ï¸" width="`) "✂ï¸" -}} + {{- $image_class = replace (index $image_class 1) "bd-placeholder-img-lg" "" -}} + {{- $image_class = trim $image_class " " -}} + {{- end -}} + {{- if (strings.Contains $content_chunk `<svg class="bd-placeholder-img`) -}} {{- if $image_class -}} {{- $.Scratch.Add "highlight_content" (printf `<img src="..." class="%s" alt="...">` $image_class) -}}