doc-theme 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +50 -0
  4. data/_data/locales/ar.yml +91 -0
  5. data/_data/locales/bg-BG.yml +81 -0
  6. data/_data/locales/cs-CZ.yml +89 -0
  7. data/_data/locales/de-DE.yml +87 -0
  8. data/_data/locales/el-GR.yml +91 -0
  9. data/_data/locales/en.yml +91 -0
  10. data/_data/locales/es-ES.yml +77 -0
  11. data/_data/locales/fi-FI.yml +90 -0
  12. data/_data/locales/fr-FR.yml +77 -0
  13. data/_data/locales/hu-HU.yml +79 -0
  14. data/_data/locales/id-ID.yml +77 -0
  15. data/_data/locales/it-IT.yml +90 -0
  16. data/_data/locales/ko-KR.yml +84 -0
  17. data/_data/locales/my-MM.yml +77 -0
  18. data/_data/locales/pt-BR.yml +77 -0
  19. data/_data/locales/ru-RU.yml +87 -0
  20. data/_data/locales/sl-SI.yml +91 -0
  21. data/_data/locales/sv-SE.yml +91 -0
  22. data/_data/locales/th.yml +91 -0
  23. data/_data/locales/tr-TR.yml +77 -0
  24. data/_data/locales/uk-UA.yml +77 -0
  25. data/_data/locales/vi-VN.yml +76 -0
  26. data/_data/locales/zh-CN.yml +83 -0
  27. data/_data/locales/zh-TW.yml +83 -0
  28. data/_data/origin/basic.yml +46 -0
  29. data/_data/origin/cors.yml +59 -0
  30. data/_includes/.DS_Store +0 -0
  31. data/_includes/analytics/goatcounter.html +6 -0
  32. data/_includes/analytics/google.html +13 -0
  33. data/_includes/comments/disqus.html +50 -0
  34. data/_includes/comments/giscus.html +65 -0
  35. data/_includes/comments/utterances.html +50 -0
  36. data/_includes/comments.html +5 -0
  37. data/_includes/datetime.html +20 -0
  38. data/_includes/embed/bilibili.html +9 -0
  39. data/_includes/embed/twitch.html +8 -0
  40. data/_includes/embed/video.html +38 -0
  41. data/_includes/embed/youtube.html +9 -0
  42. data/_includes/favicons.html +19 -0
  43. data/_includes/footer.html +42 -0
  44. data/_includes/head.html +111 -0
  45. data/_includes/img-url.html +39 -0
  46. data/_includes/js-selector.html +126 -0
  47. data/_includes/jsdelivr-combine.html +26 -0
  48. data/_includes/lang.html +10 -0
  49. data/_includes/language-alias.html +70 -0
  50. data/_includes/mermaid.html +58 -0
  51. data/_includes/metadata-hook.html +1 -0
  52. data/_includes/mode-toggle.html +143 -0
  53. data/_includes/no-linenos.html +10 -0
  54. data/_includes/notification.html +24 -0
  55. data/_includes/origin-type.html +13 -0
  56. data/_includes/pageviews/goatcounter.html +18 -0
  57. data/_includes/post-nav.html +34 -0
  58. data/_includes/post-paginator.html +91 -0
  59. data/_includes/post-sharing.html +52 -0
  60. data/_includes/read-time.html +37 -0
  61. data/_includes/refactor-content.html +255 -0
  62. data/_includes/related-posts.html +96 -0
  63. data/_includes/search-loader.html +47 -0
  64. data/_includes/search-results.html +10 -0
  65. data/_includes/sidebar.html +99 -0
  66. data/_includes/toc.html +13 -0
  67. data/_includes/topbar.html +77 -0
  68. data/_includes/trending-tags.html +46 -0
  69. data/_includes/update-list.html +40 -0
  70. data/_layouts/archives.html +35 -0
  71. data/_layouts/categories.html +138 -0
  72. data/_layouts/category.html +24 -0
  73. data/_layouts/compress.html +10 -0
  74. data/_layouts/default.html +87 -0
  75. data/_layouts/home.html +118 -0
  76. data/_layouts/page.html +20 -0
  77. data/_layouts/post.html +149 -0
  78. data/_layouts/tag.html +23 -0
  79. data/_layouts/tags.html +22 -0
  80. data/_sass/.DS_Store +0 -0
  81. data/_sass/addon/commons.scss +1553 -0
  82. data/_sass/addon/module.scss +200 -0
  83. data/_sass/addon/syntax.scss +292 -0
  84. data/_sass/addon/variables.scss +33 -0
  85. data/_sass/colors/syntax-dark.scss +164 -0
  86. data/_sass/colors/syntax-light.scss +214 -0
  87. data/_sass/colors/typography-dark.scss +147 -0
  88. data/_sass/colors/typography-light.scss +112 -0
  89. data/_sass/layout/archives.scss +144 -0
  90. data/_sass/layout/categories.scss +83 -0
  91. data/_sass/layout/category-tag.scss +72 -0
  92. data/_sass/layout/home.scss +189 -0
  93. data/_sass/layout/post.scss +357 -0
  94. data/_sass/layout/tags.scss +19 -0
  95. data/_sass/main.scss +13 -0
  96. data/_sass/variables-hook.scss +3 -0
  97. data/assets/.DS_Store +0 -0
  98. data/assets/404.html +14 -0
  99. data/assets/css/doc-theme.scss +6 -0
  100. data/assets/feed.xml +61 -0
  101. data/assets/img/favicons/android-chrome-192x192.png +0 -0
  102. data/assets/img/favicons/android-chrome-512x512.png +0 -0
  103. data/assets/img/favicons/apple-touch-icon.png +0 -0
  104. data/assets/img/favicons/browserconfig.xml +13 -0
  105. data/assets/img/favicons/favicon-16x16.png +0 -0
  106. data/assets/img/favicons/favicon-32x32.png +0 -0
  107. data/assets/img/favicons/favicon.ico +0 -0
  108. data/assets/img/favicons/mstile-150x150.png +0 -0
  109. data/assets/img/favicons/site.webmanifest +26 -0
  110. data/assets/js/data/search.json +20 -0
  111. data/assets/js/data/swconf.js +51 -0
  112. data/assets/js/pwa/app.js +54 -0
  113. data/assets/js/pwa/sw.js +101 -0
  114. data/assets/robots.txt +10 -0
  115. metadata +260 -0
