module

Hwaro::Content::Processors::Template

Template processor using Crinja This module provides a singleton-like interface for template processing

Class methods

create_context(page : Models::Page, config : Models::Config) : TemplateContext

Create a context for the given page and config

Source
engine

Get or create the template engine

Source
process(content : String, context : TemplateContext) : String

Process a template string with context

Source
process(content : String, variables : Hash(String, Crinja::Value)) : String

Process a template string with raw variables hash

Source
render_template(template_name : String, context : TemplateContext) : String

Render a named template from the loader

Source
reset_engine

Reset the engine (useful for testing or reconfiguration)

Source
set_loader(loader : Crinja::Loader)

Set custom loader for the engine

Source
set_loader(templates_path : String)

Set loader from templates directory path

Source