Class: Asciidoctor::Extensions::InlineMacroProcessor
- Inherits:
-
MacroProcessor
- Object
- Processor
- MacroProcessor
- Asciidoctor::Extensions::InlineMacroProcessor
- 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
Attributes inherited from Processor
Instance Method Summary collapse
-
#regexp ⇒ Object
Lookup the regexp option, resolving it first if necessary.
- #resolve_regexp(name, format) ⇒ Object
Methods inherited from MacroProcessor
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
#regexp ⇒ Object
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
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 |