diff options
| author | XhmikosR <[email protected]> | 2019-08-31 08:11:16 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-08-31 08:11:16 +0300 |
| commit | 919b526f17a08cefba51c42b831c922adecb4a9f (patch) | |
| tree | b63d7cb6b5b2be43470b4897a6880d7065061efb /site/layouts/shortcodes/example.html | |
| parent | b1f49092877c83bf2007cc363fc5c6925cc0dc8c (diff) | |
| download | bootstrap-919b526f17a08cefba51c42b831c922adecb4a9f.tar.xz bootstrap-919b526f17a08cefba51c42b831c922adecb4a9f.zip | |
Fix shortcodes/example.html class bug. (#29344)
It always used the first placeholder's class before.
Diffstat (limited to 'site/layouts/shortcodes/example.html')
| -rw-r--r-- | site/layouts/shortcodes/example.html | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/site/layouts/shortcodes/example.html b/site/layouts/shortcodes/example.html index 67813b70f..bea1d9416 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) -}} |
