class Asciidoctor::Extensions::BlockProcessor

Public: BlockProcessors are used to handle delimited blocks and paragraphs that have a custom name.

When Asciidoctor encounters a delimited block or paragraph with an unrecognized name while parsing the document, it looks for a BlockProcessor registered to handle this name and, if found, invokes its {Processor#process} method to build a corresponding node in the document tree.

AsciiDoc example:

[shout]
Get a move on.

Recognized options:

BlockProcessor implementations must extend BlockProcessor.

Constants

DSL

Attributes

name[RW]

Public Class Methods

new(name = nil, config = {}) click to toggle source
Calls superclass method Asciidoctor::Extensions::Processor.new
# File lib/asciidoctor/extensions.rb, line 462
def initialize name = nil, config = {}
  super config
  @name = name || @config[:name]
  # assign fallbacks
  case @config[:contexts]
  when ::NilClass
    @config[:contexts] ||= [:open, :paragraph].to_set
  when ::Symbol
    @config[:contexts] = [@config[:contexts]].to_set
  else
    @config[:contexts] = @config[:contexts].to_set
  end
  # QUESTION should the default content model be raw??
  @config[:content_model] ||= :compound
end

Public Instance Methods

process(parent, reader, attributes) click to toggle source
# File lib/asciidoctor/extensions.rb, line 478
def process parent, reader, attributes
  raise ::NotImplementedError, %(Asciidoctor::Extensions::BlockProcessor subclass must implement ##{__method__} method)
end