Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gootik/templaterl
Simple and fast templating with customizable expressions in Erlang
https://github.com/gootik/templaterl
customizable-expressions erlang mustache template
Last synced: 3 months ago
JSON representation
Simple and fast templating with customizable expressions in Erlang
- Host: GitHub
- URL: https://github.com/gootik/templaterl
- Owner: gootik
- License: mit
- Created: 2016-09-13T01:49:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-05T20:20:38.000Z (about 6 years ago)
- Last Synced: 2024-09-16T18:56:17.392Z (4 months ago)
- Topics: customizable-expressions, erlang, mustache, template
- Language: Erlang
- Homepage:
- Size: 737 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/gootik/templaterl.svg?branch=master)](https://travis-ci.org/gootik/templaterl)
# templaterl
Simple and fast templating with customizable expressions in ErlangTested for:
Erlang R17+# Usage
Simple replacement usage:
```erlang
templaterl:compile(<<"I have a {{{car_model}}}.">>, [{<<"car_model">>, <<"Nissan GTR">>}]).
<<"I have a Nissan GTR.">>
```Replacement with expressions:
```erlang
Uppercase = "uppercase(_Token, Value) -> << <<(string:to_upper(X))>> || <> <= Value >>.",
templaterl:register_helpers([Uppercase]),
templaterl:compile(<<"I have a {{{uppercase car_model}}}.">>, [{<<"car_model">>, <<"Nissan GTR">>}]).
<<"I have a NISSAN GTR.">>
```# Tests
Run tests by running:
```
rebar3 eunit
```# Benchmarks
You can run benchmarks on your own machine by running:
```bash
rebar3 cmd benchmark
```Results:
```
TODO: Add benchmark results
```# Profiling
To run and open qcachegrind on mac OSX:
```bash
rebar3 cmd profile
```