Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dasch/ecurly
Curly templates for Erlang!
https://github.com/dasch/ecurly
Last synced: 24 days ago
JSON representation
Curly templates for Erlang!
- Host: GitHub
- URL: https://github.com/dasch/ecurly
- Owner: dasch
- Created: 2013-07-12T23:23:51.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-07-16T12:48:42.000Z (over 11 years ago)
- Last Synced: 2023-04-11T15:32:48.704Z (over 1 year ago)
- Language: Erlang
- Size: 121 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ecurly
======Curly templates for Erlang!
```erlang
% Templates are simple strings:
Template = "Hello {{name}}!",% You can render the template using `curly:render_with_dict` if you want to
% supply the values of the references with a dict().
Dict = dict:from_list([{name, "World"}]),
{ok, "Hello World!"} = curly:render_with_dict(Template, Dict),% You can also use a module to supply the values. It needs to export a function
% with the name of the reference. In this example, `some_module` exports
% `name/0`.
{ok, "Hello World!"} = curly:render_with_module(Template, some_module),% Finally, you can supply a function of your own to look up reference values.
Presenter = fun(Reference) ->
case Reference of
"name" -> "World"
end
end,
{ok, "Hello World!"} = curly:render(Template, Presenter),kthxbye.
```