jekyll-theme-chirpy 5.5.2 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,4 @@
1
- <!--
2
- JS selector for site.
3
- -->
1
+ <!-- JS selector for site. -->
4
2
 
5
3
  <!-- layout specified -->
6
4
 
@@ -8,51 +6,50 @@
8
6
  {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
9
7
  <!-- pv-report needs countup.js -->
10
8
  <script async src="{{ site.data.assets[origin].countup.js | relative_url }}"></script>
11
- <script defer src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
12
9
  {% endif %}
13
10
  {% endif %}
14
11
 
15
12
  {% if page.layout == 'post' or page.layout == 'page' %}
16
13
  <!-- image lazy-loading & popup & clipboard -->
17
- {% assign _urls = site.data.assets[origin].magnific-popup.js
18
- | append: ',' | append: site.data.assets[origin].lazysizes.js
19
- | append: ',' | append: site.data.assets[origin].clipboard.js
14
+ {% assign _urls = site.data.assets[origin]['magnific-popup'].js
15
+ | append: ','
16
+ | append: site.data.assets[origin].lazysizes.js
17
+ | append: ','
18
+ | append: site.data.assets[origin].clipboard.js
20
19
  %}
21
20
 
22
21
  {% include jsdelivr-combine.html urls=_urls %}
23
22
  {% endif %}
24
23
 
25
24
  {% if page.layout == 'home'
26
- or page.layout == 'post'
27
- or page.layout == 'archives'
28
- or page.layout == 'category'
29
- or page.layout == 'tag' %}
30
-
25
+ or page.layout == 'post'
26
+ or page.layout == 'archives'
27
+ or page.layout == 'category'
28
+ or page.layout == 'tag'
29
+ %}
31
30
  {% assign locale = site.lang | split: '-' | first %}
32
31
 
33
32
  {% assign _urls = site.data.assets[origin].dayjs.js.common
34
- | append: ',' | append: site.data.assets[origin].dayjs.js.locale
35
- | replace: ':LOCALE', locale
36
- | append: ',' | append: site.data.assets[origin].dayjs.js.relativeTime
37
- | append: ',' | append: site.data.assets[origin].dayjs.js.localizedFormat
33
+ | append: ','
34
+ | append: site.data.assets[origin].dayjs.js.locale
35
+ | replace: ':LOCALE', locale
36
+ | append: ','
37
+ | append: site.data.assets[origin].dayjs.js.relativeTime
38
+ | append: ','
39
+ | append: site.data.assets[origin].dayjs.js.localizedFormat
38
40
  %}
39
41
 
40
42
  {% include jsdelivr-combine.html urls=_urls %}
41
-
42
43
  {% endif %}
43
44
 
44
- {% if page.layout == 'home'
45
- or page.layout == 'categories'
46
- or page.layout == 'post'
47
- or page.layout == 'page' %}
48
- {% assign type = page.layout %}
49
- {% elsif page.layout == 'archives'
50
- or page.layout == 'category'
51
- or page.layout == 'tag' %}
52
- {% assign type = "misc" %}
53
- {% else %}
54
- {% assign type = "commons" %}
55
- {% endif %}
45
+ {% case page.layout %}
46
+ {% when 'categories', 'post', 'page' %}
47
+ {% assign type = page.layout %}
48
+ {% when 'home', 'archives', 'category', 'tag' %}
49
+ {% assign type = 'misc' %}
50
+ {% else %}
51
+ {% assign type = 'commons' %}
52
+ {% endcase %}
56
53
 
57
54
  {% capture script %}/assets/js/dist/{{ type }}.min.js{% endcapture %}
58
55
  <script defer src="{{ script | relative_url }}"></script>
@@ -60,23 +57,24 @@
60
57
  {% if page.math %}
61
58
  <!-- MathJax -->
62
59
  <script>
63
- /* see: <https://docs.mathjax.org/en/latest/options/input/tex.html#tex-options> */
64
- MathJax = {
65
- tex: {
66
- inlineMath: [ /* start/end delimiter pairs for in-line math */
67
- ['$','$'],
68
- ['\\(','\\)']
69
- ],
70
- displayMath: [ /* start/end delimiter pairs for display math */
71
- ['$$', '$$'],
72
- ['\\[', '\\]']
73
- ]
74
- }
75
- };
60
+ /* see: <https://docs.mathjax.org/en/latest/options/input/tex.html#tex-options> */
61
+ MathJax = {
62
+ tex: {
63
+ /* start/end delimiter pairs for in-line math */
64
+ inlineMath: [
65
+ ['$', '$'],
66
+ ['\\(', '\\)']
67
+ ],
68
+ /* start/end delimiter pairs for display math */
69
+ displayMath: [
70
+ ['$$', '$$'],
71
+ ['\\[', '\\]']
72
+ ]
73
+ }
74
+ };
76
75
  </script>
77
76
  <script src="{{ site.data.assets[origin].polyfill.js | relative_url }}"></script>
78
- <script id="MathJax-script" async src="{{ site.data.assets[origin].mathjax.js | relative_url }}">
79
- </script>
77
+ <script id="MathJax-script" async src="{{ site.data.assets[origin].mathjax.js | relative_url }}"></script>
80
78
  {% endif %}
81
79
 
82
80
  <!-- commons -->
@@ -95,5 +93,4 @@
95
93
  {% if site.google_analytics.id != empty and site.google_analytics.id %}
96
94
  {% include google-analytics.html %}
97
95
  {% endif %}
98
-
99
96
  {% endif %}
@@ -26,13 +26,12 @@
26
26
  let self = this;
27
27
 
28
28
  /* always follow the system prefers */
29
- this.sysDarkPrefers.addEventListener("change", () => {
29
+ this.sysDarkPrefers.addEventListener('change', () => {
30
30
  if (self.hasMode) {
31
31
  if (self.isDarkMode) {
32
32
  if (!self.isSysDarkPrefer) {
33
33
  self.setDark();
34
34
  }
35
-
36
35
  } else {
37
36
  if (self.isSysDarkPrefer) {
38
37
  self.setLight();
@@ -43,9 +42,7 @@
43
42
  }
44
43
 
45
44
  self.notify();
46
-
47
45
  });
48
-
49
46
  } /* constructor() */
50
47
 
51
48
  get sysDarkPrefers() { return window.matchMedia("(prefers-color-scheme: dark)"); }
@@ -62,8 +59,7 @@
62
59
 
63
60
  /* get the current mode on screen */
64
61
  get modeStatus() {
65
- if (this.isDarkMode
66
- || (!this.hasMode && this.isSysDarkPrefer)) {
62
+ if (this.isDarkMode || (!this.hasMode && this.isSysDarkPrefer)) {
67
63
  return ModeToggle.DARK_MODE;
68
64
  } else {
69
65
  return ModeToggle.LIGHT_MODE;
@@ -93,37 +89,32 @@
93
89
  }, "*");
94
90
  }
95
91
 
96
- } /* ModeToggle */
97
-
98
- const toggle = new ModeToggle();
99
-
100
- function flipMode() {
101
- if (toggle.hasMode) {
102
- if (toggle.isSysDarkPrefer) {
103
- if (toggle.isLightMode) {
104
- toggle.clearMode();
92
+ flipMode() {
93
+ if (this.hasMode) {
94
+ if (this.isSysDarkPrefer) {
95
+ if (this.isLightMode) {
96
+ this.clearMode();
97
+ } else {
98
+ this.setLight();
99
+ }
105
100
  } else {
106
- toggle.setLight();
101
+ if (this.isDarkMode) {
102
+ this.clearMode();
103
+ } else {
104
+ this.setDark();
105
+ }
107
106
  }
108
-
109
107
  } else {
110
- if (toggle.isDarkMode) {
111
- toggle.clearMode();
108
+ if (this.isSysDarkPrefer) {
109
+ this.setLight();
112
110
  } else {
113
- toggle.setDark();
111
+ this.setDark();
114
112
  }
115
113
  }
116
114
 
117
- } else {
118
- if (toggle.isSysDarkPrefer) {
119
- toggle.setLight();
120
- } else {
121
- toggle.setDark();
122
- }
123
- }
124
-
125
- toggle.notify();
126
-
127
- } /* flipMode() */
115
+ this.notify();
116
+ } /* flipMode() */
117
+ } /* ModeToggle */
128
118
 
119
+ const modeToggle = new ModeToggle();
129
120
  </script>
@@ -64,34 +64,37 @@
64
64
  {% endunless %}
65
65
 
66
66
  {% for entry in site.data.contact %}
67
- {% capture url %}
68
- {%- if entry.type == 'github' -%}
69
- https://github.com/{{ site.github.username }}
70
- {%- elsif entry.type == 'twitter' -%}
71
- https://twitter.com/{{ site.twitter.username }}
72
- {%- elsif entry.type == 'email' -%}
67
+ {% case entry.type %}
68
+ {% when 'github', 'twitter' %}
69
+ {%- capture url -%}
70
+ https://{{ entry.type }}.com/{{ site[entry.type].username }}
71
+ {%- endcapture -%}
72
+ {% when 'email' %}
73
73
  {% assign email = site.social.email | split: '@' %}
74
- javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
75
- {%- elsif entry.type == 'rss' -%}
76
- {{ "/feed.xml" | relative_url }}
77
- {%- else -%}
78
- {{ entry.url }}
79
- {%- endif -%}
80
- {% endcapture %}
74
+ {%- capture url -%}
75
+ javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
76
+ {%- endcapture -%}
77
+ {% when 'rss' %}
78
+ {% assign url = '/feed.xml' | relative_url %}
79
+ {% else %}
80
+ {% assign url = entry.url %}
81
+ {% endcase %}
81
82
 
82
83
  {% if url %}
83
84
  <a href="{{ url }}" aria-label="{{ entry.type }}"
84
- {% assign link_types = nil %}
85
+ {% assign link_types = '' %}
86
+
85
87
  {% unless entry.noblank %}
86
- {% assign link_types = link_types | append: " noopener" %}
87
88
  target="_blank"
89
+ {% assign link_types = 'noopener noreferrer' %}
88
90
  {% endunless %}
89
91
 
90
92
  {% if entry.type == 'mastodon' %}
91
- {% assign link_types = link_types | append: " me" %}
93
+ {% assign link_types = link_types | append: ' me' | strip %}
92
94
  {% endif %}
93
95
 
94
- {% if link_types %}rel="{{ link_types | lstrip }}"{% endif %}>
96
+ {% unless link_types == empty %}rel="{{ link_types }}"{% endunless %}>
97
+
95
98
  <i class="{{ entry.icon }}"></i>
96
99
  </a>
97
100
  {% endif %}
data/_includes/toc.html CHANGED
@@ -6,11 +6,11 @@
6
6
  {% endif %}
7
7
 
8
8
  {% if enable_toc %}
9
- <!-- BS-toc.js will be loaded at medium priority -->
10
- <script src="{{ site.data.assets[origin].bootstrap-toc.js | relative_url }}"></script>
9
+ <div id="toc-wrapper" class="pl-0 pr-4 mb-5">
10
+ <div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[site.lang].panel.toc -}}</div>
11
+ <nav id="toc"></nav>
12
+ </div>
11
13
 
12
- <div id="toc-wrapper" class="pl-0 pr-4 mb-5">
13
- <div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[site.lang].panel.toc -}}</div>
14
- <nav id="toc" data-toggle="toc"></nav>
15
- </div>
14
+ <!-- toc.js will be loaded at medium priority -->
15
+ <script src="{{ site.data.assets[origin].toc.js | relative_url }}"></script>
16
16
  {% endif %}
@@ -18,7 +18,7 @@ layout: compress
18
18
 
19
19
  {% include head.html %}
20
20
 
21
- <body data-spy="scroll" data-target="#toc" data-topbar-visible="true">
21
+ <body data-topbar-visible="true">
22
22
 
23
23
  {% include sidebar.html %}
24
24
 
data/_layouts/home.html CHANGED
@@ -3,10 +3,10 @@ layout: page
3
3
  # The Home page layout
4
4
  ---
5
5
 
6
- {% assign pinned = site.posts | where: "pin", "true" %}
7
- {% assign default = site.posts | where_exp: "item", "item.pin != true and item.hidden != true" %}
6
+ {% assign pinned = site.posts | where: 'pin', 'true' %}
7
+ {% assign default = site.posts | where_exp: 'item', 'item.pin != true and item.hidden != true' %}
8
8
 
9
- {% assign posts = "" | split: "" %}
9
+ {% assign posts = '' | split: '' %}
10
10
 
11
11
  <!-- Get pinned posts -->
12
12
 
@@ -29,7 +29,7 @@ layout: page
29
29
  {% assign default_beg = 0 %}
30
30
  {% endif %}
31
31
 
32
- {% assign default_num = paginator.posts | size | minus: pinned_num %}
32
+ {% assign default_num = paginator.posts | size | minus: pinned_num %}
33
33
  {% assign default_end = default_beg | plus: default_num | minus: 1 %}
34
34
 
35
35
  {% if default_num > 0 %}
@@ -39,55 +39,54 @@ layout: page
39
39
  {% endif %}
40
40
 
41
41
  <div id="post-list">
42
-
43
- {% for post in posts %}
44
-
45
- <div class="post-preview">
46
- <h1>
47
- <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
48
- </h1>
49
-
50
- <div class="post-content">
51
- <p>
52
- {% include no-linenos.html content=post.content %}
53
- {{ content | markdownify | strip_html | truncate: 200 | escape }}
54
- </p>
42
+ {% for post in posts %}
43
+ <div class="card post-preview">
44
+ <a href="{{ post.url | relative_url }}">
45
+ <div class="card-body">
46
+ <h1 class="card-title">
47
+ {{ post.title }}
48
+ </h1>
49
+
50
+ <div class="card-text post-content">
51
+ <p>
52
+ {% include no-linenos.html content=post.content %}
53
+ {{ content | markdownify | strip_html | truncate: 200 | escape }}
54
+ </p>
55
+ </div>
56
+
57
+ <div class="post-meta text-muted d-flex">
58
+ <div class="mr-auto">
59
+ <!-- posted date -->
60
+ <i class="far fa-calendar fa-fw"></i>
61
+ {% include datetime.html date=post.date %}
62
+
63
+ <!-- categories -->
64
+ {% if post.categories.size > 0 %}
65
+ <i class="far fa-folder-open fa-fw"></i>
66
+ <span>
67
+ {% for category in post.categories %}
68
+ {{ category }}
69
+ {%- unless forloop.last -%},{%- endunless -%}
70
+ {% endfor %}
71
+ </span>
72
+ {% endif %}
73
+ </div>
74
+
75
+ {% if post.pin %}
76
+ <div class="pin">
77
+ <i class="fas fa-thumbtack fa-fw"></i>
78
+ <span>{{ site.data.locales[site.lang].post.pin_prompt }}</span>
79
+ </div>
80
+ {% endif %}
81
+ </div>
82
+ <!-- .post-meta -->
83
+ </div>
84
+ </a>
55
85
  </div>
56
-
57
- <div class="post-meta text-muted d-flex">
58
- <div class="mr-auto">
59
-
60
- <!-- posted date -->
61
- <i class="far fa-calendar fa-fw"></i>
62
- {% include datetime.html date=post.date %}
63
-
64
- <!-- categories -->
65
- {% if post.categories.size > 0 %}
66
- <i class="far fa-folder-open fa-fw"></i>
67
- <span>
68
- {% for category in post.categories %}
69
- {{ category }}
70
- {%- unless forloop.last -%},{%- endunless -%}
71
- {% endfor %}
72
- </span>
73
- {% endif %}
74
-
75
- </div>
76
-
77
- {% if post.pin %}
78
- <div class="pin">
79
- <i class="fas fa-thumbtack fa-fw"></i>
80
- <span>{{ site.data.locales[site.lang].post.pin_prompt }}</span>
81
- </div>
82
- {% endif %}
83
-
84
- </div> <!-- .post-meta -->
85
-
86
- </div> <!-- .post-review -->
87
-
88
- {% endfor %}
89
-
90
- </div> <!-- #post-list -->
86
+ <!-- .post-review -->
87
+ {% endfor %}
88
+ </div>
89
+ <!-- #post-list -->
91
90
 
92
91
  {% if paginator.total_pages > 0 %}
93
92
  {% include post-paginator.html %}