Class: AsciidoctorDiagramLayout::Asciidoc::LayoutBlockProcessor
- Inherits:
-
Asciidoctor::Extensions::BlockProcessor
- Object
- Asciidoctor::Extensions::BlockProcessor
- AsciidoctorDiagramLayout::Asciidoc::LayoutBlockProcessor
- Defined in:
- lib/asciidoctor_diagram_layout/asciidoc/layout_block_processor.rb
Overview
Asciidoctor block processor for the [layout] block.
Parses a DSL body into a layout tree and renders it as inline HTML (HTML backend) or standalone SVG (all other backends).
Instance Method Summary collapse
-
#process(parent, reader, attrs) ⇒ Asciidoctor::Block
Rendered block.
Instance Method Details
#process(parent, reader, attrs) ⇒ Asciidoctor::Block
Returns rendered block.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/asciidoctor_diagram_layout/asciidoc/layout_block_processor.rb', line 23 def process(parent, reader, attrs) dsl = reader.read implicit_dir = attrs["direction"] == "cols" ? :cols : :rows root = Parser.new.parse(dsl, implicit_dir) backend = parent.document.attr("backend").to_s strategy = resolve_strategy(attrs["renderer"], backend) palette = attrs.fetch("palette", "rainbow") pdf = backend == "pdf" title = attrs["title"] = Renderer::RenderOptions.new( width: attrs.fetch("width", "100%"), height: attrs["height"], title: title, palette: palette, pdf: pdf, name_converter: ->(name) { convert_inline(parent, name) } ) case strategy when :html then render_html(parent, root, ) when :svg then render_svg(parent, root, backend, , attrs, title) end end |