-
Notifications
You must be signed in to change notification settings - Fork 0
Elements
The symbols after the parameter names denote how many times must a parameter be provided:
-
(1)
- Exactly once; -
(*)
- 0 or more; -
(+)
- 1 or more; -
(?)
- 0 or 1
<$template name=CODE acceptsChildren>
<div class=code>
<code>
<$children raw />
</code>
</div>
</$template>
Expands to the children provided to the currently expanded template, thus forbidden outside of <$template>
Parameters:
-
raw (?)
: Do not process the children, paste them verbatim.
Children: none
<$foreach $POST in dir=posts>
<div class=post>
<a href=$POST>Post $index</a>
</div>
</$foreach>
Iterates a directory and expands to its children for every encountered file.
On every iteration sets the variable index
to the number of the current iteration, starting from 0
Parameters (exactly in the specified order):
-
$VAR_NAME (1)
: The variable which will have the path to the file on the current step of the iteration. -
in (1)
: Just a separator for more readability. -
dir=path (1)
:path
is the directory to be iterated over.
Children: required
<$lua>os.date("compiled at %c")</$lua>
An alternative syntax for $()
, evaluates the Lua code in its children.
Parameters: none
Children: required
Disables any pre-processing of its children, which will be escaped as HTML.
Allows passing attributes to replace <$raw>
with another element.
The following snippet:
<$raw code class=code><$lua>"Hello, World"</$lua></$raw>
Will expand to the following:
<code class="code"><$lua>"Hello, World"</$lua></code>
Parameters:
-
name attrs... (?)
: replace$raw
withname
as the element name and keepattrs...
in it.
Children: optional
<$ref processed $JS="index.js" />
Manually register an asset & assign the path to it (unchanged) to a Lua variable.
Keep in mind that if the asset is mentioned in an HTML element's attribute, this is unnecessary.
Parameters:
-
$VAR_NAME=path (1)
: Registerpath
as an asset and assignpath
to the variableVAR_NAME
.path
must resolve to the path to a local file. -
raw (?)
: Enforce that the asset is not processed as a template file. Mutually exclusive withprocessed
. -
processed (?)
: Enforce that the asset is processed as a template file. Mutually exclusive withraw
.
If neither raw
nor processed
are specified, processing mode of the asset is the determined by its file extension. See the "Assets" section for more information on this.
Children: none
<$registerProcessedExt js />
Registers a file extension, the files with which will be processed as template files.
Parameters:
-
ext (1)
:ext
will be the new processed file extension, it must not contain the initial dot.
Children: none
<$template name=BODY acceptsChildren $title="Insert text">
<div class=fg>
<$children />
</div>
</$template>
Define a new template.
Parameters:
-
name=name (1)
:name
is the name of the template. -
acceptsChildren (?)
: If provided, the template will optionally accept children, otherwise it'll reject them. -
$ARG_NAME (*)
:ARG_NAME
is a required parameter to the template, and will be a variable while the template is expanded. -
$ARG_NAME=default (*)
:ARG_NAME
is an optional parameter to the template, and will be a variable while the template is expanded. If not provided, it'll be assigned the valuedefault
.
Children: optional