bajo-template 2.10.0 → 2.11.0
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/lib_imports.js.html +0 -0
- package/docs/module-Imports.html +0 -0
- package/docs/scripts/core.js +0 -0
- package/docs/scripts/core.min.js +0 -0
- package/docs/scripts/resize.js +0 -0
- package/docs/scripts/search.js +0 -0
- package/docs/scripts/search.min.js +5 -5
- package/docs/scripts/third-party/Apache-License-2.0.txt +0 -0
- package/docs/scripts/third-party/fuse.js +0 -0
- package/docs/scripts/third-party/hljs-line-num-original.js +0 -0
- package/docs/scripts/third-party/hljs-line-num.js +0 -0
- package/docs/scripts/third-party/hljs-original.js +0 -0
- package/docs/scripts/third-party/hljs.js +0 -0
- package/docs/scripts/third-party/popper.js +0 -0
- package/docs/scripts/third-party/tippy.js +0 -0
- package/docs/scripts/third-party/tocbot.js +0 -0
- 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 +2 -32
- package/lib/imports.js +169 -170
- package/package.json +1 -1
- package/test/bajo-template.test.js +275 -275
- package/wiki/CHANGES.md +74 -70
- package/wiki/CONFIG.md +0 -0
- package/wiki/CONTRIBUTING.md +0 -0
package/.github/FUNDING.yml
CHANGED
|
File without changes
|
|
File without changes
|
package/.jsdoc.conf.json
CHANGED
|
File without changes
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/docs/BajoTemplate.html
CHANGED
|
File without changes
|
package/docs/data/search.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/global.html
CHANGED
|
File without changes
|
package/docs/index.html
CHANGED
|
File without changes
|
package/docs/index.js.html
CHANGED
|
File without changes
|
package/docs/lib_imports.js.html
CHANGED
|
File without changes
|
package/docs/module-Imports.html
CHANGED
|
File without changes
|
package/docs/scripts/core.js
CHANGED
|
File without changes
|
package/docs/scripts/core.min.js
CHANGED
|
File without changes
|
package/docs/scripts/resize.js
CHANGED
|
File without changes
|
package/docs/scripts/search.js
CHANGED
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const searchId="LiBfqbJVcV",searchHash="#"+searchId,searchContainer=document.querySelector("#PkfLWpAbet"),searchWrapper=document.querySelector("#iCxFxjkHbP"),searchCloseButton=document.querySelector("#VjLlGakifb"),searchInput=document.querySelector("#vpcKVYIppa"),resultBox=document.querySelector("#fWwVHRuDuN");function showResultText(e){resultBox.innerHTML=`<span class="search-result-c-text">${e}</span>`}function hideSearch(){window.location.hash===searchHash&&history.go(-1),window.onhashchange=null,searchContainer&&(searchContainer.style.display="none")}function listenCloseKey(e){"Escape"===e.key&&(hideSearch(),window.removeEventListener("keyup",listenCloseKey))}function showSearch(){try{hideMobileMenu()}catch(e){console.error(e)}window.onhashchange=hideSearch,window.location.hash!==searchHash&&history.pushState(null,null,searchHash),searchContainer&&(searchContainer.style.display="flex",window.addEventListener("keyup",listenCloseKey)),searchInput&&searchInput.focus()}async function fetchAllData(){var{hostname:e,protocol:t,port:n}=location,t=t+"//"+e+(""!==n?":"+n:"")+baseURL,e=new URL("data/search.json",t);const a=await fetch(e);n=(await a.json()).list;return n}function onClickSearchItem(t){const n=t.currentTarget;if(n){const a=n.getAttribute("href")||"";t=a.split("#")[1]||"";let e=document.getElementById(t);e||(t=decodeURI(t),e=document.getElementById(t)),e&&setTimeout(function(){bringElementIntoView(e)},100)}}function buildSearchResult(e){let t="";var n=/(<([^>]+)>)/gi;for(const s of e){const{title:c="",description:i=""}=s.item;var a=s.item.link.replace('<a href="',"").replace(/">.*/,""),o=c.replace(n,""),r=i.replace(n,"");t+=`
|
|
2
|
-
<a onclick="onClickSearchItem(event)" href="${a}" class="search-result-item">
|
|
3
|
-
<div class="search-result-item-title">${o}</div>
|
|
4
|
-
<div class="search-result-item-p">${r||"No description available."}</div>
|
|
5
|
-
</a>
|
|
1
|
+
const searchId="LiBfqbJVcV",searchHash="#"+searchId,searchContainer=document.querySelector("#PkfLWpAbet"),searchWrapper=document.querySelector("#iCxFxjkHbP"),searchCloseButton=document.querySelector("#VjLlGakifb"),searchInput=document.querySelector("#vpcKVYIppa"),resultBox=document.querySelector("#fWwVHRuDuN");function showResultText(e){resultBox.innerHTML=`<span class="search-result-c-text">${e}</span>`}function hideSearch(){window.location.hash===searchHash&&history.go(-1),window.onhashchange=null,searchContainer&&(searchContainer.style.display="none")}function listenCloseKey(e){"Escape"===e.key&&(hideSearch(),window.removeEventListener("keyup",listenCloseKey))}function showSearch(){try{hideMobileMenu()}catch(e){console.error(e)}window.onhashchange=hideSearch,window.location.hash!==searchHash&&history.pushState(null,null,searchHash),searchContainer&&(searchContainer.style.display="flex",window.addEventListener("keyup",listenCloseKey)),searchInput&&searchInput.focus()}async function fetchAllData(){var{hostname:e,protocol:t,port:n}=location,t=t+"//"+e+(""!==n?":"+n:"")+baseURL,e=new URL("data/search.json",t);const a=await fetch(e);n=(await a.json()).list;return n}function onClickSearchItem(t){const n=t.currentTarget;if(n){const a=n.getAttribute("href")||"";t=a.split("#")[1]||"";let e=document.getElementById(t);e||(t=decodeURI(t),e=document.getElementById(t)),e&&setTimeout(function(){bringElementIntoView(e)},100)}}function buildSearchResult(e){let t="";var n=/(<([^>]+)>)/gi;for(const s of e){const{title:c="",description:i=""}=s.item;var a=s.item.link.replace('<a href="',"").replace(/">.*/,""),o=c.replace(n,""),r=i.replace(n,"");t+=`
|
|
2
|
+
<a onclick="onClickSearchItem(event)" href="${a}" class="search-result-item">
|
|
3
|
+
<div class="search-result-item-title">${o}</div>
|
|
4
|
+
<div class="search-result-item-p">${r||"No description available."}</div>
|
|
5
|
+
</a>
|
|
6
6
|
`}return t}function getSearchResult(e,t,n){var t={...{shouldSort:!0,threshold:.4,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:t}},a=Fuse.createIndex(t.keys,e);const o=new Fuse(e,t,a),r=o.search(n);return 20<r.length?r.slice(0,20):r}function debounce(t,n,a){let o;return function(){const e=arguments;clearTimeout(o),o=setTimeout(()=>{o=null,a||t.apply(this,e)},n),a&&!o&&t.apply(this,e)}}let searchData;async function search(e){e=e.target.value;if(resultBox)if(e){if(!searchData){showResultText("Loading...");try{searchData=await fetchAllData()}catch(e){return console.log(e),void showResultText("Failed to load result.")}}e=getSearchResult(searchData,["title","description"],e);e.length?resultBox.innerHTML=buildSearchResult(e):showResultText("No result found! Try some different combination.")}else showResultText("Type anything to view search result");else console.error("Search result container not found")}function onDomContentLoaded(){const e=document.querySelectorAll(".search-button");var t=debounce(search,300);searchCloseButton&&searchCloseButton.addEventListener("click",hideSearch),e&&e.forEach(function(e){e.addEventListener("click",showSearch)}),searchContainer&&searchContainer.addEventListener("click",hideSearch),searchWrapper&&searchWrapper.addEventListener("click",function(e){e.stopPropagation()}),searchInput&&searchInput.addEventListener("keyup",t),window.location.hash===searchHash&&showSearch()}window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",function(){window.location.hash===searchHash&&showSearch()});
|
|
File without changes
|
|
File without changes
|
|
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/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
|
@@ -64,6 +64,7 @@ async function factory (pkgName) {
|
|
|
64
64
|
*/
|
|
65
65
|
buildCompileImports = (locals = {}, req = {}) => {
|
|
66
66
|
const _ = this.app.lib._
|
|
67
|
+
const { createExcerpt } = this.app.lib.aneka
|
|
67
68
|
return {
|
|
68
69
|
_,
|
|
69
70
|
_t: (text, ...args) => {
|
|
@@ -90,7 +91,7 @@ async function factory (pkgName) {
|
|
|
90
91
|
return this.app.bajoMarkdown.parseContent(content)
|
|
91
92
|
},
|
|
92
93
|
_excerpt: (content, words) => {
|
|
93
|
-
return
|
|
94
|
+
return createExcerpt({ content, maxWords: words })
|
|
94
95
|
},
|
|
95
96
|
_dump: (value, noPre) => {
|
|
96
97
|
return (noPre ? '' : '<pre>') + JSON.stringify(value, null, 2) + (noPre ? '' : '</pre>')
|
|
@@ -592,37 +593,6 @@ async function factory (pkgName) {
|
|
|
592
593
|
content = content ?? ''
|
|
593
594
|
return { frontMatter, content }
|
|
594
595
|
}
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* Get an excerpt from the content.
|
|
598
|
-
*
|
|
599
|
-
* @method
|
|
600
|
-
* @param {string} content - Content string
|
|
601
|
-
* @param {number} maxWords - Maximum number of words
|
|
602
|
-
* @param {string} trailChars - Trailing characters
|
|
603
|
-
* @returns {string} Excerpt
|
|
604
|
-
* @see {@link https://medium.com/@paulohfev/problem-solving-how-to-create-an-excerpt-fdb048687928|Problem Solving: How to Create an Excerpt}
|
|
605
|
-
*/
|
|
606
|
-
getExcerpt = (content = '', maxWords = 50, trailChars = '...') => {
|
|
607
|
-
const listOfWords = content.trim().split(' ')
|
|
608
|
-
const truncatedContent = listOfWords.slice(0, maxWords).join(' ')
|
|
609
|
-
const excerpt = truncatedContent + trailChars
|
|
610
|
-
return listOfWords.length > maxWords ? excerpt : content
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Get a truncated version of the content.
|
|
615
|
-
*
|
|
616
|
-
* @method
|
|
617
|
-
* @param {string} content - Content string
|
|
618
|
-
* @param {number} maxChars - Maximum number of characters
|
|
619
|
-
* @param {string} trailChars - Trailing characters
|
|
620
|
-
* @returns {string} Truncated content
|
|
621
|
-
*/
|
|
622
|
-
getTruncated = (content = '', maxChars = 50, trailChars = '...') => {
|
|
623
|
-
const truncated = content.slice(0, maxChars)
|
|
624
|
-
return truncated.length !== content.length ? (truncated + trailChars) : content
|
|
625
|
-
}
|
|
626
596
|
}
|
|
627
597
|
|
|
628
598
|
return BajoTemplate
|
package/lib/imports.js
CHANGED
|
@@ -1,170 +1,169 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Functions and types for {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
3
|
-
*
|
|
4
|
-
* With these functions now your templates can use all listed functions below.
|
|
5
|
-
* The imports are automatically injected into the template's scope during compilation.
|
|
6
|
-
*
|
|
7
|
-
* @module Imports
|
|
8
|
-
* @example
|
|
9
|
-
* // In your template file (e.g., template.html)
|
|
10
|
-
* <p><%= _t('Hello, %s!', user.name) %></p>
|
|
11
|
-
* <p><%= _format(user.birthDate, 'date') %></p>
|
|
12
|
-
* <p><%= _routePath('home:/user/{id}/profile', { id: user.id }) %></p>
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Translate text with optional parameters.
|
|
17
|
-
*
|
|
18
|
-
* @callback FnTranslate
|
|
19
|
-
* @function
|
|
20
|
-
* @param {string} text - Text to be translated.
|
|
21
|
-
* @param {...*} args - Optional parameters for translation.
|
|
22
|
-
* @returns {string} Translated text.
|
|
23
|
-
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Format text with optional parameters.
|
|
28
|
-
*
|
|
29
|
-
* See {@link https://ardhi.github.io/bajo/Bajo.html#format|Bajo.format} for more details.
|
|
30
|
-
*
|
|
31
|
-
* @callback FnFormat
|
|
32
|
-
* @function
|
|
33
|
-
* @param {*} val - Value to be formatted.
|
|
34
|
-
* @param {string} type - Value type (e.g., 'string', 'number', 'date').
|
|
35
|
-
* @param {object} [opts] - Optional formatting options.
|
|
36
|
-
* @returns {string} Formatted text.
|
|
37
|
-
* @see {@link https://ardhi.github.io/bajo/Bajo.html#format|Bajo.format}
|
|
38
|
-
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Find route by name. Only available when Waibu plugin is installed & loaded.
|
|
43
|
-
*
|
|
44
|
-
* See {@link https://ardhi.github.io/waibu/Waibu.html#findRoute|Waibu.findRoute} for more details.
|
|
45
|
-
*
|
|
46
|
-
* @callback FnFindRoute
|
|
47
|
-
* @function
|
|
48
|
-
* @param {string} name - Route name.
|
|
49
|
-
* @param {string} [method='GET'] - HTTP method (e.g., 'GET', 'POST').
|
|
50
|
-
* @returns {object|null} Route object or null if not found.
|
|
51
|
-
* @see {@link https://ardhi.github.io/waibu/Waibu.html#findRoute|Waibu.findRoute}
|
|
52
|
-
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Get route path by name. Only available when Waibu plugin is installed & loaded.
|
|
57
|
-
*
|
|
58
|
-
* See {@link https://ardhi.github.io/waibu/Waibu.html#routePath|Waibu.routePath} for more details.
|
|
59
|
-
*
|
|
60
|
-
* @callback FnRoutePath
|
|
61
|
-
* @function
|
|
62
|
-
* @param {string} name - Route name.
|
|
63
|
-
* @param {object} [options={}] - Options object.
|
|
64
|
-
* @returns {string|null} Route path or null if not found.
|
|
65
|
-
* @see {@link https://ardhi.github.io/waibu/Waibu.html#routePath|Waibu.routePath}
|
|
66
|
-
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Get titleized version of a string.
|
|
71
|
-
*
|
|
72
|
-
* @callback FnTitleize
|
|
73
|
-
* @function
|
|
74
|
-
* @param {string} str - String to be titleized.
|
|
75
|
-
* @returns {string} Titleized string.
|
|
76
|
-
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Check if a plugin is loaded by its name or alias.
|
|
81
|
-
*
|
|
82
|
-
* @callback FnHasPlugin
|
|
83
|
-
* @function
|
|
84
|
-
* @param {string} nameOrAlias - Plugin name or alias.
|
|
85
|
-
* @returns {boolean} True if the plugin is loaded, false otherwise.
|
|
86
|
-
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* JSON stringify a value. Only available when WaibuMpa plugin is installed & loaded.
|
|
91
|
-
*
|
|
92
|
-
* See {@link https://ardhi.github.io/waibu/WaibuMpa.html#jsonStringify|WaibuMpa.jsonStringify} for more details.
|
|
93
|
-
*
|
|
94
|
-
* @callback FnJsonStringify
|
|
95
|
-
* @function
|
|
96
|
-
* @param {*} value - Value to be stringified.
|
|
97
|
-
* @param {object} [replacer] - Optional replacer function or array.
|
|
98
|
-
* @param {string|number} [space] - Optional space for indentation.
|
|
99
|
-
* @returns {string} JSON stringified value.
|
|
100
|
-
* @see {@link https://ardhi.github.io/waibu/WaibuMpa.html#jsonStringify|WaibuMpa.jsonStringify}
|
|
101
|
-
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
102
|
-
*/
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Parse markdown text. Only available when BajoMarkdown plugin is installed & loaded.
|
|
106
|
-
* See {@link https://ardhi.github.io/bajo/BajoMarkdown.html#parse|BajoMarkdown.parse} for more details.
|
|
107
|
-
*
|
|
108
|
-
* @callback FnParseMarkdown
|
|
109
|
-
* @function
|
|
110
|
-
* @param {string} value - Markdown text to be parsed.
|
|
111
|
-
* @returns {string} Parsed HTML string.
|
|
112
|
-
* @see {@link https://ardhi.github.io/bajo/BajoMarkdown.html#parse|BajoMarkdown.parse}
|
|
113
|
-
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Get excerpt of a string.
|
|
118
|
-
*
|
|
119
|
-
* @callback FnExcerpt
|
|
120
|
-
* @function
|
|
121
|
-
* @param {string} text - String to be excerpted.
|
|
122
|
-
* @param {number} [maxWords=50] - Max number of words.
|
|
123
|
-
* @param {string} [trailChars='...'] - Characters to append if truncated.
|
|
124
|
-
* @returns {string} Excerpted string.
|
|
125
|
-
* @see {@link BajoTemplate#
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* @
|
|
133
|
-
* @
|
|
134
|
-
* @
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* @
|
|
144
|
-
* @
|
|
145
|
-
* @
|
|
146
|
-
* @
|
|
147
|
-
* @see {@link
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* @
|
|
155
|
-
* @
|
|
156
|
-
* @
|
|
157
|
-
* @property {
|
|
158
|
-
* @property {module:Imports~
|
|
159
|
-
* @property {module:Imports~
|
|
160
|
-
* @property {module:Imports~
|
|
161
|
-
* @property {module:Imports~
|
|
162
|
-
* @property {module:Imports~
|
|
163
|
-
* @property {module:Imports~
|
|
164
|
-
* @property {module:Imports~
|
|
165
|
-
* @property {module:Imports~
|
|
166
|
-
* @property {module:Imports~
|
|
167
|
-
* @property {module:Imports~
|
|
168
|
-
* @
|
|
169
|
-
|
|
170
|
-
*/
|
|
1
|
+
/**
|
|
2
|
+
* Functions and types for {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
3
|
+
*
|
|
4
|
+
* With these functions now your templates can use all listed functions below.
|
|
5
|
+
* The imports are automatically injected into the template's scope during compilation.
|
|
6
|
+
*
|
|
7
|
+
* @module Imports
|
|
8
|
+
* @example
|
|
9
|
+
* // In your template file (e.g., template.html)
|
|
10
|
+
* <p><%= _t('Hello, %s!', user.name) %></p>
|
|
11
|
+
* <p><%= _format(user.birthDate, 'date') %></p>
|
|
12
|
+
* <p><%= _routePath('home:/user/{id}/profile', { id: user.id }) %></p>
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Translate text with optional parameters.
|
|
17
|
+
*
|
|
18
|
+
* @callback FnTranslate
|
|
19
|
+
* @function
|
|
20
|
+
* @param {string} text - Text to be translated.
|
|
21
|
+
* @param {...*} args - Optional parameters for translation.
|
|
22
|
+
* @returns {string} Translated text.
|
|
23
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Format text with optional parameters.
|
|
28
|
+
*
|
|
29
|
+
* See {@link https://ardhi.github.io/bajo/Bajo.html#format|Bajo.format} for more details.
|
|
30
|
+
*
|
|
31
|
+
* @callback FnFormat
|
|
32
|
+
* @function
|
|
33
|
+
* @param {*} val - Value to be formatted.
|
|
34
|
+
* @param {string} type - Value type (e.g., 'string', 'number', 'date').
|
|
35
|
+
* @param {object} [opts] - Optional formatting options.
|
|
36
|
+
* @returns {string} Formatted text.
|
|
37
|
+
* @see {@link https://ardhi.github.io/bajo/Bajo.html#format|Bajo.format}
|
|
38
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Find route by name. Only available when Waibu plugin is installed & loaded.
|
|
43
|
+
*
|
|
44
|
+
* See {@link https://ardhi.github.io/waibu/Waibu.html#findRoute|Waibu.findRoute} for more details.
|
|
45
|
+
*
|
|
46
|
+
* @callback FnFindRoute
|
|
47
|
+
* @function
|
|
48
|
+
* @param {string} name - Route name.
|
|
49
|
+
* @param {string} [method='GET'] - HTTP method (e.g., 'GET', 'POST').
|
|
50
|
+
* @returns {object|null} Route object or null if not found.
|
|
51
|
+
* @see {@link https://ardhi.github.io/waibu/Waibu.html#findRoute|Waibu.findRoute}
|
|
52
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get route path by name. Only available when Waibu plugin is installed & loaded.
|
|
57
|
+
*
|
|
58
|
+
* See {@link https://ardhi.github.io/waibu/Waibu.html#routePath|Waibu.routePath} for more details.
|
|
59
|
+
*
|
|
60
|
+
* @callback FnRoutePath
|
|
61
|
+
* @function
|
|
62
|
+
* @param {string} name - Route name.
|
|
63
|
+
* @param {object} [options={}] - Options object.
|
|
64
|
+
* @returns {string|null} Route path or null if not found.
|
|
65
|
+
* @see {@link https://ardhi.github.io/waibu/Waibu.html#routePath|Waibu.routePath}
|
|
66
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Get titleized version of a string.
|
|
71
|
+
*
|
|
72
|
+
* @callback FnTitleize
|
|
73
|
+
* @function
|
|
74
|
+
* @param {string} str - String to be titleized.
|
|
75
|
+
* @returns {string} Titleized string.
|
|
76
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Check if a plugin is loaded by its name or alias.
|
|
81
|
+
*
|
|
82
|
+
* @callback FnHasPlugin
|
|
83
|
+
* @function
|
|
84
|
+
* @param {string} nameOrAlias - Plugin name or alias.
|
|
85
|
+
* @returns {boolean} True if the plugin is loaded, false otherwise.
|
|
86
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* JSON stringify a value. Only available when WaibuMpa plugin is installed & loaded.
|
|
91
|
+
*
|
|
92
|
+
* See {@link https://ardhi.github.io/waibu/WaibuMpa.html#jsonStringify|WaibuMpa.jsonStringify} for more details.
|
|
93
|
+
*
|
|
94
|
+
* @callback FnJsonStringify
|
|
95
|
+
* @function
|
|
96
|
+
* @param {*} value - Value to be stringified.
|
|
97
|
+
* @param {object} [replacer] - Optional replacer function or array.
|
|
98
|
+
* @param {string|number} [space] - Optional space for indentation.
|
|
99
|
+
* @returns {string} JSON stringified value.
|
|
100
|
+
* @see {@link https://ardhi.github.io/waibu/WaibuMpa.html#jsonStringify|WaibuMpa.jsonStringify}
|
|
101
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Parse markdown text. Only available when BajoMarkdown plugin is installed & loaded.
|
|
106
|
+
* See {@link https://ardhi.github.io/bajo/BajoMarkdown.html#parse|BajoMarkdown.parse} for more details.
|
|
107
|
+
*
|
|
108
|
+
* @callback FnParseMarkdown
|
|
109
|
+
* @function
|
|
110
|
+
* @param {string} value - Markdown text to be parsed.
|
|
111
|
+
* @returns {string} Parsed HTML string.
|
|
112
|
+
* @see {@link https://ardhi.github.io/bajo/BajoMarkdown.html#parse|BajoMarkdown.parse}
|
|
113
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Get excerpt of a string.
|
|
118
|
+
*
|
|
119
|
+
* @callback FnExcerpt
|
|
120
|
+
* @function
|
|
121
|
+
* @param {string} text - String to be excerpted.
|
|
122
|
+
* @param {number} [maxWords=50] - Max number of words.
|
|
123
|
+
* @param {string} [trailChars='...'] - Characters to append if truncated.
|
|
124
|
+
* @returns {string} Excerpted string.
|
|
125
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Dump a value to console.
|
|
130
|
+
*
|
|
131
|
+
* @callback FnDump
|
|
132
|
+
* @function
|
|
133
|
+
* @param {*} value - Value to be dumped.
|
|
134
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Get a setting value by key. Only available when Waibu plugin is installed & loaded.
|
|
139
|
+
*
|
|
140
|
+
* See {@link https://ardhi.github.io/waibu/Waibu.html#getSetting|Waibu.getSetting} for more details.
|
|
141
|
+
*
|
|
142
|
+
* @callback FnGetSetting
|
|
143
|
+
* @function
|
|
144
|
+
* @param {string} key - Setting key.
|
|
145
|
+
* @returns {*} Setting value.
|
|
146
|
+
* @see {@link https://ardhi.github.io/waibu/Waibu.html#getSetting|Waibu.getSetting}
|
|
147
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Result of {@link BajoTemplate#buildCompileImports} method.
|
|
152
|
+
*
|
|
153
|
+
* @typedef {object} TImportsResult
|
|
154
|
+
* @type {object}
|
|
155
|
+
* @global
|
|
156
|
+
* @property {object} _ - Utility library (lodash)
|
|
157
|
+
* @property {module:Imports~FnTranslate} _t - Translation function
|
|
158
|
+
* @property {module:Imports~FnFormat} _format - Format function
|
|
159
|
+
* @property {module:Imports~FnFindRoute} _findRoute - Find route function
|
|
160
|
+
* @property {module:Imports~FnRoutePath} _routePath - Route path function
|
|
161
|
+
* @property {module:Imports~FnTitleize} _titleize - Titleize function
|
|
162
|
+
* @property {module:Imports~FnHasPlugin} _hasPlugin - Check if plugin exists function
|
|
163
|
+
* @property {module:Imports~FnJsonStringify} _jsonStringify - JSON stringify function
|
|
164
|
+
* @property {module:Imports~FnParseMarkdown} _parseMarkdown - Parse markdown function
|
|
165
|
+
* @property {module:Imports~FnExcerpt} _excerpt - Excerpt function
|
|
166
|
+
* @property {module:Imports~FnDump} _dump - Dump function
|
|
167
|
+
* @property {module:Imports~FnGetSetting} _getSetting - Get setting function
|
|
168
|
+
* @see {@link BajoTemplate#buildCompileImports|BajoTemplate.buildCompileImports}
|
|
169
|
+
*/
|