.\" This man page is automatically generated using .\" kayadoc2man from the Kaya development tools and the -xmldocs compile .\" option. Editing it directly is not encouraged. .\" It is under the same license as the source .k file that it was .\" generated from. .TH "HTMLDocument.readFromTemplate" "3kaya" "August 2014" "Kaya" "Kaya module reference" .SH "NAME" HTMLDocument::readFromTemplate \- Convert a HTML template to HTML .SH "SYNOPSIS" .B Void readFromTemplate( \fIElementTree location, String input, WhiteList safety, Doctype doctype, Dict ])> templates\fP .B ")" .SH "ARGUMENTS" .PP .B "location" The location in the document to append the converted String .PP .B "input" The String to convert .PP .B "safety" The allowed elements and attributes .PP .B "doctype" The document type of the input string. This is independent of the document type of the document and controls certain aspects of parsing - for example, if the doctype is \fBHTML4Strict \fP , the end tags for \fBp \fP or \fBtd \fP elements may be omitted, and the code will be case-insensitive. As usual, parsing with XHTML strictness will be quicker. The \fBTagSoup \fP option is equivalent to \fBHTML4Strict \fP - templates should be good quality! .PP .B "templates" A dictionary of templating functions. The key is the name of the templating tag, and the value is the function to call upon seeing that tag (which will be passed the templating tags attributes as a list of pairs). .SH "DESCRIPTION" .PP 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 \fBHTML4Strict \fP doctype is used). .PP 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 \fBtemplates \fP dictionary. .PP Read the .B "HTMLDocument.WhiteList"(3kaya) 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. .SH "AUTHORS" Kaya standard library by Edwin Brady, Chris Morris and others (kaya@kayalang.org). For further information see http://kayalang.org/ .SH LICENSE The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation. .SH "RELATED" .PD 0 .PP .B "HTMLDocument.Doctype"(3kaya) .PP .B "HTMLDocument.WhiteList"(3kaya) .PP .B "HTMLDocument.readFromString"(3kaya) .PP .B "HTMLDocument.string"(3kaya) .PD 0.4v