Categorygithub.com/teamwork/easytpl
repositorypackage
0.0.0-20240821184804-92341c3889bb
Repository: https://github.com/teamwork/easytpl.git
Documentation: pkg.go.dev

# README

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.