Skip to main content

register_format_templates

Function register_format_templates 

Source
pub(crate) fn register_format_templates(
    tera: &mut Tera,
    theme_path: &Path,
    formats: &[OutputFormat],
    templates: &[(&str, &str, &str)],
) -> Result<()>
Expand description

Register templates for each configured output format, supporting theme overrides.

For each format in formats and each (base_name, html_builtin, gmi_builtin) tuple in templates, registers a Tera template named "{base_name}.{ext}" — first checking for a user override at theme_path / "{base_name}.{ext}.j2", otherwise falling back to the corresponding builtin constant.

After registering the format-specific templates, also loads any extra .j2 files from the theme directory that weren’t explicitly registered (see load_extra_theme_templates).