style(core): avoid using <
or >
within capture
tag
This interferes with the work of the editor Liquid-HTML plugin
This commit is contained in:
parent
de2dff354a
commit
5015fdecf3
1 changed files with 40 additions and 45 deletions
|
@ -32,12 +32,10 @@
|
||||||
<!-- Change the icon of checkbox -->
|
<!-- Change the icon of checkbox -->
|
||||||
{% if _content contains '<input type="checkbox"' %}
|
{% if _content contains '<input type="checkbox"' %}
|
||||||
{% assign _content = _content
|
{% assign _content = _content
|
||||||
| replace:
|
| replace: '<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" checked="checked" />',
|
||||||
'<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" checked="checked" />',
|
'<i class="fas fa-check-circle fa-fw checked"></i>'
|
||||||
'<i class="fas fa-check-circle fa-fw checked"></i>'
|
| replace: '<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" />',
|
||||||
| replace:
|
'<i class="far fa-circle fa-fw"></i>'
|
||||||
'<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" />',
|
|
||||||
'<i class="far fa-circle fa-fw"></i>'
|
|
||||||
%}
|
%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -45,7 +43,7 @@
|
||||||
{% assign IMG_TAG = '<img ' %}
|
{% assign IMG_TAG = '<img ' %}
|
||||||
|
|
||||||
{% if _content contains IMG_TAG %}
|
{% if _content contains IMG_TAG %}
|
||||||
{% assign _img_content = nil %}
|
{% assign _img_content = null %}
|
||||||
{% assign _img_snippets = _content | split: IMG_TAG %}
|
{% assign _img_snippets = _content | split: IMG_TAG %}
|
||||||
|
|
||||||
<!-- CDN URL -->
|
<!-- CDN URL -->
|
||||||
|
@ -81,10 +79,10 @@
|
||||||
{% assign _left = _left | remove: ' /' | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
|
{% assign _left = _left | remove: ' /' | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
|
||||||
{% assign _attrs = _left | split: '" ' %}
|
{% assign _attrs = _left | split: '" ' %}
|
||||||
|
|
||||||
{% assign _width = nil %}
|
{% assign _width = null %}
|
||||||
{% assign _height = nil %}
|
{% assign _height = null %}
|
||||||
{% assign _lqip = nil %}
|
{% assign _lqip = null %}
|
||||||
{% assign _class = nil %}
|
{% assign _class = null %}
|
||||||
|
|
||||||
{% for _attr in _attrs %}
|
{% for _attr in _attrs %}
|
||||||
{% unless _attr contains '=' %}
|
{% unless _attr contains '=' %}
|
||||||
|
@ -115,7 +113,7 @@
|
||||||
{% assign _left = _left | remove: _old_class %}
|
{% assign _left = _left | remove: _old_class %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% assign _final_src = nil %}
|
{% assign _final_src = null %}
|
||||||
|
|
||||||
{% unless _src contains '//' %}
|
{% unless _src contains '//' %}
|
||||||
{% assign _final_src = _path_prefix | append: _src %}
|
{% assign _final_src = _path_prefix | append: _src %}
|
||||||
|
@ -136,7 +134,7 @@
|
||||||
<!-- lazy-load images <https://github.com/aFarkas/lazysizes#readme> -->
|
<!-- lazy-load images <https://github.com/aFarkas/lazysizes#readme> -->
|
||||||
{% assign _left = _left | replace: 'src=', 'data-src=' %}
|
{% assign _left = _left | replace: 'src=', 'data-src=' %}
|
||||||
{% if _left contains 'class=' %}
|
{% if _left contains 'class=' %}
|
||||||
{% assign _left = _left | replace: 'class="', 'class="lazyload '%}
|
{% assign _left = _left | replace: 'class="', 'class="lazyload ' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% assign _left = _left | append: ' class="lazyload"' %}
|
{% assign _left = _left | append: ' class="lazyload"' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -150,7 +148,7 @@
|
||||||
{%- capture _svg -%}
|
{%- capture _svg -%}
|
||||||
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{ _width }} {{ _height }}'%3E%3C/svg%3E"
|
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{ _width }} {{ _height }}'%3E%3C/svg%3E"
|
||||||
{%- endcapture -%}
|
{%- endcapture -%}
|
||||||
{% assign _left = _svg | append: ' ' | append: _left %}
|
{% assign _left = _svg | append: ' ' | append: _left %}
|
||||||
{% assign _class = _class | append: ' shimmer' %}
|
{% assign _class = _class | append: ' shimmer' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -160,9 +158,8 @@
|
||||||
|
|
||||||
{% if page.layout == 'home' %}
|
{% if page.layout == 'home' %}
|
||||||
<!-- create the image wrapper -->
|
<!-- create the image wrapper -->
|
||||||
{%- capture _wrapper_start -%}
|
{% assign _wrapper_start = '<div class="preview-img ' | append: _class | append: '">' %}
|
||||||
<div class="preview-img {{ _class | strip }}">
|
|
||||||
{%- endcapture -%}
|
|
||||||
{% assign _img_content = _img_content | append: _wrapper_start %}
|
{% assign _img_content = _img_content | append: _wrapper_start %}
|
||||||
{% assign _right = _right | prepend: '></div' %}
|
{% assign _right = _right | prepend: '></div' %}
|
||||||
|
|
||||||
|
@ -176,12 +173,17 @@
|
||||||
{% capture _class %}
|
{% capture _class %}
|
||||||
class="img-link{% unless _lqip %} shimmer{% endunless %}"
|
class="img-link{% unless _lqip %} shimmer{% endunless %}"
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
{% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
|
{% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<!-- create the image wrapper -->
|
<!-- create the image wrapper -->
|
||||||
{%- capture _wrapper_start -%}
|
{% assign _wrapper_start = _final_src
|
||||||
<a href="{{ _final_src | default: _src }}" class="popup img-link {{ _class }}">
|
| default: _src
|
||||||
{%- endcapture -%}
|
| prepend: '<a href="'
|
||||||
|
| append: '" class="popup img-link '
|
||||||
|
| append: _class
|
||||||
|
| append: '">'
|
||||||
|
%}
|
||||||
|
|
||||||
{% assign _img_content = _img_content | append: _wrapper_start %}
|
{% assign _img_content = _img_content | append: _wrapper_start %}
|
||||||
{% assign _right = _right | prepend: '></a' %}
|
{% assign _right = _right | prepend: '></a' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -189,13 +191,11 @@
|
||||||
|
|
||||||
<!-- combine -->
|
<!-- combine -->
|
||||||
{% assign _img_content = _img_content | append: debug | append: IMG_TAG | append: _left | append: _right %}
|
{% assign _img_content = _img_content | append: debug | append: IMG_TAG | append: _left | append: _right %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if _img_content %}
|
{% if _img_content %}
|
||||||
{% assign _content = _img_content %}
|
{% assign _content = _img_content %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Add header for code snippets -->
|
<!-- Add header for code snippets -->
|
||||||
|
@ -205,13 +205,11 @@
|
||||||
{% assign _new_content = '' %}
|
{% assign _new_content = '' %}
|
||||||
|
|
||||||
{% for _snippet in _code_spippets %}
|
{% for _snippet in _code_spippets %}
|
||||||
|
|
||||||
{% if forloop.last %}
|
{% if forloop.last %}
|
||||||
{% assign _new_content = _new_content | append: _snippet %}
|
{% assign _new_content = _new_content | append: _snippet %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% assign _left = _snippet | split: '><' | last %}
|
||||||
{% assign _left = _snippet | split: '><' | last%}
|
|
||||||
|
|
||||||
{% if _left contains 'file="' %}
|
{% if _left contains 'file="' %}
|
||||||
{% assign _label_text = _left | split: 'file="' | last | split: '"' | first %}
|
{% assign _label_text = _left | split: 'file="' | last | split: '"' | first %}
|
||||||
|
@ -226,21 +224,19 @@
|
||||||
<span data-label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span>
|
<span data-label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span>
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
|
|
||||||
{% assign _new_content = _new_content | append: _snippet
|
{% assign _new_content = _new_content
|
||||||
| append: '<div class="code-header">'
|
| append: _snippet
|
||||||
| append: _label
|
| append: '<div class="code-header">'
|
||||||
| append: '<button aria-label="copy" data-title-succeed="'
|
| append: _label
|
||||||
| append: site.data.locales[include.lang].post.button.copy_code.succeed
|
| append: '<button aria-label="copy" data-title-succeed="'
|
||||||
| append: '"><i class="far fa-clipboard"></i></button></div>'
|
| append: site.data.locales[include.lang].post.button.copy_code.succeed
|
||||||
| append: '<div class="highlight"><code>'
|
| append: '"><i class="far fa-clipboard"></i></button></div>'
|
||||||
|
| append: '<div class="highlight"><code>'
|
||||||
%}
|
%}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% assign _content = _new_content %}
|
{% assign _content = _new_content %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Create heading anchors -->
|
<!-- Create heading anchors -->
|
||||||
|
@ -249,11 +245,11 @@
|
||||||
{% assign _heading_content = _content %}
|
{% assign _heading_content = _content %}
|
||||||
|
|
||||||
{% for level in heading_levels %}
|
{% for level in heading_levels %}
|
||||||
{% capture mark_start %}<h{{ level }} id="{% endcapture %}
|
{% assign mark_start = '<h' | append: level | append: ' id="' %}
|
||||||
{% capture mark_end %}</h{{ level }}>{% endcapture %}
|
{% assign mark_end = '</h' | append: level | append: '>' %}
|
||||||
|
|
||||||
{% if _heading_content contains mark_start %}
|
{% if _heading_content contains mark_start %}
|
||||||
{% assign _new_content = nil %}
|
{% assign _new_content = null %}
|
||||||
{% assign heading_snippets = _heading_content | split: mark_start %}
|
{% assign heading_snippets = _heading_content | split: mark_start %}
|
||||||
|
|
||||||
{% for snippet in heading_snippets %}
|
{% for snippet in heading_snippets %}
|
||||||
|
@ -263,20 +259,19 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% assign id = snippet | split: '"' | first %}
|
{% assign id = snippet | split: '"' | first %}
|
||||||
{% capture anchor %}<a href="#{{ id }}" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>{% endcapture %}
|
{% assign anchor = '<a href="#'
|
||||||
|
| append: id
|
||||||
|
| append: '" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>'
|
||||||
|
%}
|
||||||
|
|
||||||
{% assign left = snippet | split: mark_end | first %}
|
{% assign left = snippet | split: mark_end | first %}
|
||||||
{% assign right = snippet | slice: left.size, snippet.size %}
|
{% assign right = snippet | slice: left.size, snippet.size %}
|
||||||
{% assign left = left | replace_first: '">', '"><span class="me-2">' | append: '</span>' %}
|
{% assign left = left | replace_first: '">', '"><span class="me-2">' | append: '</span>' %}
|
||||||
|
|
||||||
{% assign _new_content = _new_content | append: mark_start
|
{% assign _new_content = _new_content | append: mark_start | append: left | append: anchor | append: right %}
|
||||||
| append: left | append: anchor | append: right
|
|
||||||
%}
|
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% assign _heading_content = _new_content %}
|
{% assign _heading_content = _new_content %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue