hexo-theme-shokax
Advanced tools
Comparing version 0.0.1-alpha5 to 0.0.1-alpha6
{ | ||
"name": "hexo-theme-shokax", | ||
"version": "0.0.1-alpha5", | ||
"version": "0.0.1-alpha6", | ||
"description": "a hexo theme based on shoka", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,4 +20,3 @@ # hexo-theme-shokaX | ||
- [x] 部分功能调整为可关闭 | ||
- [ ] 重构lib方法(长期计划) | ||
- [ ] 异步化js | ||
- [ ] 插件系统 | ||
@@ -39,3 +38,4 @@ ## 和shoka的区别 | ||
# 许可证 | ||
许可证: MIT \ | ||
许可证: BSD-3-Clause \ | ||
请注意: `0.0.1-alpha6`版本开始,shokaX使用BSD协议,这意味着删除页脚处的shokaX标识是违反许可证的 | ||
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fzkz098%2Fhexo-theme-shokaX.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fzkz098%2Fhexo-theme-shokaX?ref=badge_large) | ||
@@ -42,0 +42,0 @@ |
/* global hexo */ | ||
'use strict' | ||
/** @type {Map<string, string[]>} */ | ||
const insertions = new Map() | ||
class TemplateBlock { | ||
constructor (text, type = 'raw') { | ||
this.text = text | ||
this.type = type | ||
this.result = '' | ||
} | ||
render () { | ||
if (this.type === 'raw' || this.type === 'html') { | ||
this.result = this.text | ||
} | ||
this.result = hexo.render.renderSync({ text: this.text, engine: this.type }) | ||
} | ||
repalceTag (...tag) { | ||
tag.forEach((item) => { | ||
this.text = this.text.replace(item.tag, item.value) | ||
}) | ||
} | ||
insert (location) { | ||
if (insertions.get(location)) { | ||
insertions.get(location).push(this.result) | ||
} else { | ||
insertions.set(location, []) | ||
} | ||
} | ||
} | ||
const toolpack = { | ||
TemplateBlock | ||
} | ||
hexo.extend.helper.register('insert_footer', () => { | ||
if (hexo.theme.config?.plugin?.enable && insertions.get('footer')) { | ||
let res = '' | ||
insertions.get('footer').forEach((item) => { | ||
res += item | ||
}) | ||
return res | ||
} | ||
}) | ||
if (hexo.theme.config?.plugin?.enable) { | ||
hexo.theme.config.plugin.load.forEach((item) => { | ||
const p = require(item) | ||
console.log(p) | ||
if (p.prepare) { | ||
p.prepare(hexo, this) | ||
} | ||
p.main(hexo, this, toolpack) | ||
}) | ||
} | ||
// hexo.on('generateBefore', () => { | ||
// // 加载`theme_injects`过滤器 | ||
// require('./lib/injects')(hexo); | ||
// }); |
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
518277
165
5185
1