Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jonja

PyPI version PyPI downloads per mounth GitHub code size in bytes

Jinja-based texts and objects render.

Installation

pip install jonja

Usage

  1. Make template hello.j2
Hello, {{ username }}!
{% jobj cached schema %}
world:
  $cls: "types:SimpleNamespace"
  $kwargs: {name: earth, size: {{ world_size }} }
{% endjobj %}
  1. Load extension
from pathlib import Path

import jinja2 as j2
from jonja import Jonja

env = j2.Environment(..., extensions=(Jonja, ))
  1. Render
text, objs = await env.render("hello", username="mikk", world_size=10_000)

TODO

  • make di socially independent (allow multiple instances of ext with different di container instances)

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages