class Kramdown::Parser::Kramdown

def parse_spans(el, stop_re = nil)

Parse all span level elements in the source string.
def parse_spans(el, stop_re = nil)
  @stack.push(@tree)
  @tree = el
  used_re = (stop_re.nil? ? @span_start_re : /(?=#{Regexp.union(stop_re, @span_start)})/)
  stop_re_found = false
  while !@src.eos? && !stop_re_found
    if result = @src.scan_until(used_re)
      add_text(result)
      if stop_re && (stop_re_matched = @src.check(stop_re))
        stop_re_found = (block_given? ? yield : true)
      end
      processed = SPAN_PARSERS.any? do |name|
        if @src.check(@parsers[name].start_re)
          send(@parsers[name].method)
          true
        else
          false
        end
      end unless stop_re_found
      if !processed && !stop_re_found
        if stop_re_matched
          add_text(@src.scan(/./))
        else
          raise Kramdown::Error, 'Bug: please report!'
        end
      end
    else
      add_text(@src.scan_until(/.*/m)) unless stop_re
      break
    end
  end
  @tree = @stack.pop
  stop_re_found
end