hexo-theme-fluid 1.9.6 → 1.9.7

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.
package/README.md CHANGED
@@ -135,7 +135,7 @@ layout: about
135
135
 
136
136
  英文文档翻译:[@EatRice](https://eatrice.top/) [@橙子杀手](https://ruru.eatrice.top) [@Sinetian](https://sinetian.github.io/)
137
137
 
138
- 其他贡献:[@zhugaoqi](https://github.com/zhugaoqi) [@julydate](https://github.com/julydate)
138
+ 其他贡献:[@zhugaoqi](https://github.com/zhugaoqi) [@julydate](https://github.com/julydate) [@xiyuvi](https://xiyu.pro/)
139
139
 
140
140
  如你也想贡献代码,可参照[贡献指南](https://hexo.fluid-dev.com/docs/contribute/)
141
141
 
package/_config.yml CHANGED
@@ -1098,3 +1098,5 @@ static_prefix:
1098
1098
  discuss: https://lib.baomitu.com/discuss/1.2.1/
1099
1099
 
1100
1100
  hint: https://lib.baomitu.com/hint.css/2.7.0/
1101
+
1102
+ moment: https://lib.baomitu.com/moment.js/2.29.4/
@@ -42,7 +42,7 @@ post:
42
42
  toc: '目录'
43
43
  prev_post: '上一篇'
44
44
  next_post: '下一篇'
45
- updated: '本文最后更新于:%s'
45
+ updated: '本文最后更新于 %s'
46
46
  meta:
47
47
  wordcount: '%s 字'
48
48
  min2read: '%s 分钟'
@@ -0,0 +1,30 @@
1
+ <%
2
+ var lang = (config.language || 'zh-cn').toLowerCase();
3
+
4
+ import_script(`
5
+ <script>
6
+ var relativeDate = function() {
7
+ var updatedTime = document.getElementById('updated-time');
8
+ if (updatedTime) {
9
+ var text = updatedTime.textContent;
10
+ var reg = /\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:Z|[+-]\\d{2}:\\d{2})/;
11
+ var matchs = text.match(reg);
12
+ if (matchs) {
13
+ var relativeTime = moment(matchs[0]).fromNow();
14
+ updatedTime.textContent = text.replace(reg, relativeTime);
15
+ }
16
+ updatedTime.style.display = '';
17
+ }
18
+ };
19
+ Fluid.utils.createScript('${url_join(theme.static_prefix.moment, 'moment.min.js')}', function() {
20
+ if (!'${lang}'.startsWith('en')) {
21
+ Fluid.utils.createScript('${url_join(theme.static_prefix.moment, 'locale/' + lang + '.min.js')}', function() {
22
+ relativeDate();
23
+ });
24
+ } else {
25
+ relativeDate();
26
+ }
27
+ });
28
+ </script>
29
+ `)
30
+ %>
package/layout/post.ejs CHANGED
@@ -16,14 +16,15 @@ page.banner_mask_alpha = page.banner_mask_alpha || theme.post.banner_mask_alpha
16
16
  <article class="post-content mx-auto">
17
17
  <h1 id="seo-header"><%= page.subtitle || page.title %></h1>
18
18
  <% if (theme.post.updated.enable && theme.post.updated && compare_date(page.date, page.updated)) { %>
19
- <p class="note note-<%= theme.post.updated.note_class || 'info' %>">
19
+ <p id="updated-time" class="note note-<%= theme.post.updated.note_class || 'info' %>" style="<%= theme.post.updated.relative ? 'display: none' : '' %>">
20
20
  <% if (theme.post.updated.relative) { %>
21
21
  <% if (theme.post.updated.content) { %>
22
22
  <!-- compatible with older versions-->
23
- <%- theme.post.updated.content %><%- relative_date(page.updated, theme.post.updated.date_format) %>
23
+ <%- theme.post.updated.content %><%- date(page.updated, 'YYYY-MM-DDTHH:mm:ssZ') %>
24
24
  <% } else { %>
25
- <%- __('post.updated', relative_date(page.updated, theme.post.updated.date_format)) %>
25
+ <%- __('post.updated', date(page.updated, 'YYYY-MM-DDTHH:mm:ssZ')) %>
26
26
  <% } %>
27
+ <%- partial('_partials/plugins/moment.ejs') %>
27
28
  <% } else { %>
28
29
  <% if (theme.post.updated.content) { %>
29
30
  <!-- compatible with older versions-->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-fluid",
3
- "version": "1.9.6",
3
+ "version": "1.9.7",
4
4
  "description": "An elegant Material-Design theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "files": [
@@ -16,7 +16,7 @@ module.exports = (hexo) => {
16
16
  | _| |_ | | | \\_/ |, | || \\__/ | |
17
17
  | |_____| [___]'.__.'_/[___]'.__.;__] |
18
18
  | |
19
- | 感谢使用 Fluid 主题 ! |
19
+ | 感谢使用 Fluid 主题 |
20
20
  | 文档: https://hexo.fluid-dev.com/docs/ |
21
21
  | |
22
22
  ------------------------------------------------
@@ -32,7 +32,7 @@ module.exports = (hexo) => {
32
32
  | _| |_ | | | \\_/ |, | || \\__/ | |
33
33
  | |_____| [___]'.__.'_/[___]'.__.;__] |
34
34
  | |
35
- | Thank you for using Fluid theme ! |
35
+ | Thank you for using Fluid theme |
36
36
  | Docs: https://hexo.fluid-dev.com/docs/en/ |
37
37
  | |
38
38
  ------------------------------------------------
@@ -49,5 +49,7 @@ hexo.extend.generator.register('post', function(locals) {
49
49
  hexo.extend.filter.register('after_post_render', (page) => {
50
50
  // 移除 hexo-renderer-pandoc 生成的 <colgroup>
51
51
  page.content = page.content.replace(/<colgroup>.+?<\/colgroup>/gims, '');
52
+ // 移除 hexo-renderer-pandoc 生成的 <span class="footnote-text">...<br>...</span>
53
+ page.content = page.content.replace(/(class="footnote-text".+?)<br.+?>(.+?rev="footnote")/gims, '$1$2');
52
54
  return page;
53
55
  });
@@ -5,16 +5,13 @@
5
5
  const { stripHTML } = require('hexo-util');
6
6
 
7
7
  const getWordCount = (post) => {
8
- const lang = post.lang.toLowerCase();
9
8
  // post.origin is the original post content of hexo-blog-encrypt
10
9
  const content = stripHTML(post.origin || post.content).replace(/\r?\n|\r/g, '').replace(/\s+/g, '');
11
10
 
12
11
  if (!post.wordcount) {
13
- if (['zh-cn', 'zh-hk', 'zh-tw'].includes(lang)) {
14
- post.wordcount = (content.match(/[\u4E00-\u9FA5]/g) || []).length;
15
- } else {
16
- post.wordcount = (content.replace(/[\u4E00-\u9FA5]/g, '').match(/[a-zA-Z0-9_\u0392-\u03c9\u0400-\u04FF]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|[\u00E4\u00C4\u00E5\u00C5\u00F6\u00D6]+|\w+/g) || []).length;
17
- }
12
+ const zhCount = (content.match(/[\u4E00-\u9FA5]/g) || []).length;
13
+ const enCount = (content.replace(/[\u4E00-\u9FA5]/g, '').match(/[a-zA-Z0-9_\u0392-\u03c9\u0400-\u04FF]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|[\u00E4\u00C4\u00E5\u00C5\u00F6\u00D6]+|\w+/g) || []).length;
14
+ post.wordcount = zhCount + enCount
18
15
  }
19
16
  return post.wordcount;
20
17
  };
@@ -16,14 +16,14 @@ const checkbox = (args) => {
16
16
 
17
17
  const checked = (args[1] || '').length > 0 && args[1].trim() !== 'false';
18
18
  const inline = (args[2] || '').length > 0 && args[2].trim() !== 'false';
19
- const enabled = (args[3] || '').length > 0 && args[3].trim() === 'false';
19
+ const disabled = (args[3] || '').length > 0 && args[3].trim() !== 'false';
20
20
 
21
21
  return `${!inline ? '<div>' : ''}
22
- <input type="checkbox" ${enabled ? '' : 'disabled'} ${checked ? 'checked="checked"' : ''}>${text}
22
+ <input type="checkbox" ${disabled ? 'disabled' : ''} ${checked ? 'checked="checked"' : ''}>${text}
23
23
  ${!inline ? '</div>' : ''}`;
24
24
 
25
25
  };
26
26
 
27
- // {% cb text, checked?, inline? %}
27
+ // {% cb text, checked?, inline?, disabled? %}
28
28
  hexo.extend.tag.register('checkbox', checkbox, { ends: false });
29
29
  hexo.extend.tag.register('cb', checkbox, { ends: false });
@@ -11,8 +11,10 @@ hexo.extend.tag.register('fold', (args, content) => {
11
11
  <div class="fold-title fold-${classes.trim()} collapsed" data-toggle="collapse" href="#${id}" role="button" aria-expanded="false" aria-controls="${id}">
12
12
  <div class="fold-arrow">▶</div>${text}
13
13
  </div>
14
- <div class='fold-content collapse' id="${id}">
15
- ${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
14
+ <div class="fold-collapse collapse" id="${id}">
15
+ <div class="fold-content">
16
+ ${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
17
+ </div>
16
18
  </div>
17
19
  </div>`;
18
20
  }, {
@@ -42,8 +42,8 @@ dark-colors()
42
42
  --button-hover-bg-color $button-hover-bg-color-dark
43
43
  --highlight-bg-color $highlight-bg-color-dark
44
44
  --inlinecode-bg-color $inlinecode-bg-color-dark
45
- --fold-title-color $text-color
46
- --fold-border-color $line-color
45
+ --fold-title-color $text-color-dark
46
+ --fold-border-color $line-color-dark
47
47
 
48
48
  img
49
49
  -webkit-filter brightness(.9)
@@ -20,7 +20,7 @@
20
20
  strong
21
21
  font-weight bold
22
22
 
23
- & > *:first-child
23
+ & > *:nth-child(2)
24
24
  margin-top 0
25
25
 
26
26
  img
@@ -23,30 +23,31 @@
23
23
  transition transform .3s ease-out
24
24
 
25
25
  .fold-content
26
- & > *
27
- margin 0
26
+ padding 1rem 1rem
28
27
 
29
- & > p
30
- padding 1rem 1rem
28
+ & > *:last-child
29
+ margin-bottom 0
31
30
 
32
- .fold-default
33
- background rgba(#bbbbbb, 0.25)
31
+ .fold-default, .fold-secondary
32
+ background-color rgba(#bbbbbb, 0.25)
34
33
 
35
34
  .fold-primary
36
- background rgba(#b7a0e0, 0.25)
35
+ background-color rgba(#b7a0e0, 0.25)
37
36
 
38
37
  .fold-info
39
- background rgba(#a0c5e4, 0.25)
38
+ background-color rgba(#a0c5e4, 0.25)
40
39
 
41
40
  .fold-success
42
- background rgba(#aedcae, 0.25)
41
+ background-color rgba(#aedcae, 0.25)
43
42
 
44
43
  .fold-warning
45
- background rgba(#f8d6a6, 0.25)
44
+ background-color rgba(#f8d6a6, 0.25)
46
45
 
47
46
  .fold-danger
48
- background rgba(#eca9a7, 0.25)
47
+ background-color rgba(#eca9a7, 0.25)
49
48
 
49
+ .fold-light
50
+ background-color rgba(#fefefe, 0.25)
50
51
 
51
52
  // note
52
53
  .note
@@ -65,14 +66,14 @@
65
66
  *:last-child
66
67
  margin-bottom 0
67
68
 
69
+ .note-default, .note-secondary
70
+ background-color rgba(#bbbbbb, 0.25)
71
+ border-color #777
72
+
68
73
  .note-primary
69
74
  background-color rgba(#b7a0e0, 0.25)
70
75
  border-color #6f42c1
71
76
 
72
- .note-secondary, note-default
73
- background-color rgba(#bbbbbb, 0.25)
74
- border-color #777
75
-
76
77
  .note-success
77
78
  background-color rgba(#aedcae, 0.25)
78
79
  border-color #5cb85c
@@ -103,23 +104,23 @@
103
104
  color var(--text-color)
104
105
  transition color .2s ease-in-out
105
106
 
106
- .label-default
107
- background rgba(#bbbbbb, 0.25)
107
+ .label-default, .label-secondary
108
+ background-color rgba(#bbbbbb, 0.25)
108
109
 
109
110
  .label-primary
110
- background rgba(#b7a0e0, 0.25)
111
+ background-color rgba(#b7a0e0, 0.25)
111
112
 
112
113
  .label-info
113
- background rgba(#a0c5e4, 0.25)
114
+ background-color rgba(#a0c5e4, 0.25)
114
115
 
115
116
  .label-success
116
- background rgba(#aedcae, 0.25)
117
+ background-color rgba(#aedcae, 0.25)
117
118
 
118
119
  .label-warning
119
- background rgba(#f8d6a6, 0.25)
120
+ background-color rgba(#f8d6a6, 0.25)
120
121
 
121
122
  .label-danger
122
- background rgba(#eca9a7, 0.25)
123
+ background-color rgba(#eca9a7, 0.25)
123
124
 
124
125
  // button
125
126
  .markdown-body .btn
@@ -166,19 +166,19 @@ Fluid.events = {
166
166
  }
167
167
  // eslint-disable-next-line no-console
168
168
  console.log(`
169
- ------------------------------------------------
170
- | |
171
- | ________ __ _ __ |
172
- | |_ __ |[ | (_) | ] |
173
- | | |_ \\_| | | __ _ __ .--.| | |
174
- | | _| | |[ | | | [ |/ /'\`\\' | |
175
- | _| |_ | | | \\_/ |, | || \\__/ | |
176
- | |_____| [___]'.__.'_/[___]'.__.;__] |
177
- | |
178
- | Powered by Hexo x Fluid |
179
- | GitHub: https://git.io/JqpVD |
180
- | |
181
- ------------------------------------------------
169
+ -------------------------------------------------
170
+ | |
171
+ | ________ __ _ __ |
172
+ | |_ __ |[ | (_) | ] |
173
+ | | |_ \\_| | | __ _ __ .--.| | |
174
+ | | _| | |[ | | | [ |/ /'\`\\' | |
175
+ | _| |_ | | | \\_/ |, | || \\__/ | |
176
+ | |_____| [___]'.__.'_/[___]'.__.;__] |
177
+ | |
178
+ | Powered by Hexo x Fluid |
179
+ | https://github.com/fluid-dev/hexo-theme-fluid |
180
+ | |
181
+ -------------------------------------------------
182
182
  `);
183
183
  }
184
184
  };