Skip to content

UT1C/jonja

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 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 }}!
*#!#*
world:
  $cls: "types:SimpleNamespace"
  $kwargs: {name: earth, size: {{ world_size }} }
  1. Make env
from pathlib import Path
from jonja import JonjaEnv
env = JonjaEnv(Path.cwd() / "static" / "templates")
  1. Render
text, objs = await env.render("hello", username="mikk", world_size=10_000)

TODO

  • make deepcopy of cached generated objects (maybe controlled by option on both env and render side)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages