tpl
Generated by tinox doc
A minimal Mustache-like string template engine. Template::render substitutes {{key}} placeholders in a string with JSON-stringified values from a Map<String, JsonValue> in one pass; Template::compile/execute split that into a reusable parsed CompiledTemplate plus a separate execute step for repeated rendering.
Render placeholders
import tinox.core.tpl;
import tinox.core.json;
class Main
{
fnc main() -> Int32
{
let data: Map<String, JsonValue> = Map::new();
data["name"] = Json::parse("\"World\"");
let output: String = Template::render("Hello, {{name}}!", data);
println(output);
return 0;
}
}
class CompiledTemplate
Fields
source | String | |
sections | List<TemplateSection> |
class Template
Methods
fn render(template: String, data: Map<String, JsonValue>) → String
fn renderLoop(template: String, items: List<Map<String, JsonValue>>, itemVar: String) → String
fn compile(template: String) → CompiledTemplate
fn execute(tpl: CompiledTemplate, data: Map<String, JsonValue>) → String
class TemplateSection
Fields
kind | String | |
content | String |