Metadata-Version: 2.4
Name: bobtail-jinja2
Version: 0.0.2
Summary: Use Jinja2 templating engine with Bobtail
Home-page: https://github.com/joegasewicz/bobtail-jinja2
Author: Joe Gasewicz
Author-email: joegasewicz@gmail.com
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: bobtail
Requires-Dist: jinja2
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# bobtail-jinja2
Bobtail middleware for Jinja2 templating

### Install
```bash
pip install bobtail-jinja2
```

### Usage
```python
from bobtail_jinja2 import BobtailJinja2, Response

app = Bobtail(routes=routes)

app.use(BobtailJinja2(template_dir="templates"))
```

Render the template in a Bobtail handler. BobtailJinja2 provides a Bobtail handler
`Response` type that also include the Jinja2 template attribute for IntelliSense etc.
```python
from bobtail import AbstractRoute, Request
from bobtail_jinja2 import BobtailJinja2, Response
class HomeRoute(AbstractRoute):

    def get(self, req: Request, res: Response) -> None:
        res.set_headers({
            "Content-Type": "text/plain",
        })
        res.jinja2.render(res, "routes/home.jinja2", data={"title": "Welcome to Lanka Note"})
```
