# Welcome to Kajiki’s documentation!

## Kajiki provides fast well-formed XML templates

Because Kajiki’s input is XML, it can ensure that your HTML/XML output is well-formed. The Genshi-like syntax, based on XML attributes or tags, is simply beautiful and easily understood (or ignored) by web designers. But instead of the slow performance of Genshi, Kajiki compiles templates to Python code that renders with blazing-fast speed, so Kajiki can compete with the speed of Jinja, Mako, Chameleon and others. Also, one of Genshi’s misfeatures – py:match – is replaced with blocks which work like Jinja’s blocks.

By combining the best ideas out there – XML input, Genshi’s syntax and features, Jinja’s template inheritance and final compilation to Python –, Kajiki is ready to become the most widely used templating engine for web development in Python. And more features are coming soon; stay tuned!

## Example

    >>> import kajiki
    >>> Template = kajiki.XMLTemplate('''<html>
    ...     <head><title>$title</title></head>
    ...     <body>
    ...         <h1>$title</h1>
    ...         <ul>
    ...             <li py:for="x in range(repetitions)">$title</li>
    ...         </ul>
    ...     </body>
    ... </html>''')
    >>> print(Template(dict(title='Kajiki is teh awesome!', repetitions=3)).render())
    <html>
        <head><title>Kajiki is teh awesome!</title></head>
        <body>
            <h1>Kajiki is teh awesome!</h1>
            <ul>
                <li>Kajiki is teh awesome!</li><li>Kajiki is teh awesome!</li><li>Kajiki is teh awesome!</li>
            </ul>
        </body>
    </html>

## Links

Documentation

Kajiki is licensed under an MIT-style license.

The git repository and issue tracker are at GitHub. Previously the project used SourceForge for the hg repository, issue tracker and forums.

We use Travis for continuous integration.

# Documentation contents

- Kajiki Templating Basics
  - Synopsis
  - Python API
  - Template Expressions and Code Blocks
  - Template Directives
- Kajiki XML Templates
  - Output Modes
  - Basic Expressions
  - Control Flow
  - Content Generation
  - Inheritance (py:extends, py:block)
  - Built-in functions
  - Tips on writing your templates
- Kajiki Text Templates
  - Basic Expressions
  - Control Flow
  - Inheritance (%extends, %block)
- Migrating from Genshi
  - Example Migration
- Internationalization
  - Basics
  - Extraction
- Kajiki Runtime
  - Basic Expressions
  - Control Flow
  - Python Blocks
  - Functions and Imports
  - Includes
  - Inheritance

## Indices and tables

- Index
- Module Index
- Search Page