1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-20 12:21:35 +02:00

Fix placeholder image replacement.

This commit is contained in:
m5o
2018-11-14 15:10:23 +02:00
committed by XhmikosR
parent 2ac3db8384
commit 6163533d84

View File

@@ -18,15 +18,32 @@ optional: hide_markup - disabled (default)
{%- if include.hide_markup == null -%} {%- if include.hide_markup == null -%}
{%- highlight html -%} {%- highlight html -%}
{%- if include.content contains 'data-src="holder.js' -%} {%- if include.content contains '<svg class="bd-placeholder-img' -%}
{%- assign modified_content = include.content {%- assign modified_content = include.content
| replace: 'data-src="holder.js', 'src="✂️holder.js' | replace: '<svg class="bd-placeholder-img', '<svg class="bd-placeholder-img'
| replace: '" ', '✂️" ' | replace: '</svg>', '</svg>✂️'
| split: '✂️' -%} | 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 -%} {%- 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 -%} {%- else -%}
{{- content_chunk -}} {{- content_chunk -}}
{%- endif -%} {%- endif -%}