Class: AsciidoctorExtensions::KrokiBlockProcessor

Inherits:
Extensions::BlockProcessor
  • Object
show all
Defined in:
lib/asciidoctor/extensions/asciidoctor_kroki/extension.rb

Overview

A block extension that converts a diagram into an image.

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, config = {}) ⇒ KrokiBlockProcessor

Returns a new instance of KrokiBlockProcessor.

Parameters:

  • name (String) (defaults to: nil)

    name of the block macro (optional)

  • config (Hash) (defaults to: {})

    a config hash (optional)

    • :logger a logger used to log warning and errors (optional)



23
24
25
26
# File 'lib/asciidoctor/extensions/asciidoctor_kroki/extension.rb', line 23

def initialize(name = nil, config = {})
  @logger = (config || {}).delete(:logger) { ::Asciidoctor::LoggerManager.logger }
  super(name, config)
end

Instance Method Details

#process(parent, reader, attrs) ⇒ Object



28
29
30
31
32
# File 'lib/asciidoctor/extensions/asciidoctor_kroki/extension.rb', line 28

def process(parent, reader, attrs)
  diagram_type = @name
  diagram_text = reader.string
  KrokiProcessor.process(self, parent, attrs, diagram_type, diagram_text, @logger)
end