Skip to content

Instantly share code, notes, and snippets.

@pasaran
Created September 13, 2012 16:47
Show Gist options
  • Save pasaran/3715715 to your computer and use it in GitHub Desktop.
Save pasaran/3715715 to your computer and use it in GitHub Desktop.
Example of yate templates
{
"settings": {
"foo": "low",
"bar": "high",
"baz": "low"
},
"values": [ "low", "high" ]
}
values = /.values
match / {
<h1>Settings</h1>
apply .settings.* setting
}
match .* setting {
<h2>{ name() }</h2>
inputs( name(), . )
}
func inputs(name, checked-value) {
for values {
<input type="radio" name="{ name }" value="{ . }">
if checked-value == . {
@cheched = "checked"
}
</input>
" { . }"
}
}
@pasaran
Copy link
Author

pasaran commented Sep 13, 2012

yate (yet another templates engine) https://github.com/pasaran/yate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment