diff options
| author | m5o <[email protected]> | 2018-11-14 15:10:23 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2018-11-20 21:31:28 +0200 |
| commit | 6163533d84b98e04880ebe05aa5c2e37b2d77b18 (patch) | |
| tree | 45b5788bc7c6b3aa6f20c369f75631d5fd65df46 | |
| parent | 2ac3db83848ec94e7acd0f6c1e9b1bca4a3aa6b3 (diff) | |
| download | bootstrap-6163533d84b98e04880ebe05aa5c2e37b2d77b18.tar.xz bootstrap-6163533d84b98e04880ebe05aa5c2e37b2d77b18.zip | |
Fix placeholder image replacement.
| -rw-r--r-- | site/_includes/example.html | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/site/_includes/example.html b/site/_includes/example.html index 63621c64b..308d2850b 100644 --- a/site/_includes/example.html +++ b/site/_includes/example.html @@ -18,15 +18,32 @@ optional: hide_markup - disabled (default) {%- if include.hide_markup == null -%} {%- highlight html -%} - {%- if include.content contains 'data-src="holder.js' -%} + {%- if include.content contains '<svg class="bd-placeholder-img' -%} {%- assign modified_content = include.content - | replace: 'data-src="holder.js', 'src="✂️holder.js' - | replace: '" ', '✂️" ' + | replace: '<svg class="bd-placeholder-img', '✂️<svg class="bd-placeholder-img' + | replace: '</svg>', '</svg>✂️' | split: '✂️' -%} + {%- if include.content contains 'bd-placeholder-img ' -%} + {%- assign image_class = include.content + | replace_first: 'bd-placeholder-img', 'bd-placeholder-img ✂️' + | replace: '" width="', '✂️" width="' + | split: '✂️' -%} + {%- assign image_class = image_class[1] | replace: 'bd-placeholder-img-lg', '' | strip -%} + {%- endif -%} + + {%- assign image_alt = include.content + | replace: '<title>', '<title>✂️' + | replace: '</title>', '✂️</title>' + | split: '✂️' -%} + {%- assign image_alt = image_alt[1] -%} + {%- for content_chunk in modified_content -%} - {%- if content_chunk contains 'holder.js' -%} - {{- "..." -}} + {%- if content_chunk contains '<svg class="bd-placeholder-img' -%} + {%- capture img_placeholder -%} + <img src="..." {% if image_class %}class="{{ image_class }}" {% endif %}alt="{{ image_alt }}"> + {%- endcapture -%} + {{- img_placeholder -}} {%- else -%} {{- content_chunk -}} {%- endif -%} |
