Spanish Total.js
English
Documentation For AI agents
Contents

Tangular

The Tangular template engine: compile and render templates and register helpers.

.md GitHub

Tangular is the template engine used by TEMPLATE(), by audit messages and by the CMS. It is available as the global Tangular. The commands ({{ value }}, {{ if }}, {{ foreach }} and helpers) are described in Views.

var template = Tangular.compile('<h1>{{ name }}</h1>{{ foreach item in items }}<p>{{ item.price | format(2) }}</p>{{ end }}');
var html = template({ name: 'Order', items: [{ price: 10 }] });

The compiled function is template(model, [repository], [helpers]): names in the template are read from the model, $ is the repository. Values are HTML-encoded unless you use | raw. Tangular.register(name, fn) adds a helper for all templates.

Made in Europe