asphalt.templating.api
¶
-
class
asphalt.templating.api.
TemplateRenderer
¶ Abstract base class for template renderers.
-
class
asphalt.templating.api.
TemplateRendererProxy
(ctx: asphalt.core.context.Context, renderer: asphalt.templating.api.TemplateRenderer)¶ Context-bound template renderer proxy.
Adds the bound context to the variables passed to
render()
asctx
, unless a variable by that name was explicitly passed.Any variables and methods provided by the underlying renderer can be directly accessed through this proxy object.
-
render
(template, **vars)¶ Render the named template.
The current context will be available to the template as the
ctx
variable.Parameters: - template (
str
) – name of the template file - vars – extra template variables
Return type: Returns: the rendered results
- template (
-
render_string
(source, **vars)¶ Render the template contained in the given string.
The current context will be available to the template as the
ctx
variable.Parameters: - source (
str
) – content of the template to render - vars – extra variables made available to the template
Return type: Returns: the rendered results
- source (
-