@@ -0,0 +1,52 @@
1
+ <!-- Post sharing snippet -->
2
+
3
+ <div class="share-wrapper d-flex align-items-center">
4
+ <span class="share-label text-muted">{{ site.data.locales[include.lang].post.share }}</span>
5
+ <span class="share-icons">
6
+ {% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
7
+ {% assign title = title | uri_escape %}
8
+ {% assign url = page.url | absolute_url | url_encode %}
9
+
10
+ {% for share in site.data.share.platforms -%}
11
+ {%- capture tooltip -%}
12
+ data-bs-toggle="tooltip" data-bs-placement="top" title="{{ share.type }}" aria-label="{{ share.type }}"
13
+ {%- endcapture -%}
14
+
15
+ {% if share.type == 'Mastodon' %}
16
+ <script defer type="module" src="https://cdn.jsdelivr.net/npm/@justinribeiro/share-to-mastodon/+esm"></script>
17
+ <button class="btn text-start" {{ tooltip }}>
18
+ <share-to-mastodon
19
+ class="share-mastodon"
20
+ message="{{ title }}"
21
+ url="{{ url }}"
22
+ {%- if share.instances -%}
23
+ customInstanceList="{{ share.instances | jsonify | xml_escape }}"
24
+ {%- endif %}
25
+ >
26
+ <i class="fa-fw {{ share.icon }}"></i>
27
+ </share-to-mastodon>
28
+ </button>
29
+
30
+ {% continue %}
31
+ {% endif %}
32
+
33
+ {% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
34
+
35
+ <a href="{{ link }}" target="_blank" rel="noopener" {{ tooltip }}>
36
+ <i class="fa-fw {{ share.icon }}"></i>
37
+ </a>
38
+ {% endfor %}
39
+
40
+ <button
41
+ id="copy-link"
42
+ aria-label="Copy link"
43
+ class="btn small"
44
+ data-bs-toggle="tooltip"
45
+ data-bs-placement="top"
46
+ title="{{ site.data.locales[include.lang].post.button.share_link.title }}"
47
+ data-title-succeed="{{ site.data.locales[include.lang].post.button.share_link.succeed }}"
48
+ >
49
+ <i class="fa-fw fas fa-link pe-none fs-6"></i>
50
+ </button>
51
+ </span>
52
+ </div>
@@ -0,0 +1,37 @@
1
+ <!-- Calculate the post's reading time, and display the word count in tooltip -->
2
+
3
+ {% assign words = include.content | strip_html | number_of_words: 'auto' %}
4
+
5
+ <!-- words per minute -->
6
+
7
+ {% assign wpm = 180 %}
8
+ {% assign min_time = 1 %}
9
+
10
+ {% assign read_time = words | divided_by: wpm %}
11
+
12
+ {% unless read_time > 0 %}
13
+ {% assign read_time = min_time %}
14
+ {% endunless %}
15
+
16
+ {% capture read_prompt %}
17
+ {{- site.data.locales[include.lang].post.read_time.prompt -}}
18
+ {% endcapture %}
19
+
20
+ <!-- return element -->
21
+ <span
22
+ class="readtime"
23
+ data-bs-toggle="tooltip"
24
+ data-bs-placement="bottom"
25
+ title="{{ words }} {{ site.data.locales[include.lang].post.words }}"
26
+ >
27
+ <em>
28
+ {{- read_time -}}
29
+ {{ ' ' }}
30
+ {{- site.data.locales[include.lang].post.read_time.unit -}}
31
+ </em>
32
+ {%- if include.prompt -%}
33
+ {%- assign _prompt_words = read_prompt | number_of_words: 'auto' -%}
34
+ {%- unless _prompt_words > 1 -%}{{ ' ' }}{%- endunless -%}
35
+ {{ read_prompt }}
36
+ {%- endif -%}
37
+ </span>
@@ -0,0 +1,255 @@
1
+ <!-- Refactor the HTML structure -->
2
+
3
+ {% assign _content = include.content %}
4
+
5
+ <!--
6
+ In order to allow a wide table to scroll horizontally,
7
+ we suround the markdown table with `<div class="table-wrapper">` and `</div>`
8
+ -->
9
+
10
+ {% if _content contains '<table' %}
11
+ {% assign _content = _content
12
+ | replace: '<table', '<div class="table-wrapper"><table'
13
+ | replace: '</table>', '</table></div>'
14
+ | replace: '<code><div class="table-wrapper">', '<code>'
15
+ | replace: '</table></div></code>', '</table></code>'
16
+ %}
17
+ {% endif %}
18
+
19
+ <!--
20
+ Fixed kramdown code highlight rendering:
21
+ https://github.com/penibelst/jekyll-compress-html/issues/101
22
+ https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
23
+ -->
24
+
25
+ {% if _content contains '<pre class="highlight">' %}
26
+ {% assign _content = _content
27
+ | replace: '<div class="highlight"><pre class="highlight"><code', '<div class="highlight"><code'
28
+ | replace: '</code></pre></div>', '</code></div>'
29
+ %}
30
+ {% endif %}
31
+
32
+ <!-- Change the icon of checkbox -->
33
+
34
+ {% if _content contains '<input type="checkbox"' %}
35
+ {% assign _content = _content
36
+ | replace: '<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" checked="checked" />',
37
+ '<i class="fas fa-check-circle fa-fw checked"></i>'
38
+ | replace: '<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" />',
39
+ '<i class="far fa-circle fa-fw"></i>'
40
+ %}
41
+ {% endif %}
42
+
43
+ <!-- Handle images -->
44
+
45
+ {% assign IMG_TAG = '<img ' %}
46
+
47
+ {% if _content contains IMG_TAG %}
48
+ {% assign _img_content = null %}
49
+ {% assign _img_snippets = _content | split: IMG_TAG %}
50
+
51
+ {% for _img_snippet in _img_snippets %}
52
+ {% if forloop.first %}
53
+ {% assign _img_content = _img_snippet %}
54
+ {% continue %}
55
+ {% endif %}
56
+
57
+ {% assign _left = _img_snippet | split: '>' | first %}
58
+ {% assign _right = _img_snippet | remove: _left %}
59
+
60
+ {% unless _left contains 'src=' %}
61
+ {% continue %}
62
+ {% endunless %}
63
+
64
+ {% assign _left = _left | remove: ' /' | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
65
+ {% assign _attrs = _left | split: '" ' %}
66
+
67
+ {% assign _src = null %}
68
+ {% assign _lqip = null %}
69
+ {% assign _class = null %}
70
+
71
+ {% for _attr in _attrs %}
72
+ {% unless _attr contains '=' %}
73
+ {% continue %}
74
+ {% endunless %}
75
+
76
+ {% assign _pair = _attr | split: '="' %}
77
+ {% capture _key %}{{ _pair | first }}{% endcapture %}
78
+ {% capture _value %}{{ _pair | last | remove: '"' }}{% endcapture %}
79
+
80
+ {% case _key %}
81
+ {% when 'src' %}
82
+ {% assign _src = _value %}
83
+ {% when 'lqip' %}
84
+ {% assign _lqip = _value %}
85
+ {% when 'class' %}
86
+ {% assign _class = _value %}
87
+ {% endcase %}
88
+ {% endfor %}
89
+
90
+ <!-- take out classes -->
91
+ {% if _class %}
92
+ {% capture _old_class %}class="{{ _class }}"{% endcapture %}
93
+ {% assign _left = _left | remove: _old_class %}
94
+ {% endif %}
95
+
96
+ {% assign _final_src = null %}
97
+ {% assign _lazyload = true %}
98
+
99
+ {%- capture _img_url -%}
100
+ {% include img-url.html src=_src img_path=page.img_path %}
101
+ {%- endcapture -%}
102
+
103
+ {% assign _path_prefix = _img_url | remove: _src %}
104
+
105
+ {% unless _src contains '//' %}
106
+ {% assign _final_src = _path_prefix | append: _src %}
107
+ {% assign _src_alt = 'src="' | append: _path_prefix %}
108
+ {% assign _left = _left | replace: 'src="', _src_alt %}
109
+ {% endunless %}
110
+
111
+ {% if _lqip %}
112
+ {% assign _lazyload = false %}
113
+ {% assign _class = _class | append: ' blur' %}
114
+
115
+ {% unless _lqip contains 'data:' %}
116
+ {% assign _lqip_alt = 'lqip="' | append: _path_prefix %}
117
+ {% assign _left = _left | replace: 'lqip="', _lqip_alt %}
118
+ {% endunless %}
119
+
120
+ <!-- add image placeholder -->
121
+ {% assign _left = _left | replace: 'src=', 'data-src=' | replace: ' lqip=', ' data-lqip="true" src=' %}
122
+
123
+ {% else %}
124
+ {% assign _class = _class | append: ' shimmer' %}
125
+ {% endif %}
126
+
127
+ <!-- lazy-load images -->
128
+ {% if _lazyload %}
129
+ {% assign _left = _left | append: ' loading="lazy"' %}
130
+ {% endif %}
131
+
132
+ {% if page.layout == 'home' %}
133
+ <!-- create the image wrapper -->
134
+ {% assign _wrapper_start = '<div class="preview-img ' | append: _class | append: '">' %}
135
+
136
+ {% assign _img_content = _img_content | append: _wrapper_start %}
137
+ {% assign _right = _right | prepend: '></div' %}
138
+
139
+ {% else %}
140
+ <!-- make sure the `<img>` is wrapped by `<a>` -->
141
+ {% assign _parent = _right | slice: 1, 4 %}
142
+
143
+ {% if _parent == '</a>' %}
144
+ <!-- add class to exist <a> tag -->
145
+ {% assign _size = _img_content | size | minus: 1 %}
146
+ {% capture _class %}
147
+ class="img-link{% unless _lqip %} shimmer{% endunless %}"
148
+ {% endcapture %}
149
+ {% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
150
+
151
+ {% else %}
152
+ <!-- create the image wrapper -->
153
+ {% assign _wrapper_start = _final_src
154
+ | default: _src
155
+ | prepend: '<a href="'
156
+ | append: '" class="popup img-link '
157
+ | append: _class
158
+ | append: '">'
159
+ %}
160
+
161
+ {% assign _img_content = _img_content | append: _wrapper_start %}
162
+ {% assign _right = '></a' | append: _right %}
163
+ {% endif %}
164
+ {% endif %}
165
+
166
+ <!-- combine -->
167
+ {% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %}
168
+ {% endfor %}
169
+
170
+ {% if _img_content %}
171
+ {% assign _content = _img_content %}
172
+ {% endif %}
173
+ {% endif %}
174
+
175
+ <!-- Add header for code snippets -->
176
+
177
+ {% if _content contains '<div class="highlight"><code>' %}
178
+ {% assign _code_spippets = _content | split: '<div class="highlight"><code>' %}
179
+ {% assign _new_content = '' %}
180
+
181
+ {% for _snippet in _code_spippets %}
182
+ {% if forloop.last %}
183
+ {% assign _new_content = _new_content | append: _snippet %}
184
+
185
+ {% else %}
186
+ {% assign _left = _snippet | split: '><' | last %}
187
+
188
+ {% if _left contains 'file="' %}
189
+ {% assign _label_text = _left | split: 'file="' | last | split: '"' | first %}
190
+ {% assign _label_icon = 'far fa-file-code fa-fw' %}
191
+ {% else %}
192
+ {% assign _lang = _left | split: 'language-' | last | split: ' ' | first %}
193
+ {% capture _label_text %}{% include language-alias.html language=_lang %}{% endcapture %}
194
+ {% assign _label_icon = 'fas fa-code fa-fw small' %}
195
+ {% endif %}
196
+
197
+ {% capture _label %}
198
+ <span data-label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span>
199
+ {% endcapture %}
200
+
201
+ {% assign _new_content = _new_content
202
+ | append: _snippet
203
+ | append: '<div class="code-header">'
204
+ | append: _label
205
+ | append: '<button aria-label="copy" data-title-succeed="'
206
+ | append: site.data.locales[include.lang].post.button.copy_code.succeed
207
+ | append: '"><i class="far fa-clipboard"></i></button></div>'
208
+ | append: '<div class="highlight"><code>'
209
+ %}
210
+ {% endif %}
211
+ {% endfor %}
212
+
213
+ {% assign _content = _new_content %}
214
+ {% endif %}
215
+
216
+ <!-- Create heading anchors -->
217
+
218
+ {% assign heading_levels = '2,3,4,5' | split: ',' %}
219
+ {% assign _heading_content = _content %}
220
+
221
+ {% for level in heading_levels %}
222
+ {% assign mark_start = '<h' | append: level | append: ' id="' %}
223
+ {% assign mark_end = '</h' | append: level | append: '>' %}
224
+
225
+ {% if _heading_content contains mark_start %}
226
+ {% assign _new_content = null %}
227
+ {% assign heading_snippets = _heading_content | split: mark_start %}
228
+
229
+ {% for snippet in heading_snippets %}
230
+ {% if forloop.first %}
231
+ {% assign _new_content = snippet %}
232
+ {% continue %}
233
+ {% endif %}
234
+
235
+ {% assign id = snippet | split: '"' | first %}
236
+ {% assign anchor = '<a href="#'
237
+ | append: id
238
+ | append: '" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>'
239
+ %}
240
+
241
+ {% assign left = snippet | split: mark_end | first %}
242
+ {% assign right = snippet | slice: left.size, snippet.size %}
243
+ {% assign left = left | replace_first: '">', '"><span class="me-2">' | append: '</span>' %}
244
+
245
+ {% assign _new_content = _new_content | append: mark_start | append: left | append: anchor | append: right %}
246
+ {% endfor %}
247
+
248
+ {% assign _heading_content = _new_content %}
249
+ {% endif %}
250
+ {% endfor %}
251
+
252
+ {% assign _content = _heading_content %}
253
+
254
+ <!-- return -->
255
+ {{ _content }}
@@ -0,0 +1,96 @@
1
+ <!-- Recommend the other 3 posts according to the tags and categories of the current post. -->
2
+
3
+ <!-- The total size of related posts -->
4
+ {% assign TOTAL_SIZE = 3 %}
5
+
6
+ <!-- An random integer that bigger than 0 -->
7
+ {% assign TAG_SCORE = 1 %}
8
+
9
+ <!-- Equals to TAG_SCORE / {max_categories_hierarchy} -->
10
+ {% assign CATEGORY_SCORE = 0.5 %}
11
+
12
+ {% assign SEPARATOR = ':' %}
13
+
14
+ {% assign match_posts = '' | split: '' %}
15
+
16
+ {% for category in page.categories %}
17
+ {% assign match_posts = match_posts | push: site.categories[category] | uniq %}
18
+ {% endfor %}
19
+
20
+ {% for tag in page.tags %}
21
+ {% assign match_posts = match_posts | push: site.tags[tag] | uniq %}
22
+ {% endfor %}
23
+
24
+ {% assign last_index = match_posts.size | minus: 1 %}
25
+ {% assign score_list = '' | split: '' %}
26
+
27
+ {% for i in (0..last_index) %}
28
+ {% assign post = match_posts[i] %}
29
+
30
+ {% if post.url == page.url %}
31
+ {% continue %}
32
+ {% endif %}
33
+
34
+ {% assign score = 0 %}
35
+
36
+ {% for tag in post.tags %}
37
+ {% if page.tags contains tag %}
38
+ {% assign score = score | plus: TAG_SCORE %}
39
+ {% endif %}
40
+ {% endfor %}
41
+
42
+ {% for category in post.categories %}
43
+ {% if page.categories contains category %}
44
+ {% assign score = score | plus: CATEGORY_SCORE %}
45
+ {% endif %}
46
+ {% endfor %}
47
+
48
+ {% if score > 0 %}
49
+ {% capture score_item %}{{ score }}{{ SEPARATOR }}{{ i }}{% endcapture %}
50
+ {% assign score_list = score_list | push: score_item %}
51
+ {% endif %}
52
+ {% endfor %}
53
+
54
+ {% assign index_list = '' | split: '' %}
55
+
56
+ {% if score_list.size > 0 %}
57
+ {% assign score_list = score_list | sort | reverse %}
58
+ {% for entry in score_list limit: TOTAL_SIZE %}
59
+ {% assign index = entry | split: SEPARATOR | last %}
60
+ {% assign index_list = index_list | push: index %}
61
+ {% endfor %}
62
+ {% endif %}
63
+
64
+ {% assign relate_posts = '' | split: '' %}
65
+
66
+ {% for index in index_list %}
67
+ {% assign i = index | to_integer %}
68
+ {% assign relate_posts = relate_posts | push: match_posts[i] %}
69
+ {% endfor %}
70
+
71
+ {% if relate_posts.size > 0 %}
72
+ <aside id="related-posts" aria-labelledby="related-label">
73
+ <h3 class="mb-4" id="related-label">
74
+ {{- site.data.locales[include.lang].post.relate_posts -}}
75
+ </h3>
76
+ <nav class="row row-cols-1 row-cols-md-2 row-cols-xl-3 g-4 mb-4">
77
+ {% for post in relate_posts %}
78
+ <article class="col">
79
+ <a href="{{ post.url | relative_url }}" class="post-preview card h-100">
80
+ <div class="card-body">
81
+ {% include datetime.html date=post.date lang=include.lang %}
82
+ <h4 class="pt-0 my-2">{{ post.title }}</h4>
83
+ <div class="text-muted">
84
+ <p>
85
+ {% include no-linenos.html content=post.content %}
86
+ {{ content | markdownify | strip_html | truncate: 200 | escape }}
87
+ </p>
88
+ </div>
89
+ </div>
90
+ </a>
91
+ </article>
92
+ {% endfor %}
93
+ </nav>
94
+ </aside>
95
+ <!-- #related-posts -->
96
+ {% endif %}
@@ -0,0 +1,47 @@
1
+ <!--
2
+ Jekyll Simple Search loader
3
+ See: <https://github.com/christian-fei/Simple-Jekyll-Search>
4
+ -->
5
+
6
+ {% capture result_elem %}
7
+ <article class="px-1 px-sm-2 px-lg-4 px-xl-0">
8
+ <header>
9
+ <h2><a href="{url}">{title}</a></h2>
10
+ <div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
11
+ {categories}
12
+ {tags}
13
+ </div>
14
+ </header>
15
+ <p>{snippet}</p>
16
+ </article>
17
+ {% endcapture %}
18
+
19
+ {% capture not_found %}<p class="mt-5">{{ site.data.locales[include.lang].search.no_results }}</p>{% endcapture %}
20
+
21
+ <script>
22
+ /* Note: dependent library will be loaded in `js-selector.html` */
23
+ SimpleJekyllSearch({
24
+ searchInput: document.getElementById('search-input'),
25
+ resultsContainer: document.getElementById('search-results'),
26
+ json: '{{ '/assets/js/data/search.json' | relative_url }}',
27
+ searchResultTemplate: '{{ result_elem | strip_newlines }}',
28
+ noResultsText: '{{ not_found }}',
29
+ templateMiddleware: function(prop, value, template) {
30
+ if (prop === 'categories') {
31
+ if (value === '') {
32
+ return `${value}`;
33
+ } else {
34
+ return `<div class="me-sm-4"><i class="far fa-folder fa-fw"></i>${value}</div>`;
35
+ }
36
+ }
37
+
38
+ if (prop === 'tags') {
39
+ if (value === '') {
40
+ return `${value}`;
41
+ } else {
42
+ return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`;
43
+ }
44
+ }
45
+ }
46
+ });
47
+ </script>
@@ -0,0 +1,10 @@
1
+ <!-- The Search results -->
2
+
3
+ <div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
4
+ <div class="col-11 content">
5
+ <div id="search-hints">
6
+ {% include_cached trending-tags.html %}
7
+ </div>
8
+ <div id="search-results" class="d-flex flex-wrap justify-content-center text-muted mt-3"></div>
9
+ </div>
10
+ </div>
@@ -0,0 +1,99 @@
1
+ <!-- The Side Bar -->
2
+
3
+ <aside aria-label="Sidebar" id="sidebar" class="d-flex flex-column align-items-end">
4
+ <header class="profile-wrapper">
5
+ <a href="{{ '/' | relative_url }}" id="avatar" class="rounded-circle">
6
+ {%- if site.avatar != empty and site.avatar -%}
7
+ {%- capture avatar_url -%}
8
+ {% include img-url.html src=site.avatar %}
9
+ {%- endcapture -%}
10
+ <img src="{{- avatar_url -}}" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
11
+ {%- endif -%}
12
+ </a>
13
+
14
+ <h1 class="site-title">
15
+ <a href="{{ '/' | relative_url }}">{{ site.title }}</a>
16
+ </h1>
17
+ <p class="site-subtitle fst-italic mb-0">{{ site.tagline }}</p>
18
+ </header>
19
+ <!-- .profile-wrapper -->
20
+
21
+ <nav class="flex-column flex-grow-1 w-100 ps-0">
22
+ <ul class="nav">
23
+ <!-- home -->
24
+ <li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}">
25
+ <a href="{{ '/' | relative_url }}" class="nav-link">
26
+ <i class="fa-fw fas fa-home"></i>
27
+ <span>{{ site.data.locales[include.lang].tabs.home | upcase }}</span>
28
+ </a>
29
+ </li>
30
+ <!-- the real tabs -->
31
+ {% for tab in site.tabs %}
32
+ <li class="nav-item{% if tab.url == page.url %}{{ " active" }}{% endif %}">
33
+ <a href="{{ tab.url | relative_url }}" class="nav-link">
34
+ <i class="fa-fw {{ tab.icon }}"></i>
35
+ {% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %}
36
+
37
+ <span>{{ site.data.locales[include.lang].tabs.[tab_name] | default: tab.title | upcase }}</span>
38
+ </a>
39
+ </li>
40
+ <!-- .nav-item -->
41
+ {% endfor %}
42
+ </ul>
43
+ </nav>
44
+
45
+ <div class="sidebar-bottom d-flex flex-wrap align-items-center w-100">
46
+ {% unless site.theme_mode %}
47
+ <button type="button" class="mode-toggle btn" aria-label="Switch Mode">
48
+ <i class="fas fa-adjust"></i>
49
+ </button>
50
+
51
+ {% if site.data.contact.size > 0 %}
52
+ <span class="icon-border"></span>
53
+ {% endif %}
54
+ {% endunless %}
55
+
56
+ {% for entry in site.data.contact %}
57
+ {% case entry.type %}
58
+ {% when 'github', 'twitter' %}
59
+ {%- capture url -%}
60
+ https://{{ entry.type }}.com/{{ site[entry.type].username }}
61
+ {%- endcapture -%}
62
+ {% when 'email' %}
63
+ {% assign email = site.social.email | split: '@' %}
64
+ {%- capture url -%}
65
+ javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
66
+ {%- endcapture -%}
67
+ {% when 'rss' %}
68
+ {% assign url = '/feed.xml' | relative_url %}
69
+ {% else %}
70
+ {% assign url = entry.url %}
71
+ {% endcase %}
72
+
73
+ {% if url %}
74
+ <a
75
+ href="{{ url }}"
76
+ aria-label="{{ entry.type }}"
77
+ {% assign link_types = '' %}
78
+
79
+ {% unless entry.noblank %}
80
+ target="_blank"
81
+ {% assign link_types = 'noopener noreferrer' %}
82
+ {% endunless %}
83
+
84
+ {% if entry.type == 'mastodon' %}
85
+ {% assign link_types = link_types | append: ' me' | strip %}
86
+ {% endif %}
87
+
88
+ {% unless link_types == empty %}
89
+ rel="{{ link_types }}"
90
+ {% endunless %}
91
+ >
92
+ <i class="{{ entry.icon }}"></i>
93
+ </a>
94
+ {% endif %}
95
+ {% endfor %}
96
+ </div>
97
+ <!-- .sidebar-bottom -->
98
+ </aside>
99
+ <!-- #sidebar -->
@@ -0,0 +1,13 @@
1
+ {% assign enable_toc = false %}
2
+ {% if site.toc and page.toc %}
3
+ {% if page.content contains '<h2' or page.content contains '<h3' %}
4
+ {% assign enable_toc = true %}
5
+ {% endif %}
6
+ {% endif %}
7
+
8
+ {% if enable_toc %}
9
+ <section id="toc-wrapper" class="ps-0 pe-4">
10
+ <h2 class="panel-heading ps-3 pt-2 mb-2">{{- site.data.locales[include.lang].panel.toc -}}</h2>
11
+ <nav id="toc"></nav>
12
+ </section>
13
+ {% endif %}