kaappi-template — Template Engine¶
Pure Scheme — no dependencies.
Quick start¶
(import (kaappi template))
;; Plain text
(template-render "Hello, {{.name}}!" '(("name" . "Alice")))
;=> "Hello, Alice!"
;; HTML (auto-escapes <>&"')
(template-render-html "<p>{{.content}}</p>"
'(("content" . "<script>alert('xss')</script>")))
;=> "<p><script>alert('xss')</script></p>"
Template syntax¶
Variables¶
Conditionals¶
Loops¶
API¶
(template-render tmpl data) ; plain text
(template-render-html tmpl data) ; HTML with auto-escaping
(template-parse tmpl) ; parse to reusable AST
(template-execute ast data esc) ; execute with custom escape
(html-escape str) ; HTML entity escaping
Data is an alist. Nested data uses nested alists. Falsy: #f, 'null, "", (), 0.