hexo-theme-shokax 0.2.0 → 0.2.2
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 +1 -2
- package/_config.yml +2 -1
- package/_images.yml +1 -92
- package/layout/_mixin/sidebar.pug +9 -5
- package/layout/_partials/footer.pug +1 -1
- package/package.json +17 -13
- package/scripts/filters/locals.js +48 -59
- package/scripts/filters/post.js +13 -19
- package/scripts/generaters/archive.js +111 -135
- package/scripts/generaters/config.js +31 -38
- package/scripts/generaters/images.js +19 -24
- package/scripts/generaters/index.js +96 -105
- package/scripts/generaters/pages.js +15 -18
- package/scripts/generaters/script.js +86 -90
- package/scripts/helpers/asset.js +123 -134
- package/scripts/helpers/engine.js +127 -185
- package/scripts/helpers/list_categories.js +102 -133
- package/scripts/helpers/symbols_count_time.js +53 -67
- package/scripts/plugin/index.js +42 -46
- package/scripts/plugin/lib/injects-point.js +19 -20
- package/scripts/plugin/lib/injects.js +58 -81
- package/scripts/tags/links.js +48 -75
- package/scripts/tags/media.js +13 -18
- package/source/css/_common/components/highlight/highlight.styl +4 -0
- package/source/css/_common/outline/header/image.styl +4 -0
- package/source/css/_common/outline/header/waves.styl +4 -0
- package/source/css/_common/scaffolding/animate.styl +4 -0
- package/source/css/_mixins.styl +5 -3
- package/source/js/_app/fireworks.js +13 -0
- package/source/js/_app/global.js +6 -3
- package/source/js/_app/library.js +13 -13
- package/source/js/_app/page.js +66 -0
@@ -1,140 +1,109 @@
|
|
1
|
-
'use strict'
|
2
|
-
|
3
|
-
|
4
|
-
const fs = require('hexo-fs')
|
5
|
-
|
1
|
+
'use strict';
|
2
|
+
import fs from 'hexo-fs';
|
6
3
|
const prepareQuery = (categories, parent) => {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
4
|
+
const query = {
|
5
|
+
parent: undefined
|
6
|
+
};
|
7
|
+
if (parent) {
|
8
|
+
query.parent = parent;
|
9
|
+
}
|
10
|
+
else {
|
11
|
+
query.parent = { $exists: false };
|
12
|
+
}
|
13
|
+
return categories.find(query).sort('name', 1).filter(cat => cat.length);
|
14
|
+
};
|
18
15
|
hexo.extend.helper.register('_list_categories', function (depth = 0) {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}
|
53
|
-
|
54
|
-
if (level === 0) {
|
55
|
-
result += '</div>'
|
56
|
-
}
|
57
|
-
})
|
58
|
-
|
59
|
-
return result
|
60
|
-
}
|
61
|
-
|
62
|
-
return hierarchicalList(0)
|
63
|
-
})
|
64
|
-
|
16
|
+
const categories = this.site.categories;
|
17
|
+
if (!categories || !categories.length)
|
18
|
+
return '';
|
19
|
+
const hierarchicalList = (level, parent) => {
|
20
|
+
let result = '';
|
21
|
+
prepareQuery(categories, parent).forEach((cat, i) => {
|
22
|
+
let child;
|
23
|
+
if (level + 1 < depth) {
|
24
|
+
child = hierarchicalList(level + 1, cat._id);
|
25
|
+
}
|
26
|
+
const catname = `<a itemprop="url" href="${this.url_for(cat.path)}">${cat.name}</a><small>( ${cat.length} )</small>`;
|
27
|
+
switch (level) {
|
28
|
+
case 0:
|
29
|
+
result += `<div><h2 class="item header">${catname}</h2>`;
|
30
|
+
break;
|
31
|
+
case 1:
|
32
|
+
result += `<h3 class="item section">${catname}</h3>`;
|
33
|
+
break;
|
34
|
+
case 2:
|
35
|
+
result += `<div class="item normal"><div class="title">${catname}</div></div>`;
|
36
|
+
break;
|
37
|
+
}
|
38
|
+
if (child) {
|
39
|
+
result += `${child}`;
|
40
|
+
}
|
41
|
+
if (level === 0) {
|
42
|
+
result += '</div>';
|
43
|
+
}
|
44
|
+
});
|
45
|
+
return result;
|
46
|
+
};
|
47
|
+
return hierarchicalList(0);
|
48
|
+
});
|
65
49
|
hexo.extend.helper.register('_categories', function () {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
50
|
+
const categories = this.site.categories;
|
51
|
+
if (!categories || !categories.length)
|
52
|
+
return '';
|
53
|
+
const pangu = this.theme.pangu
|
54
|
+
? require('pangu')
|
55
|
+
: {
|
56
|
+
spacing: data => {
|
57
|
+
return data;
|
58
|
+
}
|
59
|
+
};
|
60
|
+
const result = {};
|
61
|
+
categories.forEach((cat, i) => {
|
62
|
+
const child = prepareQuery(categories, cat._id);
|
63
|
+
const cover = 'source/_posts' + cat.path.replace(this.config.category_dir, '') + 'cover.jpg';
|
64
|
+
if (fs.existsSync(cover)) {
|
65
|
+
const className = cat.slug.split('/');
|
66
|
+
className.pop();
|
67
|
+
cat.class = className.join(' ');
|
68
|
+
cat.name = pangu.spacing(cat.name);
|
69
|
+
if (child.length !== 0) {
|
70
|
+
cat.child = child;
|
71
|
+
}
|
72
|
+
result[cat._id] = cat;
|
75
73
|
}
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
categories.forEach((cat, i) => {
|
81
|
-
const child = prepareQuery(categories, cat._id)
|
82
|
-
const cover = 'source/_posts' + cat.path.replace(this.config.category_dir, '') + 'cover.jpg'
|
83
|
-
|
84
|
-
if (fs.existsSync(cover)) {
|
85
|
-
const className = cat.slug.split('/')
|
86
|
-
className.pop()
|
87
|
-
cat.class = className.join(' ')
|
88
|
-
cat.name = pangu.spacing(cat.name)
|
89
|
-
|
90
|
-
if (child.length !== 0) {
|
91
|
-
cat.child = child
|
92
|
-
}
|
93
|
-
|
94
|
-
result[cat._id] = cat
|
95
|
-
}
|
96
|
-
})
|
97
|
-
|
98
|
-
return result
|
99
|
-
})
|
100
|
-
|
74
|
+
});
|
75
|
+
return result;
|
76
|
+
});
|
101
77
|
hexo.extend.helper.register('_category_prev', function (name) {
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
return result
|
117
|
-
})
|
118
|
-
|
78
|
+
const categories = this.site.categories;
|
79
|
+
if (!categories || !categories.length)
|
80
|
+
return '';
|
81
|
+
let result = '';
|
82
|
+
categories.find({ name }).forEach((current) => {
|
83
|
+
if (current.parent) {
|
84
|
+
categories.find({ _id: current.parent }).forEach((cat, i) => {
|
85
|
+
result += `<a href="${this.url_for(cat.path)}">${cat.name}</a>`;
|
86
|
+
});
|
87
|
+
}
|
88
|
+
});
|
89
|
+
return result;
|
90
|
+
});
|
119
91
|
hexo.extend.helper.register('_category_posts', function (page) {
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
92
|
+
const categories = this.site.categories;
|
93
|
+
if (!categories || !categories.length || !page.categories || !page.categories.length)
|
94
|
+
return '';
|
95
|
+
let result = '';
|
96
|
+
const cat = page.categories.toArray();
|
97
|
+
categories.find({ _id: cat[cat.length - 1]._id }).forEach((category) => {
|
98
|
+
if (category.posts) {
|
99
|
+
category.posts.sort('date', 1).forEach((post) => {
|
100
|
+
let current = '';
|
101
|
+
if (post.path === page.path) {
|
102
|
+
current = ' class="active"';
|
103
|
+
}
|
104
|
+
result += `<li ${current}><a href="${this.url_for(post.path)}" rel="bookmark" title="${post.title}">${post.title}</a></li>`;
|
105
|
+
});
|
133
106
|
}
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
})
|
138
|
-
|
139
|
-
return result
|
140
|
-
})
|
107
|
+
});
|
108
|
+
return result;
|
109
|
+
});
|
@@ -1,76 +1,62 @@
|
|
1
|
-
'use strict'
|
2
|
-
|
3
|
-
/*!
|
4
|
-
hexo-symbols-count-time by theme-next
|
5
|
-
under GNU Lesser General Public License v3.0
|
6
|
-
https://github.com/theme-next/hexo-symbols-count-time/blob/master/LICENSE
|
7
|
-
*/
|
8
|
-
|
9
|
-
const { stripHTML } = require('hexo-util')
|
10
|
-
|
1
|
+
'use strict';
|
2
|
+
import { stripHTML } from 'hexo-util';
|
11
3
|
const config = hexo.config.symbols_count_time = Object.assign({
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}, hexo.config.symbols_count_time)
|
21
|
-
|
22
|
-
|
23
|
-
return post?._content?.length ?? post?.content?.length ?? post.length
|
4
|
+
symbols: true,
|
5
|
+
time: true,
|
6
|
+
total_symbols: true,
|
7
|
+
total_time: true,
|
8
|
+
exclude_codeblock: false,
|
9
|
+
awl: 4,
|
10
|
+
wpm: 275,
|
11
|
+
suffix: 'mins.'
|
12
|
+
}, hexo.config.symbols_count_time);
|
13
|
+
function getSymbols(post) {
|
14
|
+
return post?._content?.length ?? post?.content?.length ?? post.length;
|
24
15
|
}
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
return symbolsResultCount
|
16
|
+
function getSymbolsTotal(site) {
|
17
|
+
let symbolsResultCount = 0;
|
18
|
+
site.posts.forEach((post) => {
|
19
|
+
symbolsResultCount += getSymbols(post);
|
20
|
+
});
|
21
|
+
return symbolsResultCount;
|
32
22
|
}
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
: fHours + ':' + ('00' + fMinutes).slice(-2) // = 61 => 1:01
|
23
|
+
function getFormatTime(minutes, suffix) {
|
24
|
+
const fHours = Math.floor(minutes / 60);
|
25
|
+
let fMinutes = Math.floor(minutes - (fHours * 60));
|
26
|
+
if (fMinutes < 1) {
|
27
|
+
fMinutes = 1;
|
28
|
+
}
|
29
|
+
return fHours < 1
|
30
|
+
? fMinutes + ' ' + suffix
|
31
|
+
: fHours + ':' + ('00' + fMinutes).slice(-2);
|
43
32
|
}
|
44
|
-
|
45
33
|
hexo.extend.helper.register('symbolsCount', function (post) {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
34
|
+
let symbolsResult = getSymbols(post);
|
35
|
+
if (symbolsResult > 9999) {
|
36
|
+
symbolsResult = Math.round(symbolsResult / 1000) + 'k';
|
37
|
+
}
|
38
|
+
else if (symbolsResult > 999) {
|
39
|
+
symbolsResult = Math.round(symbolsResult / 100) / 10 + 'k';
|
40
|
+
}
|
41
|
+
return symbolsResult;
|
42
|
+
});
|
55
43
|
hexo.extend.helper.register('symbolsTime', function (post, awl = config.awl, wpm = config.wpm, suffix = config.suffix) {
|
56
|
-
|
57
|
-
|
58
|
-
})
|
59
|
-
|
44
|
+
const minutes = Math.round(getSymbols(post) / (awl * wpm));
|
45
|
+
return getFormatTime(minutes, suffix);
|
46
|
+
});
|
60
47
|
hexo.extend.helper.register('symbolsCountTotal', function (site) {
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
})
|
66
|
-
|
48
|
+
const symbolsResultTotal = getSymbolsTotal(site);
|
49
|
+
return symbolsResultTotal < 1000000
|
50
|
+
? Math.round(symbolsResultTotal / 1000) + 'k'
|
51
|
+
: Math.round(symbolsResultTotal / 100000) / 10 + 'm';
|
52
|
+
});
|
67
53
|
hexo.extend.helper.register('symbolsTimeTotal', function (site, awl = config.awl, wpm = config.wpm, suffix = config.suffix) {
|
68
|
-
|
69
|
-
|
70
|
-
})
|
71
|
-
|
54
|
+
const minutes = Math.round(getSymbolsTotal(site) / (awl * wpm));
|
55
|
+
return getFormatTime(minutes, suffix);
|
56
|
+
});
|
72
57
|
hexo.extend.filter.register('after_post_render', (data) => {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
58
|
+
let { content } = data;
|
59
|
+
if (config.exclude_codeblock)
|
60
|
+
content = content.replace(/<pre>.*?<\/pre>/g, '');
|
61
|
+
data.length = stripHTML(content).replace(/\r?\n|\r/g, '').replace(/\s+/g, '').length;
|
62
|
+
}, 0);
|
package/scripts/plugin/index.js
CHANGED
@@ -1,49 +1,45 @@
|
|
1
|
-
/* global hexo */
|
2
|
-
|
3
1
|
hexo.on('generateBefore', () => {
|
4
|
-
|
5
|
-
|
6
|
-
})
|
7
|
-
|
2
|
+
require('./lib/injects')(hexo);
|
3
|
+
});
|
8
4
|
hexo.on('generateAfter', () => {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
'User-Agent': 'Theme ShokaX Client'
|
16
|
-
}
|
17
|
-
}, (res) => {
|
18
|
-
let result = ''
|
19
|
-
res.on('data', (data) => {
|
20
|
-
result += data
|
21
|
-
})
|
22
|
-
res.on('end', () => {
|
23
|
-
try {
|
24
|
-
const latest = JSON.parse(result).tag_name.replace('v', '').split('.')
|
25
|
-
const current = version.split('.')
|
26
|
-
let isOutdated = false
|
27
|
-
for (let i = 0; i < Math.max(latest.length, current.length); i++) {
|
28
|
-
if (!current[i] || latest[i] > current[i]) {
|
29
|
-
isOutdated = true
|
30
|
-
break
|
31
|
-
}
|
32
|
-
if (latest[i] < current[i]) {
|
33
|
-
break
|
34
|
-
}
|
5
|
+
const https = require('https');
|
6
|
+
const path = require('path');
|
7
|
+
const { version } = require(path.normalize('../../package.json'));
|
8
|
+
https.get('https://api.github.com/repos/theme-shoka-x/hexo-theme-shokaX/releases/latest', {
|
9
|
+
headers: {
|
10
|
+
'User-Agent': 'Theme ShokaX Client'
|
35
11
|
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
12
|
+
}, (res) => {
|
13
|
+
let result = '';
|
14
|
+
res.on('data', (data) => {
|
15
|
+
result += data;
|
16
|
+
});
|
17
|
+
res.on('end', () => {
|
18
|
+
try {
|
19
|
+
const latest = JSON.parse(result).tag_name.replace('v', '').split('.');
|
20
|
+
const current = version.split('.');
|
21
|
+
let isOutdated = false;
|
22
|
+
for (let i = 0; i < Math.max(latest.length, current.length); i++) {
|
23
|
+
if (!current[i] || latest[i] > current[i]) {
|
24
|
+
isOutdated = true;
|
25
|
+
break;
|
26
|
+
}
|
27
|
+
if (latest[i] < current[i]) {
|
28
|
+
break;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
if (isOutdated) {
|
32
|
+
hexo.log.warn(`Your theme ShokaX is outdated. Current version: v${current.join('.')}, latest version: v${latest.join('.')}`);
|
33
|
+
hexo.log.warn('Visit https://github.com/theme-shoka-x/hexo-theme-shokaX/releases for more information.');
|
34
|
+
}
|
35
|
+
}
|
36
|
+
catch (err) {
|
37
|
+
hexo.log.error('Failed to detect version info. Error message:');
|
38
|
+
hexo.log.error(err);
|
39
|
+
}
|
40
|
+
});
|
41
|
+
}).on('error', err => {
|
42
|
+
hexo.log.error('Failed to detect version info. Error message:');
|
43
|
+
hexo.log.error(err);
|
44
|
+
});
|
45
|
+
});
|
@@ -1,20 +1,19 @@
|
|
1
|
-
'use strict'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
1
|
+
'use strict';
|
2
|
+
export default {
|
3
|
+
views: [
|
4
|
+
'head',
|
5
|
+
'sidebar',
|
6
|
+
'rightNav',
|
7
|
+
'postMeta',
|
8
|
+
'postBodyEnd',
|
9
|
+
'footer',
|
10
|
+
'bodyEnd',
|
11
|
+
'comment',
|
12
|
+
'status'
|
13
|
+
],
|
14
|
+
styles: [
|
15
|
+
'variable',
|
16
|
+
'mixin',
|
17
|
+
'style'
|
18
|
+
]
|
19
|
+
};
|
@@ -1,89 +1,66 @@
|
|
1
|
-
'use strict'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const
|
6
|
-
const points = require('./injects-point')
|
7
|
-
const defaultExtname = '.pug'
|
8
|
-
|
9
|
-
// Defining stylus types
|
1
|
+
'use strict';
|
2
|
+
import fs from 'node:fs';
|
3
|
+
import path from 'node:path';
|
4
|
+
import points from './injects-point';
|
5
|
+
const defaultExtname = '.pug';
|
10
6
|
class StylusInject {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
this.files.push(path.resolve(this.base_dir, file))
|
19
|
-
}
|
7
|
+
constructor(base_dir) {
|
8
|
+
this.base_dir = base_dir;
|
9
|
+
this.files = [];
|
10
|
+
}
|
11
|
+
push(file) {
|
12
|
+
this.files.push(path.resolve(this.base_dir, file));
|
13
|
+
}
|
20
14
|
}
|
21
|
-
|
22
|
-
// Defining view types
|
23
15
|
class ViewInject {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
}
|
28
|
-
|
29
|
-
raw (name, raw, ...args) {
|
30
|
-
// Set default extname
|
31
|
-
if (path.extname(name) === '') {
|
32
|
-
name += defaultExtname
|
16
|
+
constructor(base_dir) {
|
17
|
+
this.base_dir = base_dir;
|
18
|
+
this.raws = [];
|
33
19
|
}
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
20
|
+
raw(name, raw, ...args) {
|
21
|
+
if (path.extname(name) === '') {
|
22
|
+
name += defaultExtname;
|
23
|
+
}
|
24
|
+
this.raws.push({ name, raw, args });
|
25
|
+
}
|
26
|
+
file(name, file, ...args) {
|
27
|
+
if (path.extname(name) === '') {
|
28
|
+
name += path.extname(file);
|
29
|
+
}
|
30
|
+
this.raw(name, fs.readFileSync(path.resolve(this.base_dir, file), 'utf8'), ...args);
|
41
31
|
}
|
42
|
-
// Get absolute path base on hexo dir
|
43
|
-
this.raw(name, fs.readFileSync(path.resolve(this.base_dir, file), 'utf8'), ...args)
|
44
|
-
}
|
45
32
|
}
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
injects
|
55
|
-
})
|
56
|
-
return injects
|
33
|
+
function initInject(base_dir) {
|
34
|
+
const injects = {};
|
35
|
+
points.styles.forEach(item => {
|
36
|
+
injects[item] = new StylusInject(base_dir);
|
37
|
+
});
|
38
|
+
points.views.forEach(item => {
|
39
|
+
injects[item] = new ViewInject(base_dir);
|
40
|
+
});
|
41
|
+
return injects;
|
57
42
|
}
|
58
|
-
|
59
43
|
module.exports = (hexo) => {
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
}
|
84
|
-
})
|
85
|
-
// Views sort.
|
86
|
-
hexo.theme.config.injects[type] = Object.values(configs)
|
87
|
-
.sort((x, y) => x.order - y.order)
|
88
|
-
})
|
89
|
-
}
|
44
|
+
const injects = initInject(hexo.base_dir);
|
45
|
+
hexo.execFilterSync('theme_inject', injects);
|
46
|
+
hexo.theme.config.injects = {};
|
47
|
+
points.styles.forEach(type => {
|
48
|
+
hexo.theme.config.injects[type] = injects[type].files;
|
49
|
+
});
|
50
|
+
points.views.forEach(type => {
|
51
|
+
const configs = Object.create(null);
|
52
|
+
hexo.theme.config.injects[type] = [];
|
53
|
+
injects[type].raws.forEach((injectObj, index) => {
|
54
|
+
const name = `inject/${type}/${injectObj.name}`;
|
55
|
+
hexo.theme.setView(name, injectObj.raw);
|
56
|
+
configs[name] = {
|
57
|
+
layout: name,
|
58
|
+
locals: injectObj.args[0],
|
59
|
+
options: injectObj.args[1],
|
60
|
+
order: injectObj.args[2] || index
|
61
|
+
};
|
62
|
+
});
|
63
|
+
hexo.theme.config.injects[type] = Object.values(configs)
|
64
|
+
.sort((x, y) => x.order - y.order);
|
65
|
+
});
|
66
|
+
};
|