lib/asciidoctor/abstract_block.rb
# Internal: Performs the work for find_by, but does not handle the StopIteration exception.
Performs the work for find_by, but does not handle the StopIteration exception.
Performs the work for find_by but does not handle the StopIteration exception .
def find_by_internal selector = {}, result = [], &block
    if ((any_context = !(context_selector = selector[:context])) || context_selector == @context) &&
        (!(style_selector = selector[:style]) || style_selector == @style) &&
        (!(role_selector = selector[:role]) || (has_role? role_selector)) &&
        (!(id_selector = selector[:id]) || id_selector == @id)
      if id_selector
        result.replace block_given? ? ((yield self) ? [self] : []) : [self]
        raise ::StopIteration
      elsif block_given?
        result << self if (yield self)
      else
        result << self
      end
    end
    if @context == :document && (any_context || context_selector == :section) && header?
      @header.find_by_internal selector, result, &block
    end
    unless context_selector == :document 
      if @context == :dlist
        if any_context || context_selector != :section 
          @blocks.flatten.each do |li|
            li.find_by_internal selector, result, &block if li
          end
        end
      elsif
        @blocks.each do |b|
          next if (context_selector == :section && b.context != :section) 
          b.find_by_internal selector, result, &block
        end
      end
    end
    result
  end
def find_by_internal selector = { } , result = [ ] , & block if ( ( any_context = ! ( context_selector = selector [ :context ] ) ) || context_selector == @context ) && ( ! ( style_selector = selector [ :style ] ) || style_selector == @style ) && ( ! ( role_selector = selector [ :role ] ) || ( has_role? role_selector ) ) && ( ! ( id_selector = selector [ :id ] ) || id_selector == @id ) if id_selector result . replace block_given? ? ( ( yield self ) ? [ self ] : [ ] ) : [ self ] raise :: StopIteration elsif block_given? result << self if ( yield self ) else result << self end end if @context == :document && ( any_context || context_selector == :section ) && header? @header . find_by_internal selector , result , & block end unless context_selector == :document if @context == :dlist if any_context || context_selector != :section @blocks . flatten . each do | li | li . find_by_internal selector , result , & block if li end end elsif @blocks . each do | b | next if ( context_selector == :section && b . context != :section ) b . find_by_internal selector , result , & block end end end result end
Internal: Performs the work for find_by, but does not handle the StopIteration exception.
Internal : Performs the work for find_by but does not handle the StopIteration exception .
# process document header as a section if present # optimization # yuck, dlist is a special case # optimization # NOTE the list item of a dlist can be nil, so we have to check # optimization
selector
<not_specific>
result
<not_specific>
block
<not_specific>