Metadata-Version: 2.4
Name: cuteninja
Version: 0.1.2
Summary: KDL as HTML replacement for Jinja2 templates
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
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: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ckdl>=0.1.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Dynamic: license-file

# cuteninja

A python package that allows you to use [KDL](https://kdl.dev) as the markup
with Jinja2 syntax support.

Why? Because KDL is much more readable than HTML. While looking through
the KDL repository I found a example file that used KDL as an alternative
of HTML. That was what give me the initial idea of using KDL as the markup
with Jinja in Python for succint and maintainable template.

This packages doesn't do much, it extract the Jinja syntax from source files
and then parses the KDL via kdl-rs which generates the HTML. The previously
extracted Jinja syntax is restored and returned as valid HTML with Jinja
syntax. i.e.

```kdl
!DOCTYPE html
html lang=en {
    head {
        title "{{ page_title }}"
    }
    body {
        h1 "Hello, {{ user.name }}!"
        {% if user.is_authenticated %}
        div class=content {
            p "You are logged in."
        }
        {% else %}
        div class=login {
            a href="/login" "Please log in"
        }
        {% endif %}
    }
}
```

is turned to the following:

```jinja
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>{{ page_title }}</title>
    </head>
    <body>
        <h1>Hello, {{ user.name }}!</h1>
        {% if user.is_authenticated %}
        <div class="content">
            <p>You are logged in.</p>
        </div>
        {% else %}
        <div class="login">
            <a href="/login">Please log in</a>
        </div>
        {% endif %}
    </body>
</html>
```

## Contributing

This is an early-stage project with lots of room for improvement. You are
welcome to help out in any shape or form.

## License

MIT

## Credits

- [KDL Document Language](https://kdl.dev)
- [kdl-rs](https://github.com/kdl-org/kdl-rs)
