Haplo Safe View Templates

Haplo plugins use HSVT templates to render their user interface. Templates are usually rendered when responding to an HTTP request.

HSVT is designed to be a safe templating language which cannot output invalid HTML and prevents security flaws like XSS. It does this by understanding the structure of HTML, and always applies the correct escaping.

It’s also designed to make generating HTML as simple and easy as possible. Tasks like URL generation and conditionally includes tag class attributes is handled by HSVT.

HSVT has a simple structure made up of view property names which insert values from the view, HTML tags, literal strings, and template functions.

Template functions implement control flow, rendering of commit HTML widgets, and include additional templates.

Directory layout

Templates are stored in the template (singular) directory as files with the .hsvt extension. See Directory structure.

To get a Template object to use for rendering, call template() on your Plugin object. The name is the name of the file (without the extension) within the template directory, or one of a standard template beginning std:.

The kind of template, available in the kind property of the Template object, is derived from the extension of the template file. This will be used to set the MIME type of the response when rendered with the render() function of Exchange.

To produce the output from the template as a String, call render() on the Template object, passing in a view object.