Templito

The Back end Templating language behind the Siter - a static website generator.

What makes templito different

Templito templates largely resemble those of handlebars and Go templates, but they have a few standout features.

Examples

Basic structure of a template

```html {{let title = "Page"}}\

{{first $title "Default Title"}}

{{if $0.cat}}\ {{for k v in $0.cat}}\

{{$k}} = {{$v}}

{{/for}}\ {{/if}}\ ```

Using Blocks ```html {{@md}}

Markdown

Everthing inside an '@md' block will be treated as markdown. (Assuming the md function is included by the FuncManager)

Even ranges like this:

{{for k v in $0.items}} * {{$v}} {{/for}}

{{/md}} ```

In fact any string to string function can be used as an "@block"

But they are more powerful than that.

html {{@let lines}} apple cat sandwhich {{/let}}\ {{for k v in split $lines}} <p>{{$v}}</p> {{/for}} will output:

html <p>apple</p> <p>cat</p> <p>sandwhich</p>

Depending on the security situation, you can opt in or out to allowing "exec" functions. ("exec" is not included in the defaults)

html {{for k v in split (exec "cat" "path/to/file") "\n"}} <p>{{$k}} = {{$v}}</p> {{/for}}

Changelog

V 0.2.0

Breaking Change : Functions now require a description to make documentation much easier for users of the system.

Funcmanagers now also provide/require a method to provide those descriptions so they can be printed by any software that uses the system.