class

Asciidoctor::Converter::TemplateConverter

Inherits Asciidoctor::Converter::Base < Reference < Object

A Converter implementation that uses templates to convert AbstractNode objects from a parsed AsciiDoc document tree to the backend format.

Crystal uses ECR as its native template engine. This implementation provides the base class and template discovery logic. Specific template engine adapters (Slim, Haml, ERB equivalents) can be added later.

Ported from Ruby Asciidoctor lib/asciidoctor/converter/template.rb

Constructors

new(backend : String, template_dirs : Array(String), opts : Hash(String, String) = {} of String => String)
Source
new(backend : String)
Source

Instance methods

convert(node : AbstractNode, transform : String | Nil = nil) : String

Convert an AbstractNode to the backend format using the named template.

Source
dispatch(node : AbstractNode, transform : String) : String

Dispatch conversion (delegates to convert).

Source
handles?(name : String) : Bool

Check whether there is a template registered with the specified name.

Source
register(name : String, template_path : String) : String

Register a template with this converter.

Source
template_dirs

The template directories to scan.

Source
templates

The registered templates keyed by transform name.

Source