Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.05 KB

README.md

File metadata and controls

28 lines (20 loc) · 1.05 KB

Build Status codecov GoDoc

A very simple template system, intended for simple customer-facing templates.

easytpl transforms to Go's template system as follows:

{%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

{%@user.HasPermission "feature-x"%} -> {{call .user.HasPermission "feature-x"}}

That's all :-) It doesn't support if, range, or anything else.