eds4jinja2.builders package

Submodules

eds4jinja2.builders.jinja_builder module

build_eds_environment(external_data_source_builders={'add_relative_figures': <function <lambda>>, 'from_endpoint': <function <lambda>>, 'from_file': <function <lambda>>, 'from_rdf_file': <function <lambda>>, 'invert_dict': <function <lambda>>, 'namespace_inventory': <function <lambda>>, 'replace_strings_in_tabular': <function <lambda>>, 'simplify_uri_columns_in_tabular': <function <lambda>>}, external_filters={'escape_latex': <function <lambda>>}, **kwargs)[source]

creates a JINJA environment and injects the global context with EDS functions

Parameters
  • external_filters – additional filters to be make available in the templates

  • external_data_source_builders – additional instructions to be made available in the templates

  • kwargs

Returns

inject_environment_filters(jinja_environment: jinja2.environment.Environment, filters: dict, update_existent=True)[source]

Inject the filters into JINJA2 environment making them globally available from any template. Updates in place the filter environment dictionary by adding non existent keys from another dictionary. If the dictionary keys exist then they are replaced depending whether the update_existent flag is set.

Parameters
  • update_existent – whether the overlapping values shall be overwritten

  • filters – additional filters to be injected

  • jinja_environment – JINJA environment to be updated

Returns

inject_environment_globals(jinja_environment: jinja2.environment.Environment, context: dict, update_existent=True)[source]

Inject the context into JINJA2 environment making it globally available from any template. Updates in place the global environment dictionary by adding non existent keys from another dictionary. If the keys exist then they are replaced depending whether the update_existent flag is set.

Parameters
  • update_existent – whether the overlapping values shall be overwritten

  • context – additional context to be injected

  • jinja_environment – JINJA environment to be updated

Returns

eds4jinja2.builders.report_builder module

this module implements the report generation functionality.

class ReportBuilder(target_path: Union[str, pathlib.Path], config_file: str = 'config.json', output_path: Optional[str] = None, additional_config: dict = {})[source]

Bases: object

generic report builder that takes templates and configuration as input and produces an output report

configuration_context: dict = {}
add_before_rendering_listener(listener)[source]

At the moment there is no use for this.

add_after_rendering_listener(listener)[source]

At the moment, this is used just to copy static files to the output directory. For example, CSS, JavaScript and other static resources.

__get_template(template_name=None) jinja2.environment.Template

Standard JINJA2 get_template() functionality.

Parameters

template_name

Returns

make_document()[source]

eds4jinja2.builders.report_builder_actions module

This file contains the post-processing methods that you can use in conjunction with the ReportBuilder:

  1. make_pdf_from_latex - allows you, after you rendered a “.tex” file from a template, to make a PDF file out of it

2.copy_static_content - it simply does what it says, copies resources from the static resources folder to the output folder (for example, in case of a more complex rendered HTML, you will need this to copy .css, .js and other files); the input directory structure is preserved to the output folder during copying

make_pdf_from_latex(configuration_context: dict = {}) None[source]
Return type

None :param configuration_context: the configuration context of the renderer; in this method it is used

to construct the output PDF file name

LaTex will have to run 4 times to ensure proper output results (unfortunately this is a multi pass build process)

copy_static_content(configuration_context: dict) None[source]
Parameters

configuration_context – the configuration context for the currently executing processing pipeline

Return type

None

Module contents