Created
December 23, 2009 05:19
-
-
Save mojombo/262328 to your computer and use it in GitHub Desktop.
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
Just a simple demonstration of how to use my soon-to-be-released mustache.erl library. Mustaches forever! |
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
-module(simple). | |
-compile(export_all). | |
name() -> | |
"Tom". | |
value() -> | |
10000. | |
taxed_value() -> | |
value() - (value() * 0.4). | |
in_ca() -> | |
true. | |
%%--------------------------------------------------------------------------- | |
start() -> | |
code:add_patha(".."), | |
Output = mustache:render(simple, "simple.mustache"), | |
io:format(Output, []). |
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
Hello {{name}} | |
You have just won ${{value}}! | |
{{#in_ca}} | |
Well, ${{ taxed_value }}, after taxes. | |
{{/in_ca}} |
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
Hello Tom | |
You have just won $10000! | |
Well, $6000.00, after taxes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment