betty.render module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.render module

Provide the Render API.

betty.render.RENDERER_REPOSITORY: PluginRepository[Renderer & Plugin] = <betty.plugin.entry_point.EntryPointPluginRepository object>

  The renderer plugin repository.

  Read more about Renderer plugins.

class betty.render.Renderer

  Bases: `ABC`

  Render content to HTML.

  Read more about Renderer plugins.

  abstract property file_extensions: set[str]

    The extensions of the files this renderer can render.

  abstract async render_file(file_path: Path, *, job_context: Context | None = None, localizer: Localizer | None = None) → Path

    Render a single file.

    Returns:

      The file’s new path, which may have been changed, e.g. a renderer-specific extension may have been stripped from the end.

final class betty.render.SequentialRenderer

  Bases: `Renderer`

  Render using a sequence of other renderers.

  This is internal. It MAY be used anywhere in Betty’s source code, but MUST NOT be used by third-party code.

  __init__(renderers: Sequence[Renderer])
  property file_extensions: set[str]

    The extensions of the files this renderer can render.

  async render_file(file_path: Path, *, job_context: Context | None = None, localizer: Localizer | None = None) → Path

    Render a single file.

    Returns:

      The file’s new path, which may have been changed, e.g. a renderer-specific extension may have been stripped from the end.