Templates — Aquilia Documentation
Comprehensive guide and documentation for Templates in the Aquilia framework. View API reference, examples, and implementation patterns.
Mail / Templates Aquilia Template Syntax (ATS) AquilaMail templates use Aquilia Template Syntax (ATS) — an expression and filter engine with mandatory HTML autoescaping by default. Control flow structures are prohibited so template rendering stays safe and deterministic. Expression-Only Design & Security ATS is deliberately minimal: it supports expressions and filter applications only. There are no loops (for), conditionals (if), or layout inheritance. Any attempt to use control flow tags raises MailTemplateFault at render time rather than silently shipping unparsed tags to a user's inbox. Automatic HTML Autoescaping: All interpolated expressions are automatically HTML-escaped using html.escape() (including double and single quotes). To bypass escaping for pre-sanitized HTML fragments, append | safe. ATS Syntax Reference , , ].map((item, i) => ( ))} Documented ATS Python API (aquilia.mail.template) Render strings, render template files, or extend ATS with custom registered filters directly from Python: from aquilia.mail.template import ( configure, render_string, render_template, register_filter, FILTERS ) # 1. Configure template search paths configure(["mail_templates", "modules/auth/templates"]) # 2. Render inline template string html_out = render_string( "Hello >, total: >", , "amount": 49.99} ) # 3. Render template file from configured directories rendered = render_template("welcome.aqt", ) # 4. Register custom filter @register_filter("mask_card") def mask_card_filter(value: str) -> str: return f"•••• •••• •••• " # Now usable in templates: > Built-in ATS Filters Filter Signature Description ))} Providers Delivery & Bounces )
Go to Homepage