"Fossies" - the Fresh Open Source Software Archive

Member "cheetah3-3.2.6.post2/docs/index.rst" (20 Apr 2021, 3592 Bytes) of package /linux/www/cheetah3-3.2.6.post2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field. See also the last Fossies "Diffs" side-by-side code changes report for "index.rst": 3-3.2.1_vs_3-3.2.2.

A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.


Cheetah3, the Python-Powered Template Engine

Introduction

Cheetah3 is a free and open source template engine and code-generation tool written in Python. Cheetah can be used unto itself, or incorporated with other technologies and stacks regardless of whether they're written in Python or not.

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.

It's a fork of the original CheetahTemplate library.

Talk Cheetah

You can get involved and talk with Cheetah developers on the Cheetah3 issue tracker.

Contents

authors.rst news.rst developers.rst download.rst users_guide/index.rst documentation.rst roadmap.rst dev_guide/index.rst chep.rst

Cheetah in a nutshell

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 :) :

#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>

Why Cheetah?

Indices and tables