Sha256: 888c0fd04ad1cffe4f79dbbd0fa982386d207964b26572e09d53f3d1b45b659e

Contents?: true

Size: 425 Bytes

Versions: 16

Compression:

Stored size: 425 Bytes

Contents

module Ecrire::Markdown::Parsers
  class Heading < Base
    RULE = /^(\#{1,6} )(.+)/i

    def parse!

      unless @node.instance_of?(Ecrire::Markdown::Node)
        return @node
      end

      if match = RULE.match(@node.content)
        size = match[1].length - 1
        @node = Ecrire::Markdown::Nodes::Heading.new(size, match[2])
        @document.nodes[@index] = @node
      end
      return @node
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ecrire-0.30.3 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.30.2 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.30.1 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.30.0 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.29.0 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.28.3 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.28.2 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.28.1 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.28.0 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.27.0 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.26.3 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.26.2 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.26.1 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.26.0 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.25.2 lib/ecrire/markdown/parsers/heading.rb
ecrire-0.25.1 lib/ecrire/markdown/parsers/heading.rb