Class: Textus::Pipeline::Render
- Inherits:
-
Object
- Object
- Textus::Pipeline::Render
- Defined in:
- lib/textus/pipeline/render.rb
Overview
Renders an entry’s stored DATA into the bytes for one publish target (ADR 0094). Relocates the Mustache logic that used to live in the build-time Markdown renderer. Provenance is NOT added here — it lives in the data’s ‘_meta`; a template surfaces it if the output should show it. A verbatim target (no template) is the caller’s job to copy.
Instance Method Summary collapse
-
#bytes_for(target:, data:, boot:) ⇒ Object
target: a rendering Policy::PublishTarget.
-
#initialize(template_loader:) ⇒ Render
constructor
A new instance of Render.
Constructor Details
#initialize(template_loader:) ⇒ Render
Returns a new instance of Render.
11 12 13 |
# File 'lib/textus/pipeline/render.rb', line 11 def initialize(template_loader:) @template_loader = template_loader end |
Instance Method Details
#bytes_for(target:, data:, boot:) ⇒ Object
target: a rendering Policy::PublishTarget. data: parsed entry data. boot: boot context hash or nil. Returns the rendered String.
17 18 19 20 21 22 |
# File 'lib/textus/pipeline/render.rb', line 17 def bytes_for(target:, data:, boot:) raise ArgumentError.new("Produce::Render called for a verbatim target #{target.to.inspect}") unless target.renders? ctx = target.inject_boot ? data.merge("boot" => boot) : data Mustache.render(@template_loader.call(target.template), ctx) end |