https://github.com/teamwork/easytpl
A very simple template system
https://github.com/teamwork/easytpl
go
Last synced: 11 months ago
JSON representation
A very simple template system
- Host: GitHub
- URL: https://github.com/teamwork/easytpl
- Owner: Teamwork
- License: mit
- Created: 2018-03-15T04:59:57.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-08-22T06:38:52.000Z (almost 2 years ago)
- Last Synced: 2025-02-26T17:16:06.519Z (over 1 year ago)
- Topics: go
- Language: Go
- Size: 34.2 KB
- Stars: 0
- Watchers: 44
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.com/Teamwork/easytpl)
[](https://codecov.io/gh/Teamwork/easytpl)
[](https://godoc.org/github.com/Teamwork/easytpl)
A very simple template system, intended for simple customer-facing templates.
easytpl transforms to Go's template system as follows:
```go
{%var%} -> {{Var}}
{%var.val%} -> {{Var.Val}}
{%var.val,fallback=some string%} -> {{if .Var.Val}}{{.Var.Val}}{{else}}some string{{end}}
{{var.val}} -> {{ "{{var.val}}" }}
```
Template variables can also be escaped so that they are not translated into Go's template system, like so:
```
\{%var%} -> {%var%}
```
Function calls
```go
{%@user.HasPermission "feature-x"%} -> {{call .user.HasPermission "feature-x"}}
```
That's all :-) It doesn't support if, range, or anything else.