Skip to content

Teamwork/easytpl

Repository files navigation

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.

About

A very simple template system

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages