Skip to main content

ctx.templates

Service type: TemplatesInterface (from apollia.context.templates).

TemplatesInterface​

Bases: Protocol

Runtime Jinja2 template rendering.

A template is one the context was given, addressed by its name.

render​

def render(self, name: str, **context: object) -> str

Render a declared template.

Args: name: Name of a template the context was given. **context: Variables exposed to the template.

Returns: The rendered text.

has​

def has(self, name: str) -> bool

Whether name is declared and compiled in memory.

list_names​

def list_names(self) -> list[str]

Return the names of every template the manifest declares.