-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path__init__.py
More file actions
51 lines (46 loc) · 1.78 KB
/
Copy path__init__.py
File metadata and controls
51 lines (46 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# --------------------------------------------------------------------------
# Ibis: a lightweight template engine.
#
# How it works: A lexer transforms a template string into an iterable
# sequence of tokens. A parser takes this sequence and compiles it into a
# tree of nodes. Each node has a .render() method which takes a context
# object and returns a string. The entire compiled node tree can be rendered
# by calling .render() on the root node.
#
# Compiling and rendering the node tree are two distinct processes. Once
# the template has been compiled it can be cached and rendered multiple times
# with different context objects.
#
# The Template class acts as the public interface to the template engine.
# This is the only class the end-user needs to interact with directly.
#
# A Template object is initialized with a template string. It compiles the
# string and stores the resulting node tree for future rendering. Calling the
# template object's .render() method with a dictionary of key-value pairs or
# a set of keyword arguments renders the template and returns the result as a
# string.
#
# Example:
#
# >>> template = Template('{{foo}} and {{bar}}')
#
# >>> template.render(foo='ham', bar='eggs')
# 'ham and eggs'
#
# >>> template.render({'foo': 1, 'bar': 2})
# '1 and 2'
#
# Author: Darren Mulholland <darren@mulholland.xyz>
# License: Public Domain
# --------------------------------------------------------------------------
# Library version number.
__version__ = "1.6.0"
# Import modules to make them available to callers via a simple 'import ibis'
# statement. Otherwise callers would have to 'import.foo' for each
# individual module.
from . import config
from . import filters
from . import nodes
from . import loaders
from . import errors
from .templates import Template