Skip to content
José Santos edited this page May 13, 2016 · 23 revisions

What is ?

Jet is a template engine that was designed to be easy to use and fast.

  • Simple and familiar syntax
  • Easy to use
  • Dynamic
  • Fast and light
  • Useful error messages
  • Template inheritance
  • Powerful

Simple and familiar syntax

The syntax has many similarities with the Go text/template template language, and the main diferences are, that we support template inheritance, simple C like expressions,pipelines can be used only in actions ex:{{expre|pipe|pipe}}, and all templates are file based, there is no "define","template" and "with" actions.

Syntax documentation

Easy to use

How to use:

  1. Create a Set and specify the lookup directories
  2. Call load template with the template name, the template will be loaded and cached, templates are loaded as they are need, ex: if your template extends, import or include an other template when loading your template those templates will be also loaded.
  3. Call to load template return the loaded template or a cached template you use this function to get templates by name when needed.
  4. You have the template you only need to invoke template execute with an writer, passing a var map and the context.
  5. Done!

Dynamic

Templates can extends a template and import blocks from another and every thing just works, in that way you can create a template library, layout templates and the application templates extending a layout and importing blocks like menu, buttons from library template.

Fast and light

The engine was design to be fast and light we can do that by avoid unnecessary allocations and a fast runtime.

Useful error messages

All error messages are tied to the file and line of the node executing the action or expression, and all message are descriptive in than way you can know exactly what is wrong.

Template inheritance

In Jet you can extends, import and include templates.

  • When extends all blocks from the template that you extends will be available for you even the ones that he import or extends, and when you extends a template when you execute the template the root of the extended template is used as the entry point
  • When import a template all blocks of the imported template will be available in your template.
  • When include the template is invoked all blocks available in your template will be available in the include template.
Clone this wiki locally