jekyll-theme-abd3lraouf 5.2.5 → 5.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -21
- data/README.md +105 -105
- data/_config.yml +1 -1
- data/_data/assets/cross_origin.yml +62 -62
- data/_data/assets/self_host.yml +51 -51
- data/_data/authors.yml +17 -17
- data/_data/contact.yml +30 -30
- data/_data/locales/bg-BG.yml +83 -83
- data/_data/locales/en.yml +83 -83
- data/_data/locales/es-ES.yml +79 -79
- data/_data/locales/fr-FR.yml +79 -79
- data/_data/locales/hu-HU.yml +81 -81
- data/_data/locales/id-ID.yml +79 -79
- data/_data/locales/ko-KR.yml +79 -79
- data/_data/locales/my-MM.yml +79 -79
- data/_data/locales/pt-BR.yml +79 -79
- data/_data/locales/ru-RU.yml +79 -79
- data/_data/locales/tr-TR.yml +79 -79
- data/_data/locales/uk-UA.yml +79 -79
- data/_data/locales/vi-VN.yml +77 -77
- data/_data/locales/zh-CN.yml +78 -78
- data/_data/share.yml +27 -27
- data/_includes/assets-origin.html +12 -12
- data/_includes/comments/disqus.html +54 -54
- data/_includes/comments/giscus.html +56 -56
- data/_includes/comments/utterances.html +51 -51
- data/_includes/comments.html +5 -5
- data/_includes/datetime.html +21 -21
- data/_includes/favicons.html +17 -17
- data/_includes/footer.html +17 -36
- data/_includes/google-analytics.html +14 -14
- data/_includes/head.html +116 -116
- data/_includes/js-selector.html +104 -104
- data/_includes/jsdelivr-combine.html +32 -32
- data/_includes/lang.html +8 -8
- data/_includes/language-alias.html +70 -70
- data/_includes/mermaid.html +57 -57
- data/_includes/mode-toggle.html +129 -129
- data/_includes/no-linenos.html +10 -10
- data/_includes/post-nav.html +30 -30
- data/_includes/post-paginator.html +88 -88
- data/_includes/post-sharing.html +27 -27
- data/_includes/read-time.html +30 -30
- data/_includes/refactor-content.html +282 -282
- data/_includes/related-posts.html +103 -103
- data/_includes/search-loader.html +46 -46
- data/_includes/search-results.html +11 -11
- data/_includes/sidebar.html +93 -93
- data/_includes/toc.html +16 -16
- data/_includes/topbar.html +70 -70
- data/_includes/trending-tags.html +50 -50
- data/_includes/update-list.html +40 -40
- data/_layouts/archives.html +48 -48
- data/_layouts/categories.html +120 -120
- data/_layouts/category.html +24 -24
- data/_layouts/compress.html +10 -10
- data/_layouts/default.html +74 -74
- data/_layouts/home.html +103 -103
- data/_layouts/page.html +64 -64
- data/_layouts/post.html +159 -159
- data/_layouts/tag.html +23 -23
- data/_layouts/tags.html +23 -23
- data/_plugins/posts-lastmod-hook.rb +14 -14
- data/_sass/addon/commons.scss +1678 -1680
- data/_sass/addon/module.scss +151 -151
- data/_sass/addon/syntax.scss +289 -289
- data/_sass/addon/variables.scss +34 -34
- data/_sass/colors/dark-syntax.scss +88 -88
- data/_sass/colors/dark-typography.scss +157 -157
- data/_sass/colors/light-syntax.scss +84 -84
- data/_sass/colors/light-typography.scss +94 -94
- data/_sass/jekyll-theme-abd3lraouf.scss +1 -1
- data/_sass/layout/archives.scss +147 -147
- data/_sass/layout/categories.scss +67 -67
- data/_sass/layout/category-tag.scss +73 -73
- data/_sass/layout/home.scss +184 -184
- data/_sass/layout/post.scss +369 -369
- data/_sass/layout/tags.scss +19 -19
- data/_sass/variables-hook.scss +3 -3
- data/_tabs/about.md +8 -8
- data/_tabs/archives.md +7 -7
- data/_tabs/categories.md +6 -6
- data/_tabs/tags.md +6 -6
- data/assets/404.html +71 -16
- data/assets/css/style.scss +12 -12
- data/assets/feed.xml +61 -61
- data/assets/img/404.png +0 -0
- data/assets/img/favicons/browserconfig.xml +13 -13
- data/assets/img/favicons/site.webmanifest +26 -26
- data/assets/js/data/search.json +18 -18
- data/assets/js/data/swcache.js +55 -55
- data/assets/js/dist/categories.min.js +1 -1
- data/assets/js/dist/commons.min.js +1 -1
- data/assets/js/dist/home.min.js +1 -1
- data/assets/js/dist/misc.min.js +1 -1
- data/assets/js/dist/page.min.js +1 -1
- data/assets/js/dist/post.min.js +1 -1
- data/assets/js/dist/pvreport.min.js +1 -1
- data/assets/js/pwa/app.js +47 -47
- data/assets/js/pwa/sw.js +89 -89
- data/assets/js/pwa/unregister.js +12 -12
- data/assets/robots.txt +10 -10
- data/index.html +4 -4
- metadata +8 -7
@@ -1,282 +1,282 @@
|
|
1
|
-
<!--
|
2
|
-
Refactor the HTML structure.
|
3
|
-
-->
|
4
|
-
|
5
|
-
{% assign _content = include.content %}
|
6
|
-
|
7
|
-
<!--
|
8
|
-
In order to allow a wide table to scroll horizontally,
|
9
|
-
we suround the markdown table with `<div class="table-wrapper">` and `</div>`
|
10
|
-
-->
|
11
|
-
|
12
|
-
{% if _content contains '<table' %}
|
13
|
-
{% assign _content = _content
|
14
|
-
| replace: '<table', '<div class="table-wrapper"><table'
|
15
|
-
| replace: '</table>', '</table></div>'
|
16
|
-
| replace: '<code><div class="table-wrapper">', '<code>'
|
17
|
-
| replace: '</table></div></code>', '</table></code>'
|
18
|
-
%}
|
19
|
-
{% endif %}
|
20
|
-
|
21
|
-
<!--
|
22
|
-
Fixed kramdown code highlight rendering:
|
23
|
-
https://github.com/penibelst/jekyll-compress-html/issues/101
|
24
|
-
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
|
25
|
-
-->
|
26
|
-
|
27
|
-
{% if _content contains '<pre class="highlight">' %}
|
28
|
-
{% assign _content = _content
|
29
|
-
| replace: '<div class="highlight"><pre class="highlight"><code', '<div class="highlight"><code'
|
30
|
-
| replace: '</code></pre></div>', '</code></div>'
|
31
|
-
%}
|
32
|
-
{% endif %}
|
33
|
-
|
34
|
-
<!-- Add attribute 'hide-bullet' to the checkbox list -->
|
35
|
-
|
36
|
-
{% if _content contains '<li class="task-list-item"><' %}
|
37
|
-
{% assign _content = _content
|
38
|
-
| replace: '"task-list-item"><', '"task-list-item" hide-bullet><'
|
39
|
-
%}
|
40
|
-
{% endif %}
|
41
|
-
|
42
|
-
<!-- images -->
|
43
|
-
|
44
|
-
{% assign IMG_TAG = '<img ' %}
|
45
|
-
|
46
|
-
{% if _content contains IMG_TAG %}
|
47
|
-
{% assign _img_content = nil %}
|
48
|
-
{% assign _img_snippets = _content | split: IMG_TAG %}
|
49
|
-
|
50
|
-
{% for _img_snippet in _img_snippets %}
|
51
|
-
{% if forloop.first %}
|
52
|
-
{% assign _img_content = _img_snippet %}
|
53
|
-
{% continue %}
|
54
|
-
{% endif %}
|
55
|
-
|
56
|
-
{% assign _width = nil %}
|
57
|
-
{% assign _height = nil %}
|
58
|
-
{% assign _src = nil %}
|
59
|
-
|
60
|
-
{% assign _left = _img_snippet | split: '>' | first %}
|
61
|
-
{% assign _right = _img_snippet | remove: _left %}
|
62
|
-
|
63
|
-
{% assign _left = _left | remove: ' /' %}
|
64
|
-
{% assign _left = _left | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
|
65
|
-
{% assign _attrs = _left | split: ' ' %}
|
66
|
-
|
67
|
-
{% for _attr in _attrs %}
|
68
|
-
{% assign _pair = _attr | split: '=' %}
|
69
|
-
{% if _pair.size < 2 %}
|
70
|
-
{% continue %}
|
71
|
-
{% endif %}
|
72
|
-
|
73
|
-
{% capture _key %}{{ _pair | first }}{% endcapture %}
|
74
|
-
{% capture _value %}{{ _pair | last | replace: '"', '' }}{% endcapture %}
|
75
|
-
|
76
|
-
{% case _key %}
|
77
|
-
{% when 'width' %}
|
78
|
-
{% assign _width = _value %}
|
79
|
-
{% when 'height' %}
|
80
|
-
{% assign _height = _value %}
|
81
|
-
{% when 'src' %}
|
82
|
-
{% assign _src = _value %}
|
83
|
-
{% endcase %}
|
84
|
-
|
85
|
-
{% if _width and _height and _src %}
|
86
|
-
{% break %}
|
87
|
-
{% endif %}
|
88
|
-
{% endfor %}
|
89
|
-
|
90
|
-
{% if _src %}
|
91
|
-
{% unless _src contains '://' %}
|
92
|
-
|
93
|
-
<!-- Add CDN URL -->
|
94
|
-
{% if site.img_cdn %}
|
95
|
-
{% if site.img_cdn contains '//' %}
|
96
|
-
{% assign _src_prefix = site.img_cdn %}
|
97
|
-
{% else %}
|
98
|
-
{% assign _src_prefix = site.img_cdn | relative_url %}
|
99
|
-
{% endif %}
|
100
|
-
{% else %}
|
101
|
-
{% assign _src_prefix = site.baseurl %}
|
102
|
-
{% endif %}
|
103
|
-
|
104
|
-
<!-- Add image path -->
|
105
|
-
{% if page.img_path %}
|
106
|
-
{% assign _path = page.img_path %}
|
107
|
-
{% assign last_char = _path | slice: -1 %}
|
108
|
-
|
109
|
-
{% unless last_char == '/' %}
|
110
|
-
{% assign _path = _path | append: '/' %}
|
111
|
-
{% endunless %}
|
112
|
-
|
113
|
-
{% assign _src_prefix = _src_prefix | append: _path %}
|
114
|
-
{% endif %}
|
115
|
-
|
116
|
-
{% assign _final_src = _src_prefix | append: _src %}
|
117
|
-
{% assign _left = _left | replace: _src, _final_src %}
|
118
|
-
|
119
|
-
{% endunless %}
|
120
|
-
|
121
|
-
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
|
122
|
-
|
123
|
-
{% assign _left = _left | replace: 'src=', 'data-src=' %}
|
124
|
-
|
125
|
-
{% endif %}
|
126
|
-
|
127
|
-
<!-- Add SVG placehoder to prevent layout reflow -->
|
128
|
-
|
129
|
-
{% if _width and _height %}
|
130
|
-
{%- capture _svg -%}
|
131
|
-
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{ _width }} {{ _height }}'%3E%3C/svg%3E"
|
132
|
-
{%- endcapture -%}
|
133
|
-
|
134
|
-
{% assign _left = _svg | append: ' ' | append: _left %}
|
135
|
-
{% endif %}
|
136
|
-
|
137
|
-
<!-- Bypass the HTML-proofer test -->
|
138
|
-
{% assign _left = _left | append: ' data-proofer-ignore' %}
|
139
|
-
|
140
|
-
{% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %}
|
141
|
-
|
142
|
-
{% endfor %}
|
143
|
-
|
144
|
-
{% assign _content = _img_content %}
|
145
|
-
|
146
|
-
{% endif %}
|
147
|
-
|
148
|
-
<!-- Add header for code snippets -->
|
149
|
-
|
150
|
-
{% if _content contains '<div class="highlight"><code>' %}
|
151
|
-
{% assign _code_spippets = _content | split: '<div class="highlight"><code>' %}
|
152
|
-
{% assign _new_content = '' %}
|
153
|
-
|
154
|
-
{% for _snippet in _code_spippets %}
|
155
|
-
|
156
|
-
{% if forloop.last %}
|
157
|
-
{% assign _new_content = _new_content | append: _snippet %}
|
158
|
-
|
159
|
-
{% else %}
|
160
|
-
|
161
|
-
{% assign _left = _snippet | split: '><' | last%}
|
162
|
-
|
163
|
-
{% if _left contains 'file="' %}
|
164
|
-
{% assign _label_text = _left | split: 'file="' | last | split: '"' | first %}
|
165
|
-
{% assign _label_icon = 'far fa-file-code' %}
|
166
|
-
{% else %}
|
167
|
-
{% assign _lang = _left | split: 'language-' | last | split: ' ' | first %}
|
168
|
-
{% capture _label_text %}{% include language-alias.html language=_lang %}{% endcapture %}
|
169
|
-
{% assign _label_icon = 'fas fa-code small' %}
|
170
|
-
{% endif %}
|
171
|
-
|
172
|
-
{% capture _label %}
|
173
|
-
<span data-label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span>
|
174
|
-
{% endcapture %}
|
175
|
-
|
176
|
-
{% assign _new_content = _new_content | append: _snippet
|
177
|
-
| append: '<div class="code-header">'
|
178
|
-
| append: _label
|
179
|
-
| append: '<button aria-label="copy" data-title-succeed="'
|
180
|
-
| append: site.data.locales[lang].post.button.copy_code.succeed
|
181
|
-
| append: '"><i class="far fa-clipboard"></i></button></div>'
|
182
|
-
| append: '<div class="highlight"><code>'
|
183
|
-
%}
|
184
|
-
|
185
|
-
{% endif %}
|
186
|
-
|
187
|
-
{% endfor %}
|
188
|
-
|
189
|
-
{% assign _content = _new_content %}
|
190
|
-
|
191
|
-
{% endif %}
|
192
|
-
|
193
|
-
<!-- Create heading anchors -->
|
194
|
-
|
195
|
-
{% assign heading_levels = '2,3,4,5' | split: ',' %}
|
196
|
-
{% assign _heading_content = _content %}
|
197
|
-
|
198
|
-
{% for level in heading_levels %}
|
199
|
-
{% capture mark_start %}<h{{ level }} id="{% endcapture %}
|
200
|
-
{% capture mark_end %}</h{{ level }}>{% endcapture %}
|
201
|
-
|
202
|
-
{% if _heading_content contains mark_start %}
|
203
|
-
{% assign _new_content = nil %}
|
204
|
-
{% assign heading_snippets = _heading_content | split: mark_start %}
|
205
|
-
|
206
|
-
{% for snippet in heading_snippets %}
|
207
|
-
{% if forloop.first %}
|
208
|
-
{% assign _new_content = snippet %}
|
209
|
-
{% continue %}
|
210
|
-
{% endif %}
|
211
|
-
|
212
|
-
{% assign id = snippet | split: '"' | first %}
|
213
|
-
{% capture anchor %}<a href="#{{ id }}" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>{% endcapture %}
|
214
|
-
|
215
|
-
{% assign left = snippet | split: mark_end | first %}
|
216
|
-
{% assign right = snippet | slice: left.size, snippet.size %}
|
217
|
-
{% assign left = left | replace: '">', '"><span class="mr-2">' | append: '</span>' %}
|
218
|
-
|
219
|
-
{% assign _new_content = _new_content | append: mark_start
|
220
|
-
| append: left | append: anchor | append: right
|
221
|
-
%}
|
222
|
-
|
223
|
-
{% endfor %}
|
224
|
-
|
225
|
-
{% assign _heading_content = _new_content %}
|
226
|
-
|
227
|
-
{% endif %}
|
228
|
-
{% endfor %}
|
229
|
-
|
230
|
-
{% assign _content = _heading_content %}
|
231
|
-
|
232
|
-
<!-- Wrap prompt element of blockquote with the <div> tag -->
|
233
|
-
|
234
|
-
{% assign blockquote_start = '<blockquote class=' %}
|
235
|
-
{% assign blockquote_end = '</blockquote>' %}
|
236
|
-
{% assign cls_prefix = 'prompt-' %}
|
237
|
-
|
238
|
-
{% if _content contains blockquote_start %}
|
239
|
-
|
240
|
-
{% assign _prompt_content = nil %}
|
241
|
-
{% assign _prompt_snippets = _content | split: blockquote_start %}
|
242
|
-
|
243
|
-
{% for _snippet in _prompt_snippets %}
|
244
|
-
|
245
|
-
{% if forloop.first %}
|
246
|
-
{% assign _prompt_content = _snippet %}
|
247
|
-
{% continue %}
|
248
|
-
{% endif %}
|
249
|
-
|
250
|
-
{% assign left = _snippet | split: blockquote_end | first %}
|
251
|
-
{% assign right = _snippet | slice: left.size, _snippet.size %}
|
252
|
-
|
253
|
-
{% assign cls_str = left | split: '>' | first %}
|
254
|
-
{% assign cls_array = cls_str | remove: '"' | split: ' ' %}
|
255
|
-
{% assign is_prompt = false %}
|
256
|
-
|
257
|
-
{% for cls in cls_array %}
|
258
|
-
{% if cls contains cls_prefix %}
|
259
|
-
{% assign is_prompt = true %}
|
260
|
-
{% break %}
|
261
|
-
{% endif %}
|
262
|
-
{% endfor %}
|
263
|
-
|
264
|
-
{% unless is_prompt %}
|
265
|
-
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: _snippet %}
|
266
|
-
{% continue %}
|
267
|
-
{% endunless %}
|
268
|
-
|
269
|
-
{% assign left = left | slice: cls_str.size, left.size %}
|
270
|
-
{% assign left = cls_str | append: '><div' | append: left | append: '</div>' %}
|
271
|
-
|
272
|
-
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: left | append: right %}
|
273
|
-
|
274
|
-
{% endfor %}
|
275
|
-
|
276
|
-
{% assign _content = _prompt_content %}
|
277
|
-
|
278
|
-
{% endif %}
|
279
|
-
|
280
|
-
<!-- return -->
|
281
|
-
|
282
|
-
{{ _content }}
|
1
|
+
<!--
|
2
|
+
Refactor the HTML structure.
|
3
|
+
-->
|
4
|
+
|
5
|
+
{% assign _content = include.content %}
|
6
|
+
|
7
|
+
<!--
|
8
|
+
In order to allow a wide table to scroll horizontally,
|
9
|
+
we suround the markdown table with `<div class="table-wrapper">` and `</div>`
|
10
|
+
-->
|
11
|
+
|
12
|
+
{% if _content contains '<table' %}
|
13
|
+
{% assign _content = _content
|
14
|
+
| replace: '<table', '<div class="table-wrapper"><table'
|
15
|
+
| replace: '</table>', '</table></div>'
|
16
|
+
| replace: '<code><div class="table-wrapper">', '<code>'
|
17
|
+
| replace: '</table></div></code>', '</table></code>'
|
18
|
+
%}
|
19
|
+
{% endif %}
|
20
|
+
|
21
|
+
<!--
|
22
|
+
Fixed kramdown code highlight rendering:
|
23
|
+
https://github.com/penibelst/jekyll-compress-html/issues/101
|
24
|
+
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
|
25
|
+
-->
|
26
|
+
|
27
|
+
{% if _content contains '<pre class="highlight">' %}
|
28
|
+
{% assign _content = _content
|
29
|
+
| replace: '<div class="highlight"><pre class="highlight"><code', '<div class="highlight"><code'
|
30
|
+
| replace: '</code></pre></div>', '</code></div>'
|
31
|
+
%}
|
32
|
+
{% endif %}
|
33
|
+
|
34
|
+
<!-- Add attribute 'hide-bullet' to the checkbox list -->
|
35
|
+
|
36
|
+
{% if _content contains '<li class="task-list-item"><' %}
|
37
|
+
{% assign _content = _content
|
38
|
+
| replace: '"task-list-item"><', '"task-list-item" hide-bullet><'
|
39
|
+
%}
|
40
|
+
{% endif %}
|
41
|
+
|
42
|
+
<!-- images -->
|
43
|
+
|
44
|
+
{% assign IMG_TAG = '<img ' %}
|
45
|
+
|
46
|
+
{% if _content contains IMG_TAG %}
|
47
|
+
{% assign _img_content = nil %}
|
48
|
+
{% assign _img_snippets = _content | split: IMG_TAG %}
|
49
|
+
|
50
|
+
{% for _img_snippet in _img_snippets %}
|
51
|
+
{% if forloop.first %}
|
52
|
+
{% assign _img_content = _img_snippet %}
|
53
|
+
{% continue %}
|
54
|
+
{% endif %}
|
55
|
+
|
56
|
+
{% assign _width = nil %}
|
57
|
+
{% assign _height = nil %}
|
58
|
+
{% assign _src = nil %}
|
59
|
+
|
60
|
+
{% assign _left = _img_snippet | split: '>' | first %}
|
61
|
+
{% assign _right = _img_snippet | remove: _left %}
|
62
|
+
|
63
|
+
{% assign _left = _left | remove: ' /' %}
|
64
|
+
{% assign _left = _left | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
|
65
|
+
{% assign _attrs = _left | split: ' ' %}
|
66
|
+
|
67
|
+
{% for _attr in _attrs %}
|
68
|
+
{% assign _pair = _attr | split: '=' %}
|
69
|
+
{% if _pair.size < 2 %}
|
70
|
+
{% continue %}
|
71
|
+
{% endif %}
|
72
|
+
|
73
|
+
{% capture _key %}{{ _pair | first }}{% endcapture %}
|
74
|
+
{% capture _value %}{{ _pair | last | replace: '"', '' }}{% endcapture %}
|
75
|
+
|
76
|
+
{% case _key %}
|
77
|
+
{% when 'width' %}
|
78
|
+
{% assign _width = _value %}
|
79
|
+
{% when 'height' %}
|
80
|
+
{% assign _height = _value %}
|
81
|
+
{% when 'src' %}
|
82
|
+
{% assign _src = _value %}
|
83
|
+
{% endcase %}
|
84
|
+
|
85
|
+
{% if _width and _height and _src %}
|
86
|
+
{% break %}
|
87
|
+
{% endif %}
|
88
|
+
{% endfor %}
|
89
|
+
|
90
|
+
{% if _src %}
|
91
|
+
{% unless _src contains '://' %}
|
92
|
+
|
93
|
+
<!-- Add CDN URL -->
|
94
|
+
{% if site.img_cdn %}
|
95
|
+
{% if site.img_cdn contains '//' %}
|
96
|
+
{% assign _src_prefix = site.img_cdn %}
|
97
|
+
{% else %}
|
98
|
+
{% assign _src_prefix = site.img_cdn | relative_url %}
|
99
|
+
{% endif %}
|
100
|
+
{% else %}
|
101
|
+
{% assign _src_prefix = site.baseurl %}
|
102
|
+
{% endif %}
|
103
|
+
|
104
|
+
<!-- Add image path -->
|
105
|
+
{% if page.img_path %}
|
106
|
+
{% assign _path = page.img_path %}
|
107
|
+
{% assign last_char = _path | slice: -1 %}
|
108
|
+
|
109
|
+
{% unless last_char == '/' %}
|
110
|
+
{% assign _path = _path | append: '/' %}
|
111
|
+
{% endunless %}
|
112
|
+
|
113
|
+
{% assign _src_prefix = _src_prefix | append: _path %}
|
114
|
+
{% endif %}
|
115
|
+
|
116
|
+
{% assign _final_src = _src_prefix | append: _src %}
|
117
|
+
{% assign _left = _left | replace: _src, _final_src %}
|
118
|
+
|
119
|
+
{% endunless %}
|
120
|
+
|
121
|
+
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
|
122
|
+
|
123
|
+
{% assign _left = _left | replace: 'src=', 'data-src=' %}
|
124
|
+
|
125
|
+
{% endif %}
|
126
|
+
|
127
|
+
<!-- Add SVG placehoder to prevent layout reflow -->
|
128
|
+
|
129
|
+
{% if _width and _height %}
|
130
|
+
{%- capture _svg -%}
|
131
|
+
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{ _width }} {{ _height }}'%3E%3C/svg%3E"
|
132
|
+
{%- endcapture -%}
|
133
|
+
|
134
|
+
{% assign _left = _svg | append: ' ' | append: _left %}
|
135
|
+
{% endif %}
|
136
|
+
|
137
|
+
<!-- Bypass the HTML-proofer test -->
|
138
|
+
{% assign _left = _left | append: ' data-proofer-ignore' %}
|
139
|
+
|
140
|
+
{% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %}
|
141
|
+
|
142
|
+
{% endfor %}
|
143
|
+
|
144
|
+
{% assign _content = _img_content %}
|
145
|
+
|
146
|
+
{% endif %}
|
147
|
+
|
148
|
+
<!-- Add header for code snippets -->
|
149
|
+
|
150
|
+
{% if _content contains '<div class="highlight"><code>' %}
|
151
|
+
{% assign _code_spippets = _content | split: '<div class="highlight"><code>' %}
|
152
|
+
{% assign _new_content = '' %}
|
153
|
+
|
154
|
+
{% for _snippet in _code_spippets %}
|
155
|
+
|
156
|
+
{% if forloop.last %}
|
157
|
+
{% assign _new_content = _new_content | append: _snippet %}
|
158
|
+
|
159
|
+
{% else %}
|
160
|
+
|
161
|
+
{% assign _left = _snippet | split: '><' | last%}
|
162
|
+
|
163
|
+
{% if _left contains 'file="' %}
|
164
|
+
{% assign _label_text = _left | split: 'file="' | last | split: '"' | first %}
|
165
|
+
{% assign _label_icon = 'far fa-file-code' %}
|
166
|
+
{% else %}
|
167
|
+
{% assign _lang = _left | split: 'language-' | last | split: ' ' | first %}
|
168
|
+
{% capture _label_text %}{% include language-alias.html language=_lang %}{% endcapture %}
|
169
|
+
{% assign _label_icon = 'fas fa-code small' %}
|
170
|
+
{% endif %}
|
171
|
+
|
172
|
+
{% capture _label %}
|
173
|
+
<span data-label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span>
|
174
|
+
{% endcapture %}
|
175
|
+
|
176
|
+
{% assign _new_content = _new_content | append: _snippet
|
177
|
+
| append: '<div class="code-header">'
|
178
|
+
| append: _label
|
179
|
+
| append: '<button aria-label="copy" data-title-succeed="'
|
180
|
+
| append: site.data.locales[lang].post.button.copy_code.succeed
|
181
|
+
| append: '"><i class="far fa-clipboard"></i></button></div>'
|
182
|
+
| append: '<div class="highlight"><code>'
|
183
|
+
%}
|
184
|
+
|
185
|
+
{% endif %}
|
186
|
+
|
187
|
+
{% endfor %}
|
188
|
+
|
189
|
+
{% assign _content = _new_content %}
|
190
|
+
|
191
|
+
{% endif %}
|
192
|
+
|
193
|
+
<!-- Create heading anchors -->
|
194
|
+
|
195
|
+
{% assign heading_levels = '2,3,4,5' | split: ',' %}
|
196
|
+
{% assign _heading_content = _content %}
|
197
|
+
|
198
|
+
{% for level in heading_levels %}
|
199
|
+
{% capture mark_start %}<h{{ level }} id="{% endcapture %}
|
200
|
+
{% capture mark_end %}</h{{ level }}>{% endcapture %}
|
201
|
+
|
202
|
+
{% if _heading_content contains mark_start %}
|
203
|
+
{% assign _new_content = nil %}
|
204
|
+
{% assign heading_snippets = _heading_content | split: mark_start %}
|
205
|
+
|
206
|
+
{% for snippet in heading_snippets %}
|
207
|
+
{% if forloop.first %}
|
208
|
+
{% assign _new_content = snippet %}
|
209
|
+
{% continue %}
|
210
|
+
{% endif %}
|
211
|
+
|
212
|
+
{% assign id = snippet | split: '"' | first %}
|
213
|
+
{% capture anchor %}<a href="#{{ id }}" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>{% endcapture %}
|
214
|
+
|
215
|
+
{% assign left = snippet | split: mark_end | first %}
|
216
|
+
{% assign right = snippet | slice: left.size, snippet.size %}
|
217
|
+
{% assign left = left | replace: '">', '"><span class="mr-2">' | append: '</span>' %}
|
218
|
+
|
219
|
+
{% assign _new_content = _new_content | append: mark_start
|
220
|
+
| append: left | append: anchor | append: right
|
221
|
+
%}
|
222
|
+
|
223
|
+
{% endfor %}
|
224
|
+
|
225
|
+
{% assign _heading_content = _new_content %}
|
226
|
+
|
227
|
+
{% endif %}
|
228
|
+
{% endfor %}
|
229
|
+
|
230
|
+
{% assign _content = _heading_content %}
|
231
|
+
|
232
|
+
<!-- Wrap prompt element of blockquote with the <div> tag -->
|
233
|
+
|
234
|
+
{% assign blockquote_start = '<blockquote class=' %}
|
235
|
+
{% assign blockquote_end = '</blockquote>' %}
|
236
|
+
{% assign cls_prefix = 'prompt-' %}
|
237
|
+
|
238
|
+
{% if _content contains blockquote_start %}
|
239
|
+
|
240
|
+
{% assign _prompt_content = nil %}
|
241
|
+
{% assign _prompt_snippets = _content | split: blockquote_start %}
|
242
|
+
|
243
|
+
{% for _snippet in _prompt_snippets %}
|
244
|
+
|
245
|
+
{% if forloop.first %}
|
246
|
+
{% assign _prompt_content = _snippet %}
|
247
|
+
{% continue %}
|
248
|
+
{% endif %}
|
249
|
+
|
250
|
+
{% assign left = _snippet | split: blockquote_end | first %}
|
251
|
+
{% assign right = _snippet | slice: left.size, _snippet.size %}
|
252
|
+
|
253
|
+
{% assign cls_str = left | split: '>' | first %}
|
254
|
+
{% assign cls_array = cls_str | remove: '"' | split: ' ' %}
|
255
|
+
{% assign is_prompt = false %}
|
256
|
+
|
257
|
+
{% for cls in cls_array %}
|
258
|
+
{% if cls contains cls_prefix %}
|
259
|
+
{% assign is_prompt = true %}
|
260
|
+
{% break %}
|
261
|
+
{% endif %}
|
262
|
+
{% endfor %}
|
263
|
+
|
264
|
+
{% unless is_prompt %}
|
265
|
+
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: _snippet %}
|
266
|
+
{% continue %}
|
267
|
+
{% endunless %}
|
268
|
+
|
269
|
+
{% assign left = left | slice: cls_str.size, left.size %}
|
270
|
+
{% assign left = cls_str | append: '><div' | append: left | append: '</div>' %}
|
271
|
+
|
272
|
+
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: left | append: right %}
|
273
|
+
|
274
|
+
{% endfor %}
|
275
|
+
|
276
|
+
{% assign _content = _prompt_content %}
|
277
|
+
|
278
|
+
{% endif %}
|
279
|
+
|
280
|
+
<!-- return -->
|
281
|
+
|
282
|
+
{{ _content }}
|