Mustache.Io
Io Mustache BindingsMustache.Io is library for compiling Mustache logicless templates in the Io language. It's usable in conjunction with _why's yown web-framework, or usable standalone.
Mustache.Io is designed to work both Io object and maps. It's simple api gives you two methods: render and setDelimiters:
| Method | Arguments | Description |
|---|---|---|
render |
template, object, partials
|
Renders the given template with the provided object and partials. |
setDelimiters |
start_delimiter, end_delimiter
|
Sets the delimiters. |
For standard Mustache template rendering, a simple contrived example in Io might look like:
doFile("lib/mustache.io")
obj := Object clone do(
name := "Miles"
age := 20
)
template := "I am {{ name }}, age: {{ age }}"
Mustache render(template, obj)
yields:
I am Miles, age: 20
That's pretty much all there is to it. Feel free to check out the full documentation here.