Text and HTML template engine for Kaappi Scheme.
Pure Scheme — no C dependencies, no build step.
thottam install kaappi-template(import (kaappi template))
;; Plain text (no escaping)
(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>"{{.name}} Access a key from the data alist
{{.user.email}} Nested access (dotted path)
{{.}} Current value (useful inside range)
{{if .show}}
This is visible
{{end}}
{{if .logged_in}}
Welcome!
{{else}}
Please log in.
{{end}}
Falsy values: #f, 'null, "", (), 0
{{range .items}}
Item: {{.}}
{{end}}
{{range .users}}
{{.name}} ({{.email}})
{{end}}
(template-render template-string data) ; plain text (no escaping)
(template-render-html template-string data) ; HTML (auto-escapes)Data is an alist: '(("key" . value) ...). Nested data uses nested alists.
(template-parse template-string) ; parse to AST (reusable)
(template-execute ast data escape-fn) ; execute with custom escape
(html-escape string) ; HTML entity escapingMIT