tourist/template
src/tourist/template.tur
render templates for routes (requires tur-template dep).
Since: v0.1.0
defn
render-template
(render-template [path : cstr env : int] :)
render a template file against an Env.
Parameters
| path | path to the template file, e.g. "views/greet.html.tur" | |
| env | Env handle from env-new or make-env |
Returns
:cstr -- rendered output, owned by the caller ("" on failure)
Example
(render-template "views/index.html.tur" e) ; => "<p>Hello, alice!</p>"
Since: v0.1.0 (always heap-allocated since tourist-on-stdlib-httpd H5)
defn
render-html
(render-html [path : cstr env : int] :)
answer with a rendered template.
Parameters
| path | path to the template file | |
| env | Env handle |
Returns
Response -- for the route to return
Example
(get! "/" (fn [ctx] (render-html "views/index.html.tur" site-env)))
Since: tourist-on-stdlib-httpd H5
Internal definitions
__rt-empty-- internal: a heap-allocated "".__rt-free-- internal: free a heap cstr.