Class: Asciidoctor::Extensions::InlineMacroProcessor

Inherits:
MacroProcessor show all
Defined in:
lib/asciidoctor/extensions.rb

Overview

InlineMacroProcessors are used to handle block macros that have a custom name.

InlineMacroProcessor implementations must extend InlineMacroProcessor. – TODO break this out into different pattern types for example, FullInlineMacro, ShortInlineMacro (no target) and other patterns FIXME for inline passthrough, we need to have some way to specify the text as a passthrough

Constant Summary collapse

DSL =
InlineMacroProcessorDsl
@@rx_cache =
{}

Instance Attribute Summary

Attributes inherited from MacroProcessor

#name

Attributes inherited from Processor

#config

Instance Method Summary collapse

Methods inherited from MacroProcessor

#initialize, #process

Methods inherited from Processor

config, #create_block, #create_image_block, #create_inline, #create_list, #create_list_item, #create_section, enable_dsl, #initialize, option, #parse_attributes, #parse_content, #process, #update_config

Constructor Details

This class inherits a constructor from Asciidoctor::Extensions::MacroProcessor

Instance Method Details

#regexpObject

Lookup the regexp option, resolving it first if necessary. Once this method is called, the regexp is considered frozen.



619
620
621
# File 'lib/asciidoctor/extensions.rb', line 619

def regexp
  @config[:regexp] ||= resolve_regexp @name.to_s, @config[:format]
end

#resolve_regexp(name, format) ⇒ Object

Raises:

  • (::ArgumentError)


623
624
625
626
# File 'lib/asciidoctor/extensions.rb', line 623

def resolve_regexp name, format
  raise ::ArgumentError, %(invalid name for inline macro: #{name}) unless MacroNameRx.match? name
  @@rx_cache[[name, format]] ||= /\\?#{name}:#{format == :short ? '(){0}' : '(\S+?)'}\[(|#{CC_ANY}*?[^\\])\]/
end