Created
September 13, 2012 16:53
-
-
Save fearphage/3715766 to your computer and use it in GitHub Desktop.
doT.js template example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"settings": { | |
"foo": "low" | |
,"bar": "high" | |
,"baz": "low" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{##def.radiogroup: | |
<h2>{{= name}}</h2> | |
{{~['low', 'high'] :value}} | |
<input type="radio" name="{{= name }}" value="{{= value }}"{{? it.settings[name] == value }} checked="checked"{{?}}/> | |
{{~}} | |
#}} | |
{{##def.settings: | |
<h1>Settings</h1> | |
{{~Object.keys(it.settings) :name}} | |
{{#def.radiogroup}} | |
{{~}} | |
#}} | |
{{#def.settings}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inspired by https://gist.github.com/3696453