Parent

Kramdown::Parser::GFM

Public Class Methods

new(source, options) click to toggle source
# File lib/kramdown/parser/gfm.rb, line 8
def initialize(source, options)
  super
  i = @block_parsers.index(:codeblock_fenced)
  @block_parsers.delete(:codeblock_fenced)
  @block_parsers.insert(i, :codeblock_fenced_gfm)
end

Public Instance Methods

parse_paragraph() click to toggle source
# File lib/kramdown/parser/gfm.rb, line 19
def parse_paragraph
  result = @src.scan(PARAGRAPH_MATCH)
  while !@src.match?(self.class::PARAGRAPH_END)
    result << @src.scan(PARAGRAPH_MATCH)
  end
  result.chomp!
  unless @tree.children.last && @tree.children.last.type == :p
    @tree.children << new_block_el(:p)
  end
  lines = result.lstrip.split(/\n/)
  lines.each_with_index do |line, index|
    @tree.children.last.children << Element.new(@text_type, line) << Element.new(:br) << Element.new(@text_type, "\n")
  end
  @tree.children.last.children.pop # added one \n too many
  @tree.children.last.children.pop # added one :br too many
  true
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.