Skip to content

Instantly share code, notes, and snippets.

@zeekay
Created December 27, 2011 12:12
Show Gist options
  • Save zeekay/1523445 to your computer and use it in GitHub Desktop.
Save zeekay/1523445 to your computer and use it in GitHub Desktop.
Render script inline using id kwarg:
- mustache id=test
%ul
%li
Hello {{name}}
%li
You have just won ${{value}}!
{{#in_ca}}
%li
Well, ${{taxed_value}}, after taxes.
{{/in_ca}}
becomes:
<script id="test" type="text/html">
<ul>
<li>
Hello {{name}}
</li>
<li>
You have just won ${{value}}!
</li>
{{#in_ca}}
<li>
Well, ${{taxed_value}}, after taxes.
</li>
{{/in_ca}}
</ul>
</script>
Render mustache template directly with pystache using context kwarg
- mustache context=test
%ul
%li
Hello {{name}}
%li
You have just won ${{value}}!
{{#in_ca}}
%li
Well, ${{taxed_value}}, after taxes.
{{/in_ca}}
becomes:
<ul>
<li>
Hello Bob
</li>
<li>
You have just won $999!
</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment