betty.jinja2 package¶
Submodules¶
- betty.jinja2.filter module
- betty.jinja2.filter.filter_base64
- betty.jinja2.filter.filter_file
- betty.jinja2.filter.filter_flatten
- betty.jinja2.filter.filter_format_datey
- betty.jinja2.filter.filter_format_degrees
- betty.jinja2.filter.filter_image
- betty.jinja2.filter.filter_json
- betty.jinja2.filter.filter_localize
- betty.jinja2.filter.filter_map
- betty.jinja2.filter.filter_negotiate_dateds
- betty.jinja2.filter.filter_negotiate_localizeds
- betty.jinja2.filter.filter_paragraphs
- betty.jinja2.filter.filter_select_dateds
- betty.jinja2.filter.filter_select_localizeds
- betty.jinja2.filter.filter_sort_localizeds
- betty.jinja2.filter.filter_static_url
- betty.jinja2.filter.filter_unique
- betty.jinja2.filter.filter_url
- betty.jinja2.filter.filter_walk
- betty.jinja2.test module
- betty.jinja2.test.test_date_range
- betty.jinja2.test.test_end_of_life_event
- betty.jinja2.test.test_entity
- betty.jinja2.test.test_has_files
- betty.jinja2.test.test_has_generated_entity_id
- betty.jinja2.test.test_has_links
- betty.jinja2.test.test_linked_data_dumpable
- betty.jinja2.test.test_start_of_life_event
- betty.jinja2.test.test_subject_role
- betty.jinja2.test.test_user_facing_entity
- betty.jinja2.test.test_witness_role
Module contents¶
Provide rendering utilities using Jinja2.
- class betty.jinja2.Environment(app)[source]¶
Bases:
Environment- filters : --is-rst--dict[str, Callable[..., Any]]¶
- globals : --is-rst--dict[str, Any]¶
- tests : --is-rst--dict[str, Callable[..., bool]]¶
- class betty.jinja2.Jinja2Provider[source]¶
Bases:
object- property filters : dict[str, Callable[[...], Any]]¶
- property globals : dict[str, Any]¶
- property tests : dict[str, Callable[[...], bool]]¶
- class betty.jinja2.Jinja2Renderer(environment, configuration)[source]¶
Bases:
Renderer- property file_extensions : set[str]¶
- class betty.jinja2.Template(source: str | ~jinja2.nodes.Template, block_start_string: str = '{%', block_end_string: str = '%}', variable_start_string: str = '{{', variable_end_string: str = '}}', comment_start_string: str = '{#', comment_end_string: str = '#}', line_statement_prefix: str | None = None, line_comment_prefix: str | None = None, trim_blocks: bool = False, lstrip_blocks: bool = False, newline_sequence: te.Literal['\n', '\r\n', '\r'] = '\n', keep_trailing_newline: bool = False, extensions: ~typing.Sequence[str | ~typing.Type[Extension]] = (), optimized: bool = True, undefined: ~typing.Type[~jinja2.runtime.Undefined] = <class 'jinja2.runtime.Undefined'>, finalize: ~typing.Callable[[...], ~typing.Any] | None = None, autoescape: bool | ~typing.Callable[[str | None], bool] = False, enable_async: bool = False)[source]¶
Bases:
Template- environment : --is-rst--Environment¶
- environment_class¶
alias of
Environment
-
new_context(vars=
None, shared=False, locals=None)[source]¶ Create a new
Contextfor this template. The vars provided will be passed to the template. Per default the globals are added to the context. If shared is set to True the data is passed as is to the context without adding the globals.locals can be a dict of local variables for internal usage.
- betty.jinja2.context_app(context)[source]¶
Get the current app from the Jinja2 context.