##// END OF EJS Templates
templater: add brief doc about internal data types...
Yuya Nishihara -
r37032:a5311d7f default
parent child Browse files
Show More
@@ -5,6 +5,47 b''
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 """Slightly complicated template engine for commands and hgweb
9
10 This module provides low-level interface to the template engine. See the
11 formatter and cmdutil modules if you are looking for high-level functions
12 such as ``cmdutil.rendertemplate(ctx, tmpl)``.
13
14 Internal Data Types
15 -------------------
16
17 Template keywords and functions take a dictionary of current symbols and
18 resources (a "mapping") and return result. Inputs and outputs must be one
19 of the following data types:
20
21 bytes
22 a byte string, which is generally a human-readable text in local encoding.
23
24 generator
25 a lazily-evaluated byte string, which is a possibly nested generator of
26 values of any printable types, and will be folded by ``stringify()``
27 or ``flatten()``.
28
29 BUG: hgweb overloads this type for mappings (i.e. some hgweb keywords
30 returns a generator of dicts.)
31
32 None
33 sometimes represents an empty value, which can be stringified to ''.
34
35 True, False, int, float
36 can be stringified as such.
37
38 date tuple
39 a (unixtime, offset) tuple, which produces no meaningful output by itself.
40
41 hybrid
42 represents a list/dict of printable values, which can also be converted
43 to mappings by % operator.
44
45 mappable
46 represents a scalar printable value, also supports % operator.
47 """
48
8 49 from __future__ import absolute_import, print_function
9 50
10 51 import os
General Comments 0
You need to be logged in to leave comments. Login now