bajo-template 2.0.1 → 2.2.1
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/.github/FUNDING.yml +0 -0
- package/.github/workflows/repo-lockdown.yml +0 -0
- package/.jsdoc.conf.json +0 -0
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/docs/BajoTemplate.html +0 -0
- package/docs/data/search.json +0 -0
- package/docs/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/global.html +0 -0
- package/docs/index.html +0 -0
- package/docs/index.js.html +0 -0
- package/docs/scripts/core.js +476 -477
- package/docs/scripts/core.min.js +0 -0
- package/docs/scripts/resize.js +36 -36
- package/docs/scripts/search.js +105 -105
- package/docs/scripts/search.min.js +0 -0
- package/docs/scripts/third-party/Apache-License-2.0.txt +0 -0
- package/docs/scripts/third-party/fuse.js +1 -1
- package/docs/scripts/third-party/hljs-line-num-original.js +282 -285
- package/docs/scripts/third-party/hljs-line-num.js +1 -1
- package/docs/scripts/third-party/hljs-original.js +1195 -1202
- package/docs/scripts/third-party/hljs.js +1 -1
- package/docs/scripts/third-party/popper.js +1 -1
- package/docs/scripts/third-party/tippy.js +1 -1
- package/docs/scripts/third-party/tocbot.js +508 -509
- package/docs/scripts/third-party/tocbot.min.js +0 -0
- package/docs/static/bitcoin.jpeg +0 -0
- package/docs/static/home.md +0 -0
- package/docs/static/logo-ecosystem.png +0 -0
- package/docs/static/logo.png +0 -0
- package/docs/styles/clean-jsdoc-theme-base.css +0 -0
- package/docs/styles/clean-jsdoc-theme-dark.css +0 -0
- package/docs/styles/clean-jsdoc-theme-light.css +0 -0
- package/docs/styles/clean-jsdoc-theme-scrollbar.css +0 -0
- package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -0
- package/docs/styles/clean-jsdoc-theme.min.css +0 -0
- package/extend/bajo/intl/en-US.json +0 -0
- package/extend/bajo/intl/id.json +0 -0
- package/extend/bajoTemplate/layout/default.html +0 -0
- package/extend/bajoTemplate/layout/email.html +0 -0
- package/extend/bajoTemplate/layout/email.id.html +0 -0
- package/extend/bajoTemplate/partial/script-block.html +0 -0
- package/extend/bajoTemplate/partial/style-block.html +0 -0
- package/index.js +7 -10
- package/lib/resolve-resource.js +0 -0
- package/package.json +3 -2
- package/wiki/CHANGES.md +9 -0
- package/wiki/CONFIG.md +0 -0
- package/wiki/CONTRIBUTING.md +0 -0
|
File without changes
|
package/docs/static/bitcoin.jpeg
CHANGED
|
File without changes
|
package/docs/static/home.md
CHANGED
|
File without changes
|
|
File without changes
|
package/docs/static/logo.png
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/extend/bajo/intl/id.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/index.js
CHANGED
|
@@ -16,9 +16,7 @@ async function factory (pkgName) {
|
|
|
16
16
|
*
|
|
17
17
|
* @class
|
|
18
18
|
*/
|
|
19
|
-
class BajoTemplate extends this.app.
|
|
20
|
-
static alias = 'tpl'
|
|
21
|
-
|
|
19
|
+
class BajoTemplate extends this.app.baseClass.Base {
|
|
22
20
|
constructor () {
|
|
23
21
|
super(pkgName, me.app)
|
|
24
22
|
this.config = {
|
|
@@ -170,7 +168,7 @@ async function factory (pkgName) {
|
|
|
170
168
|
}
|
|
171
169
|
|
|
172
170
|
_renderString = async (content, locals = {}, opts = {}) => {
|
|
173
|
-
const { merge, without, isString, omit, kebabCase } = this.app.lib._
|
|
171
|
+
const { merge, without, isString, omit, kebabCase, get } = this.app.lib._
|
|
174
172
|
if (opts.ext === '.md' && this.app.bajoMarkdown) {
|
|
175
173
|
content = await this.compile(content, locals, { lang: opts.lang, ttl: -1 }) // markdown can't process template tags, hence preprocess here
|
|
176
174
|
content = this.app.bajoMarkdown.parse(content)
|
|
@@ -205,9 +203,9 @@ async function factory (pkgName) {
|
|
|
205
203
|
}
|
|
206
204
|
if (layoutFm.title && !locals.page.title) locals.page.title = layoutFm.title
|
|
207
205
|
content = layoutContent.replace('<!-- body -->', content)
|
|
208
|
-
const
|
|
209
|
-
const fullTitle =
|
|
210
|
-
locals.page.fullTitle = locals.fullTitle ?? fullTitle
|
|
206
|
+
const usePluginTitle = get(this, 'app.waibuMpa.config.page.usePluginTitle')
|
|
207
|
+
const fullTitle = usePluginTitle ? `${locals.page.title} - ${this.app.waibuMpa.getPluginTitle(locals.page.ns, opts.lang)}` : locals.page.title
|
|
208
|
+
locals.page.fullTitle = locals.page.fullTitle ?? fullTitle
|
|
211
209
|
}
|
|
212
210
|
content = await this.compile(content, locals, { lang: opts.lang, ttl: this.config.cache.maxAgeDur })
|
|
213
211
|
return await this._handleInclude(content, locals, opts)
|
|
@@ -225,7 +223,7 @@ async function factory (pkgName) {
|
|
|
225
223
|
|
|
226
224
|
parseFrontMatter = async (input = '', lang) => {
|
|
227
225
|
const { isEmpty, isPlainObject, isArray, filter, map } = this.app.lib._
|
|
228
|
-
const { parseObject } = this.app.
|
|
226
|
+
const { parseObject } = this.app.lib
|
|
229
227
|
const handlers = map(filter(this.app.configHandlers, h => !['.js'].includes(h.ext)), h => h.readHandler)
|
|
230
228
|
let success
|
|
231
229
|
for (const handler of handlers) {
|
|
@@ -242,8 +240,7 @@ async function factory (pkgName) {
|
|
|
242
240
|
|
|
243
241
|
compile = async (content, locals, { lang, ttl = 0 } = {}) => {
|
|
244
242
|
locals.attr = locals.attr ?? {}
|
|
245
|
-
const
|
|
246
|
-
const { template } = _
|
|
243
|
+
const { template } = this.app.lib._
|
|
247
244
|
const cache = this.app.bajoCache
|
|
248
245
|
let canCache = this.config.cache !== false && cache && this.app.bajo.config.env !== 'dev'
|
|
249
246
|
if (ttl === -1) canCache = false
|
package/lib/resolve-resource.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bajo-template",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Template Renderer for Bajo Framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
11
|
"bajo": {
|
|
12
|
-
"type": "plugin"
|
|
12
|
+
"type": "plugin",
|
|
13
|
+
"alias": "tpl"
|
|
13
14
|
},
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
package/wiki/CHANGES.md
ADDED
package/wiki/CONFIG.md
CHANGED
|
File without changes
|
package/wiki/CONTRIBUTING.md
CHANGED
|
File without changes
|