Kaya 0.5.2 reference for HTMLDocument::readFromTemplate

List of functions and data types in HTMLDocument

Void readFromTemplate(ElementTree location, String input, WhiteList safety, Doctype doctype, Dict<String, ElementTree([Pair<String, String> ])> templates, Bool lazy=true)

Arguments

Usage

Convert a HTML template String to HTML. An Exception will be thrown if the parser cannot construct an unambiguous tree from the string, and it is considerably less forgiving than the parsers in most web browsers. (On the other hand, it's a bit more forgiving in places than a strict XML parser, especially if the HTML4Strict doctype is used).

A HTML template String contains empty tags with user-defined names. These tags are then replaced with the output of the function defined for that tag in the templates dictionary.

Read the WhiteList documentation for important information on safety when converting these Strings, and bear in mind that allowing user-supplied data to call templating functions is only as secure as the allowed templating functions.

Related

kaya@kayalang.org | Last modified 29 November 2011 | Supported by Durham CompSoc | Powered by Kaya