summaryrefslogtreecommitdiff
path: root/index.html
blob: eb0640b4a2f5ed5ae3bc6b3effd8dd1a98f120a1 (plain)
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
<!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="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Cheetah, the Python-Powered Template Engine &mdash; Cheetah - 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">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '2.2.1',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="static/jquery.js"></script>
    <script type="text/javascript" src="static/doctools.js"></script>
    <link rel="top" title="Cheetah - The Python-Powered Template Engine" href="" />
    <link rel="next" title="Contributing to Cheetah" href="developers.html" /> 
  </head>
  <body>
    <div class="related">
      <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="developers.html" title="Contributing to Cheetah"
             accesskey="N">next</a> |</li>
        <li><a href="">Cheetah - The Python-Powered Template Engine</a> &raquo;</li> 
      </ul>
    </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="">Cheetah, the Python-Powered Template Engine</a><ul>
<li><a class="reference external" href="#introduction">Introduction</a><ul>
<li><a class="reference external" href="#talk-cheetah">Talk Cheetah</a></li>
<li><a class="reference external" href="#contents">Contents</a><ul>
</ul>
</li>
</ul>
</li>
<li><a class="reference external" href="#cheetah-in-a-nutshell">Cheetah in a nutshell</a></li>
<li><a class="reference external" href="#why-cheetah">Why Cheetah?</a></li>
<li><a class="reference external" href="#indices-and-tables">Indices and tables</a></li>
</ul>
</li>
</ul>

            <h4>Next topic</h4>
            <p class="topless"><a href="developers.html"
                                  title="next chapter">Contributing to Cheetah</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="sources/index.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="cheetah-the-python-powered-template-engine">
<h1>Cheetah, the Python-Powered Template Engine<a class="headerlink" href="#cheetah-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>Cheetah is an <a class="reference external" href="https://github.com/rtyler/cheetah/tree">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&#8217;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>
<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="http://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss">Cheetah mailing list</a>
(<em>cheetahtemplate-discuss&#64;lists.sourceforge.net</em>) or on the <strong>IRC</strong> channel:
<strong>#cheetah</strong> on <a class="reference external" href="http://freenode.net/">Freenode</a></p>
</div>
<div class="section" id="contents">
<h3>Contents<a class="headerlink" href="#contents" title="Permalink to this headline">¶</a></h3>
<ul>
<li class="toctree-l1"><a class="reference external" href="developers.html">Contributing to Cheetah</a></li>
<li class="toctree-l1"><a class="reference external" href="download.html">Downloading Cheetah</a></li>
<li class="toctree-l1"><a class="reference external" href="roadmap.html">Cheetah Roadmap</a></li>
<li class="toctree-l1"><a class="reference external" href="documentation.html">User Documentation</a></li>
<li class="toctree-l1"><a class="reference external" href="chep.html">Cheetah Enhancement Proposals</a></li>
</ul>
</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&#8217;s practically
Python. You can import, inherit and define methods just like in a regular Python
module, since that&#8217;s what your Cheetah templates are compiled to :)</p>
<div class="highlight-python"><pre>#from Cheetah.Template import Template
#extends Template

#set $people = [{'name' : 'Tom', 'mood' : 'Happy'}, {'name' : 'Dick',
                        'mood' : 'Sad'}, {'name' : 'Harry', 'mood' : 'Hairy'}]

&lt;strong&gt;How are you feeling?&lt;/strong&gt;
&lt;ul&gt;
    #for $person in $people
        &lt;li&gt;
            $person['name'] is $person['mood']
        &lt;/li&gt;
    #end for
&lt;/ul&gt;</pre>
</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 external" href="genindex.html"><em>Index</em></a></li>
<li><a class="reference external" href="modindex.html"><em>Module Index</em></a></li>
<li><a class="reference external" href="search.html"><em>Search Page</em></a></li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <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="developers.html" title="Contributing to Cheetah"
             >next</a> |</li>
        <li><a href="">Cheetah - The Python-Powered Template Engine</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2009, R. Tyler Ballance.
      Last updated on Jul 16, 2009.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
    </div>
  </body>
</html>