Module: Asciidoctor::Ldl::Processor

Included in:
BlockMacroProcessor, BlockProcessor
Defined in:
lib/asciidoctor/ldl/extension.rb

Overview

Shared behaviour for the block and block-macro processors: read options from attributes, drive the Renderer, and emit an image (or, on failure, a visible error block).

Instance Method Summary collapse

Instance Method Details

#render_ldl(parent, source, attrs, target_hint) ⇒ Object

Turn LDL source into an image block placed in parent.



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/asciidoctor/ldl/extension.rb', line 15

def render_ldl(parent, source, attrs, target_hint)
  doc = parent.document
  renderer = build_renderer(doc, attrs)
  out_dir = renderer.out_dir

  begin
    filename = renderer.render(source, resolve_basename(attrs, target_hint))
  rescue Renderer::Error => e
    return error_block(parent, attrs, e.message)
  end

  create_ldl_image(parent, attrs, filename, renderer, doc)
end