reportcompiler.plugins.template_renderers.base

base.py

This module includes the base plugin interface for template renderers.

Classes

  • TemplateRenderer: Plugin that implements the template rendering stage for the document (see
class reportcompiler.plugins.template_renderers.base.TemplateRenderer

Plugin that implements the template rendering stage for the document (see architecture).

Inheritance

Inheritance diagram of TemplateRenderer
get_fragment_start_comment(name)

Returns the comment that will be inserted before the fragment template.

Parameters:name (str) – fragment name
Returns:Comment to be inserted before the template
Return type:str
included_templates(content)

Returns the included templates in the specified content.

Parameters:content (str) – Template content
Returns:List of included templates
Return type:list
classmethod raise_rendering_exception(context, exception=None, message=None)

Returns a template rendering exception with the necessary info attached.

Parameters:
  • context (dict) – Context for fragment
  • exception (Exception) – Exception returned by template rendering
  • message (str) – Optional message for exception
render_template(doc_param, template_tree, context)

Renders the template after the context is generated for all fragments.

Parameters:
  • doc_param (OrderedDict) – Document variable.
  • template_tree (anytree) – Tree with the templates to be rendered.
  • context (dict) – Context dictionary with keys ‘data’ (context generated from fragments) and ‘meta’ (document metadata).