Sha256: 826fb6caf94090946a2ea20a06e2335d8faf50ca6b27760f15eeaa0544e94e02

Contents?: true

Size: 642 Bytes

Versions: 8

Compression:

Stored size: 642 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

        stop_re = /(\](?=\{\:))/

        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)
          add_text('[')
        end
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
darkmouun-3.2.3 lib/darkmouun/kramdown/parser/kramdown/span.rb
darkmouun-3.2.2 lib/darkmouun/kramdown/parser/kramdown/span.rb
darkmouun-3.2.1 lib/darkmouun/kramdown/parser/kramdown/span.rb
darkmouun-3.2.0 lib/darkmouun/kramdown/parser/kramdown/span.rb
darkmouun-3.1.1 lib/darkmouun/kramdown/parser/kramdown/span.rb
darkmouun-2.3.1 lib/darkmouun/kramdown/parser/kramdown/span.rb
darkmouun-2.3.0 lib/darkmouun/kramdown/parser/kramdown/span.rb
darkmouun-2.2.1 lib/darkmouun/kramdown/parser/kramdown/span.rb