-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
255 lines (246 loc) · 15.8 KB
/
index.html
File metadata and controls
255 lines (246 loc) · 15.8 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cheetah3, the Python-Powered Template Engine — Cheetah3 - The Python-Powered Template Engine</title>
<link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Authors and contributors" href="authors.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="authors.html" title="Authors and contributors"
accesskey="N">next</a> |</li>
<li class="nav-item nav-item-0"><a href="#">Cheetah3 - The Python-Powered Template Engine</a> »</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="#">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Cheetah3, the Python-Powered Template Engine</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a><ul>
<li><a class="reference internal" href="#talk-cheetah">Talk Cheetah</a></li>
<li><a class="reference internal" href="#contents">Contents</a></li>
</ul>
</li>
<li><a class="reference internal" href="#cheetah-in-a-nutshell">Cheetah in a nutshell</a></li>
<li><a class="reference internal" href="#why-cheetah">Why Cheetah?</a></li>
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
</ul>
</li>
</ul>
<h4>Next topic</h4>
<p class="topless"><a href="authors.html"
title="next chapter">Authors and contributors</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/index.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="cheetah3-the-python-powered-template-engine">
<h1>Cheetah3, the Python-Powered Template Engine<a class="headerlink" href="#cheetah3-the-python-powered-template-engine" title="Permalink to this headline">¶</a></h1>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>Cheetah3 is a free and <a class="reference external" href="https://github.com/CheetahTemplate3/cheetah3">open source</a> template engine and
code-generation tool written in <a class="reference external" href="http://python.org">Python</a>. Cheetah can be
used unto itself, or incorporated with other technologies and stacks regardless
of whether they’re written in Python or not.</p>
<p>At its core, Cheetah is a domain-specific language for markup generation and
templating which allows for full integration with existing Python code but also
offers extensions to traditional Python syntax to allow for easier text-generation.</p>
<p>It’s a fork of the <a class="reference external" href="https://github.com/cheetahtemplate/cheetah">original</a>
CheetahTemplate library.</p>
<div class="section" id="talk-cheetah">
<h3>Talk Cheetah<a class="headerlink" href="#talk-cheetah" title="Permalink to this headline">¶</a></h3>
<p>You can get involved and talk with Cheetah developers on the <a class="reference external" href="https://github.com/CheetahTemplate3/cheetah3/issues">Cheetah3 issue
tracker</a>.</p>
</div>
<div class="section" id="contents">
<h3>Contents<a class="headerlink" href="#contents" title="Permalink to this headline">¶</a></h3>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="authors.html">Authors and contributors</a></li>
<li class="toctree-l1"><a class="reference internal" href="news.html">News</a><ul>
<li class="toctree-l2"><a class="reference internal" href="news.html#post5-2025-11-29">3.4.0.post5 (2025-11-29)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id1">3.4.0 (2024-12-02)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#post1-2024-02-28">3.3.3.post1 (2024-02-28)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id2">3.3.3 (2023-10-22)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id3">3.3.2 (2023-08-08)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id4">3.3.1 (2022-12-25)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#post1-2022-11-26">3.3.0.post1 (2022-11-26)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id5">3.3.0 (2022-10-10)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#b1-2021-07-25">3.2.7b1 (2021-07-25)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#post1-2021-02-22">3.2.6.post1 (2021-02-22)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id6">3.2.6 (2020-10-01)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id7">3.2.5 (2020-05-16)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id8">3.2.4 (2019-10-22)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id9">3.2.3 (2019-05-10)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id10">3.2.2 (2019-04-29)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id11">3.2.1 (2019-03-19)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id12">3.2.0 (2019-02-06)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id13">3.1.0 (2018-03-03)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id14">3.0.1 (2018-02-27)</a></li>
<li class="toctree-l2"><a class="reference internal" href="news.html#id15">3.0.0 (2017-05-07)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="developers.html">Contributing to Cheetah</a><ul>
<li class="toctree-l2"><a class="reference internal" href="developers.html#getting-the-code">Getting the Code</a></li>
<li class="toctree-l2"><a class="reference internal" href="developers.html#development-process">Development Process</a></li>
<li class="toctree-l2"><a class="reference internal" href="developers.html#filing-bugs">Filing Bugs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="download.html">Downloading Cheetah</a></li>
<li class="toctree-l1"><a class="reference internal" href="users_guide/index.html">Cheetah User’s Guide</a><ul>
<li class="toctree-l2"><a class="reference internal" href="users_guide/intro.html">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/glossary.html">Vocabulary</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/gettingStarted.html">Getting Started</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/language.html">Language Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/comments.html">Comments</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/output.html">Generating, Caching and Filtering Output</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/inheritanceEtc.html">Import, Inheritance, Declaration and Assignment</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/flowControl.html">Flow Control</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/errorHandling.html">Error Handling</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/parserInstructions.html">Instructions to the Parser/Compiler</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/tipsAndTricks.html">Tips, Tricks and Troubleshooting</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/webware.html">Using Cheetah with Webware</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/otherHtml.html">non-Webware HTML output</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/nonHtml.html">Non-HTML Output</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/libraries.html">Batteries included: templates and other libraries</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/editors.html">Visual Editors</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/links.html">Useful Web Links</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/examples.html">Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="users_guide/comparisons.html">Cheetah vs. Other Template Engines</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="documentation.html">Cheetah Recipes</a><ul>
<li class="toctree-l2"><a class="reference internal" href="recipes/inheritance.html">Basic Inheritance</a></li>
<li class="toctree-l2"><a class="reference internal" href="recipes/precompiled.html">Precompiled Templates</a></li>
<li class="toctree-l2"><a class="reference internal" href="recipes/staticmethod.html">@staticmethod and @classmethod</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="roadmap.html">Cheetah Roadmap</a><ul>
<li class="toctree-l2"><a class="reference internal" href="roadmap.html#cheetah-v3">Cheetah v3</a></li>
<li class="toctree-l2"><a class="reference internal" href="roadmap.html#cheetah-v2">Cheetah v2</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="dev_guide/index.html">Cheetah Developer’s Guide</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dev_guide/index.html#overview">Overview</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="chep.html">Cheetah Enhancement Proposals</a><ul>
<li class="toctree-l2"><a class="reference internal" href="chep.html#existing-cheps">Existing CHEPs</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="section" id="cheetah-in-a-nutshell">
<h2>Cheetah in a nutshell<a class="headerlink" href="#cheetah-in-a-nutshell" title="Permalink to this headline">¶</a></h2>
<p>Below is a simple example of some Cheetah code, as you can see it’s practically
Python. You can import, inherit and define methods just like in a regular Python
module, since that’s what your Cheetah templates are compiled to :)</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>#from Cheetah.Template import Template
#extends Template
#set $people = [{'name' : 'Tom', 'mood' : 'Happy'}, {'name' : 'Dick',
'mood' : 'Sad'}, {'name' : 'Harry', 'mood' : 'Hairy'}]
<strong>How are you feeling?</strong>
<ul>
#for $person in $people
<li>
$person['name'] is $person['mood']
</li>
#end for
</ul>
</pre></div>
</div>
</div>
<div class="section" id="why-cheetah">
<h2>Why Cheetah?<a class="headerlink" href="#why-cheetah" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li>Cheetah is supported by every major Python web framework.</li>
<li>It is fully documented and is supported by an active user community.</li>
<li>It can output/generate any text-based format.</li>
<li>Cheetah compiles templates into optimized, yet readable, Python code.</li>
<li>It blends the power and flexibility of Python with a simple template language that non-programmers can understand.</li>
<li>It gives template authors full access to any Python data structure, module, function, object, or method in their templates. Meanwhile, it provides a way for administrators to selectively restrict access to Python when needed.</li>
<li>Cheetah makes code reuse easy by providing an object-oriented interface to templates that is accessible from Python code or other Cheetah templates. One template can subclass another and selectively reimplement sections of it. Cheetah templates can be subclasses of any Python class and vice-versa.</li>
<li>It provides a simple, yet powerful, caching mechanism that can dramatically improve the performance of a dynamic website.</li>
<li>It encourages clean separation of content, graphic design, and program code. This leads to highly modular, flexible, and reusable site architectures, shorter development time, and HTML and program code that is easier to understand and maintain. It is particularly well suited for team efforts.</li>
<li>Cheetah can be used to generate static html via its command-line tool.</li>
</ul>
</div>
<div class="section" id="indices-and-tables">
<h2>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></li>
<li><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></li>
<li><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="authors.html" title="Authors and contributors"
>next</a> |</li>
<li class="nav-item nav-item-0"><a href="#">Cheetah3 - The Python-Powered Template Engine</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2017-2025, Oleg Broytman; 2009-2012, R. Tyler Croy; 2001-2008, The Cheetah Development Team..
Last updated on Nov 29, 2025.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.6.
</div>
</body>
</html>