Skip to content

Commit

Permalink
适配nexmoe主题(#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
HCLonely committed Aug 10, 2022
1 parent 5bf5320 commit 778187b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
16 changes: 10 additions & 6 deletions lib/bangumi-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = /*#__PURE__*/function () {

var type,
config,
full_url_for,
root,
wantWatch,
watching,
Expand Down Expand Up @@ -63,6 +64,8 @@ module.exports = /*#__PURE__*/function () {
return _context.abrupt("return");

case 4:
// eslint-disable-next-line camelcase
full_url_for = this.extend.helper.get('full_url_for').bind(this);
root = config.root;

if (root.endsWith('/')) {
Expand Down Expand Up @@ -116,7 +119,7 @@ module.exports = /*#__PURE__*/function () {


__ = i18n.__(config.language);
_context.next = 13;
_context.next = 14;
return ejs.renderFile(path.join(__dirname, 'templates/bangumi.ejs'), {
quote: config[type].quote,
show: config[type].show || 1,
Expand All @@ -138,19 +141,20 @@ module.exports = /*#__PURE__*/function () {
async: false
});

case 13:
case 14:
contents = _context.sent;
customPath = config[type].path;
customPath = config[type].path || "".concat(type, "s/index.html");
return _context.abrupt("return", {
path: customPath || "".concat(type, "s/index.html"),
path: customPath,
data: _objectSpread({
title: config[type].title,
content: contents
content: contents,
permalink: full_url_for(customPath)
}, config === null || config === void 0 ? void 0 : (_config$type2 = config[type]) === null || _config$type2 === void 0 ? void 0 : _config$type2.extra_options),
layout: ['page', 'post']
});

case 16:
case 17:
case "end":
return _context.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-bilibili-bangumi",
"version": "1.8.0",
"version": "1.8.1",
"description": "hexo bilibili番剧页",
"main": "index.js",
"scripts": {
Expand Down
7 changes: 5 additions & 2 deletions src/lib/bangumi-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ module.exports = async function (locals, type = 'bangumi') {
if (!config?.[type]?.enable) {
return;
}
// eslint-disable-next-line camelcase
const full_url_for = this.extend.helper.get('full_url_for').bind(this);

let { root } = config;
if (root.endsWith('/')) {
Expand Down Expand Up @@ -80,12 +82,13 @@ module.exports = async function (locals, type = 'bangumi') {
root
}, { async: false });

const customPath = config[type].path;
const customPath = config[type].path || (`${type}s/index.html`);
return {
path: customPath || (`${type}s/index.html`),
path: customPath,
data: {
title: config[type].title,
content: contents,
permalink: full_url_for(customPath),
...config?.[type]?.extra_options
},
layout: ['page', 'post']
Expand Down

0 comments on commit 778187b

Please sign in to comment.