Primary handler for the CMS
- Copyright:
- (c) 2025 eVAL Agency
- License:
- The MIT License (MIT)
- Source:
- See:
Classes
Methods
(static) basename(path, without_extensionopt) → {string}
Get the basename of a given file, optionally without the extension
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
path |
string | |||
without_extension |
boolean |
<optional> |
false |
- Source:
Returns:
- Type
- string
(static) dirname(path) → {string}
Get the directory name of the requested file
Parameters:
Name | Type | Description |
---|---|---|
path |
string |
- Source:
Returns:
- Type
- string
(async, static) fetchLayout(layout, data) → {Promise.<string>}
Fetch the layout and return in the resolve
Parameters:
Name | Type | Description |
---|---|---|
layout |
string | Filename of layout. |
data |
object | Data passed to template. |
- Source:
Throws:
Returns:
- Type
- Promise.<string>
(static) getDatetime(dateStr) → {Date}
Formats date string to a Date object converted to the user's local timezone
Accepts dashes or slashes between characters, (to support YYYY/MM/DD URL directories)
Parameters:
Name | Type | Description |
---|---|---|
dateStr |
string | Date | Date string to convert |
- Source:
Returns:
Rendered Date object
- Type
- Date
(async, static) loadTemplate(url, data) → {Promise.<string>}
Load template from URL.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | URL of template to load. |
data |
object | Data to load into template. |
- Source:
Throws:
Returns:
- Type
- Promise.<string>
(static) pathJoin(args) → {string}
Function to join paths while ensuring each is separated by a slash
Parameters:
Name | Type | Description |
---|---|---|
args |
string |
- Source:
Returns:
- Type
- string
Example
pathJoin('posts', 'topic');
// Returns 'posts/topic'
pathJoin('posts', 'topic', 'README.md');
// Returns 'posts/topic/README.md'
(static) renderError(error) → {Promise}
Render an error to the browser
Parameters:
Name | Type | Description |
---|---|---|
error |
CMSError |
- Source:
Returns:
- Type
- Promise
(async, static) renderLayout(layout, data) → {Promise}
Renders the layout into the main container.
Parameters:
Name | Type | Description |
---|---|---|
layout |
string | Filename of layout. |
data |
TemplateObject | Data passed to template. |
- Source:
Throws:
Returns:
- Type
- Promise
(static) rtrim(str, copt, invertopt)
Remove trailing 'c's. Equivalent to str.replace(/c*$/, ''). /c*$/ is vulnerable to REDOS.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
str |
string | |||
c |
string |
<optional> |
' ' | |
invert |
boolean |
<optional> |
false | Remove suffix of non-c chars instead. Default falsey. |
- Source:
- See:
-
- marked/src/helpers.js
(static) setSystemContainer(container)
Set the system layout directory (generally only called from the CMS)
Parameters:
Name | Type | Description |
---|---|---|
container |
HTMLElement |
- Source:
(static) setSystemLayoutPath(args)
Set the system layout directory (generally only called from the CMS)
Parameters:
Name | Type | Description |
---|---|---|
args |
string |
- Source: