Quart API
The Quart integration provides async-compatible functions for rendering blocks from Jinja2 templates within Quart applications.
API Reference
- async jinja2_fragments.quart.render_block(template_name, block_name, **context)[source]
Render a single block from a specified template asynchronously.
This function renders a specific block within a template located in the template folder, using the provided context variables. It leverages Quart’s asynchronous functionality.
- Parameters:
template_name (
str) – The name of the template containing the block to render.block_name (
str) – The name of the block to render.**context (
Any) – Keyword arguments representing variables to be used as the context for the block.
- Return type:
str- Returns:
The rendered string of the specified block.
- async jinja2_fragments.quart.render_blocks(template_name, block_names, **context)[source]
Render multiple blocks from a specified template asynchronously.
This function renders multiple blocks within a template located in the template folder, using the provided context variables. It leverages Quart’s asynchronous functionality.
- Parameters:
template_name (
str) – The name of the template containing the blocks to render.block_names (
list[str]) – A list of block names to render.**context (
Any) – Keyword arguments representing variables to be used as the context for the blocks.
- Return type:
str- Returns:
The rendered string of the specified blocks.