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.

class betty.render.Renderer

  Bases: `ABC`

  Define a (file) content renderer.

  Renderers can be implemented for a variety of purposes: - invoking templating engines - file conversions

  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.

  __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.