1HTMLDocument.readFromTemplate(K3akyaayam)odule reHfTeMrLeDnocceument.readFromTemplate(3kaya)
2
3
4
6 HTMLDocument::readFromTemplate - Convert a HTML template to HTML
7
9 Void readFromTemplate( ElementTree location, String input, WhiteList
10 safety, Doctype doctype, Dict<String, ElementTree([Pair<String, String>
11 ])> templates, Bool lazy=true )
12
14 location The location in the document to append the converted String
15
16 input The String to convert
17
18 safety The allowed elements and attributes
19
20 doctype The document type of the input string. This is independent of
21 the document type of the document and controls certain aspects of pars‐
22 ing - for example, if the doctype is HTML4Strict , the end tags for p
23 or td elements may be omitted, and the code will be case-insensitive.
24 As usual, parsing with XHTML strictness will be quicker. The TagSoup
25 option is equivalent to HTML4Strict - templates should be good quality!
26
27 templates A dictionary of templating functions. The key is the name of
28 the templating tag, and the value is the function to call upon seeing
29 that tag (which will be passed the templating tags attributes as a list
30 of pairs).
31
32 lazy Evaluate templates lazily. Enabling this will reduce memory usage,
33 especially in complex nested templates, but may cause problems if the
34 templates have side effects or use global variables. Set this option to
35 false to evaluate templates immediately. This argument is optional and
36 defaults to true
37
38
40 Convert a HTML template String to HTML. An Exception will be thrown if
41 the parser cannot construct an unambiguous tree from the string, and it
42 is considerably less forgiving than the parsers in most web browsers.
43 (On the other hand, it's a bit more forgiving in places than a strict
44 XML parser, especially if the HTML4Strict doctype is used).
45
46 A HTML template String contains empty tags with user-defined names.
47 These tags are then replaced with the output of the function defined
48 for that tag in the templates dictionary.
49
50 Read the HTMLDocument.WhiteList (3kaya) documentation for important
51 information on safety when converting these Strings, and bear in mind
52 that allowing user-supplied data to call templating functions is only
53 as secure as the allowed templating functions.
54
56 Kaya standard library by Edwin Brady, Chris Morris and others
57 (kaya@kayalang.org). For further information see http://kayalang.org/
58
60 The Kaya standard library is free software; you can redistribute it
61 and/or modify it under the terms of the GNU Lesser General Public
62 License (version 2.1 or any later version) as published by the Free
63 Software Foundation.
64
66 HTMLDocument.Doctype (3kaya)
67 HTMLDocument.WhiteList (3kaya)
68 HTMLDocument.readFromString (3kaya)
69 HTMLDocument.string (3kaya)
70
71
72
73Kaya December 2H0T1M0LDocument.readFromTemplate(3kaya)