package mantra.web

Template

CLASS public class

Lightweight mustache-style string template engine for HTML rendering and text placeholder substitution.

🏗️ Constructor Summary

Constructor Signature
def __init__(self, name: String, source: String)

⚙️ Method Summary

Modifier & Return Type Method Signature Description
String pub def render(vars: List) Replaces {{key}} placeholders in the template source with mapped variable values.

🔍 Detailed Method Specifications

pub def render(vars: List) -> String
Replaces {{key}} placeholders in the template source with mapped variable values.

💡 Example Usage

template_example.mantra
let tpl = Template("welcome", "

Welcome {{name}} to {{platform}}!

") let rendered = tpl.render([("name", "Alice"), ("platform", "Mantra Web")]) print(rendered) #

Welcome Alice to Mantra Web!