Classes
Template API

Classes

class  TemplateVariant
 Variant type which can hold one value of a fixed set of types. More...
 
class  TemplateAutoRef< T >
 
class  TemplateListIntf
 Abstract read-only interface for a context value of type list. More...
 
class  TemplateList
 Default implementation of a context value of type list. More...
 
class  TemplateStructIntf
 Abstract interface for a context value of type struct. More...
 
class  TemplateStruct
 Default implementation of a context value of type struct. More...
 
class  TemplateEscapeIntf
 Interface used to escape characters in a string. More...
 
class  TemplateSpacelessIntf
 Interface used to remove redundant spaces inside a spaceless block. More...
 
class  TemplateContext
 Abstract interface for a template context. More...
 
class  Template
 Abstract interface for a template. More...
 
class  TemplateEngine
 Engine to create templates and template contexts. More...
 

Detailed Description

This is the API for a Django compatible template system written in C++. It is somewhat inspired by Stephen Kelly's Grantlee.

A template is simply a text file. A template contains variables, which get replaced with values when the template is evaluated, and tags, which control the logic of the template.

Variables look like this: {{ variable }} When the template engine encounters a variable, it evaluates that variable and replaces it with the result. Variable names consist of any combination of alphanumeric characters and the underscore ("_"). Use a dot (.) to access attributes of a structured variable.

One can modify variables for display by using filters, for example: {{ value|default:"nothing" }}

Tags look like this: {% tag %}. Tags are more complex than variables: Some create text in the output, some control flow by performing loops or logic, and some load external information into the template to be used by later variables.

To comment-out part of a line in a template, use the comment syntax: {# comment text #}.

Supported Django tags:

Extension tags:

Supported Django filters:

Extension filters: