Metadata-Version: 2.4
Name: xylo.py
Version: 0.2.0
Summary: A powerful template engine with Python expression evaluation
License-Expression: MIT
Project-URL: Homepage, https://github.com/yourusername/xylo
Project-URL: Repository, https://github.com/yourusername/xylo
Project-URL: Issues, https://github.com/yourusername/xylo/issues
Keywords: template,templating,text processing,markup
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
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 :: Text Processing :: Markup
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Dynamic: license-file

# Xylo

A powerful template engine with Python expression evaluation.

## Installation

```bash
pip install xylo.py
```

## Usage

```python
from xylo import xylo

# Basic expressions
xylo("text $(1 + 5)")  # "text 6"

# Variables via context
xylo("Hello $(name)!", {"name": "World"})  # "Hello World!"

# Conditionals
xylo("$if(x > 5) Big $else Small $end", {"x": 10})  # " Big "

# Loops
xylo("$for(i in range(3)) $(i) $end")  # " 0  1  2 "

# Functions
xylo('$function(greet, name) Hello, $(name)! $end $call(greet, "World")')  # "  Hello, World! "
```

## Features

- **Expressions**: `$(expression)` - Evaluate and insert Python expressions
- **Exec**: `$exec(code)` - Execute Python code without output
- **Conditionals**: `$if(cond) ... $elif(cond) ... $else ... $end`
- **Loops**: `$for(var in iterable) ... $end`, `$while(cond) ... $end`
- **Functions**: `$function(name, args) ... $end` and `$call(name, args)`
- **Include**: `$include("file.sdf", key=value, ...)` - Include and render another template
- **Import**: `$import("file.sdf", key=value, ...)` - Import and render another template without the current context
- **Switch**: `$switch(expr) $case(val) ... $default ... $end`
- **Error handling**: `$try ... $catch(e) ... $end`, `$raise(msg)`, `$assert(cond)`
- **Context managers**: `$with(expr as var) ... $end`
- **Control flow**: `$break`, `$continue`, `$return`

## License

MIT

