Class Asciidoctor::Extensions::Processor
In: lib/asciidoctor/extensions.rb
Parent: Object

Public: An abstract base class for document and syntax processors.

This class provides access to a class-level Hash for holding default configuration options defined using the {Processor.option} method. This style of default configuration is specific to the native Ruby environment and is only consulted inside the initializer. An overriding configuration Hash can be passed to the initializer. Once the processor is initialized, the configuration is accessed using the {Processor#config} instance variable.

Instances of the Processor class provide convenience methods for creating AST nodes, such as Block and Inline, and for parsing child content.

Methods

External Aliases

use_dsl -> extend_dsl
use_dsl -> include_dsl

Attributes

config  [R]  Public: Get the configuration Hash for this processor instance.

Public Class methods

Public: Get the static configuration for this processor class.

Returns a configuration [Hash]

Public: Assigns a default value for the specified option that gets applied to all instances of this processor.

Examples

  option :contexts, [:open, :paragraph]

Returns nothing

Include the DSL class for this processor into this processor class or instance.

This method automatically detects whether to use the include or extend keyword based on what is appropriate.

NOTE Inspiration for this DSL design comes from corcoran.io/2013/09/04/simple-pattern-ruby-dsl/

Returns nothing

Public Instance methods

Public: Creates a new Section node.

Creates a Section node in the same manner as the parser.

parent - The parent Section (or Document) of this new Section. title - The String title of the new Section. attrs - A Hash of attributes to control how the section is built.

         Use the style attribute to set the name of a special section (ex. appendix).
         Use the id attribute to assign an explicit ID or set the value to false to
         disable automatic ID generation (when sectids document attribute is set).

opts - An optional Hash of options (default: {}):

         :level    - [Integer] The level to assign to this section; defaults to
                     one greater than the parent level (optional).
         :numbered - [Boolean] A flag to force numbering, which falls back to the
                     state of the sectnums document attribute (optional).

Returns a [Section] node with all properties properly initialized.

Public: Parses blocks in the content and attaches the block to the parent.

Returns The parent node into which the blocks are parsed.

[Validate]