Metadata-Version: 2.4
Name: pytenjin
Version: 1.0.0
Summary: A fast and full-featured template engine based on embedded Python (maintained fork)
Author-email: Hyun-Gyu Kim <babyworm@gmail.com>
Maintainer-email: Hyun-Gyu Kim <babyworm@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/babyworm/pytenjin
Project-URL: Repository, https://github.com/babyworm/pytenjin
Project-URL: Issues, https://github.com/babyworm/pytenjin/issues
Project-URL: Changelog, https://github.com/babyworm/pytenjin/blob/main/CHANGES.md
Keywords: template,engine,tenjin,embedded python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: yaml
Requires-Dist: PyYAML>=5.1; extra == "yaml"
Dynamic: license-file

[![PyPI version](https://badge.fury.io/py/pytenjin.svg)](https://pypi.org/project/pytenjin/)
[![Python versions](https://img.shields.io/pypi/pyversions/pytenjin.svg)](https://pypi.org/project/pytenjin/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

# PyTenjin

This is a maintained fork of the original [Tenjin](https://github.com/kwatch/tenjin) template engine, which is no longer actively maintained.

Original project: https://pypi.org/project/Tenjin/

## About

PyTenjin is a very fast and full-featured template engine. You can embed Python statements and expressions into your template file. PyTenjin converts it into Python script and evaluates it.

## Features

- **Very fast**: Approximately 10x faster than Django, 4x faster than Cheetah, 2x faster than Mako
- **Full featured**:
  - Nestable layout templates
  - Partial templates
  - Fragment caching
  - Capturing
  - Preprocessing
- **Easy to learn**: Simple and intuitive syntax

## Installation

```bash
pip install pytenjin
```

## Quick Example

**Template file (table.pyhtml):**

```html
<?py #@ARGS items ?>
<table>
  <?py for item in items: ?>
  <tr>
    <td>{=item=}</td>
  </tr>
  <?py #end ?>
</table>
```

**Python code:**

```python
import tenjin
from tenjin.helpers import *

engine = tenjin.Engine()
context = {'items': ['AAA', 'BBB', 'CCC']}
html = engine.render('table.pyhtml', context)
print(html)
```

**Output:**

```html
<table>
  <tr>
    <td>AAA</td>
  </tr>
  <tr>
    <td>BBB</td>
  </tr>
  <tr>
    <td>CCC</td>
  </tr>
</table>
```

## Template Syntax

PyTenjin supports multiple expression syntaxes:

- **`{=...=}`** - escaped expression (recommended)
- **`{==...==}`** - raw expression (recommended)
- `${...}` - escaped expression (deprecated)
- `#{...}` - raw expression (deprecated)

> **Note:** The `${...}` and `#{...}` syntax is deprecated and will be removed in a future version. Please use `{=...=}` and `{==...==}` instead.

## License

MIT License

Original copyright by kuwata-lab.com
