Sha256: 5c916a0cb85b9d22b2efa25b7d16241299ce8e821a22b01a57a8fb4cb107c10a

Contents?: true

Size: 752 Bytes

Versions: 3

Compression:

Stored size: 752 Bytes

Contents

# -*- coding: utf-8 -*-

require 'kramdown'

module Kramdown
  module Parser
    class Kramdown

      # Parse the span at the current location.
      def parse_span
        start_line_number = @src.current_line_number
        saved_pos = @src.save_pos

        span_start = /(?:\[\s*?)/
        result = @src.scan(span_start)
        stop_re = /(?:\s*?\])/

        el = Element.new(:span, nil, nil, :location => start_line_number)
        found = parse_spans(el, stop_re) do
          el.children.size > 0
        end

        if found
          @src.scan(stop_re)
          @tree.children << el
        else
          @src.revert_pos(saved_pos)
          @src.pos += result.length
          add_text(result)
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
darkmouun-2.2.0 lib/darkmouun/kramdown/parser/kramdown/span.rb
darkmouun-2.1.1 lib/darkmouun/kramdown/parser/kramdown/span.rb
darkmouun-2.1.0 lib/darkmouun/kramdown/parser/kramdown/span.rb