Class: Kramdown::Parser::Kramdown

Inherits:
Object
  • Object
show all
Defined in:
lib/rabbit/parser/markdown.rb

Instance Method Summary collapse

Instance Method Details

#configure_parserObject



22
23
24
25
26
27
# File 'lib/rabbit/parser/markdown.rb', line 22

def configure_parser
  position = @block_parsers.index(:codeblock_fenced)
  @block_parsers.insert(position, :codeblock_fenced_gfm)

  configure_parser_raw
end

#configure_parser_rawObject



21
# File 'lib/rabbit/parser/markdown.rb', line 21

alias_method :configure_parser_raw, :configure_parser

#handle_extension(name, opts, body, type, line_no = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/rabbit/parser/markdown.rb', line 11

def handle_extension(name, opts, body, type, line_no=nil)
  case name
  when "wait"
    @tree.children << Element.new(:wait, body, nil, :category => type, :location => line_no)
    true
  else
    handle_extension_raw(name, opts, body, type, line_no)
  end
end

#handle_extension_rawObject



10
# File 'lib/rabbit/parser/markdown.rb', line 10

alias_method :handle_extension_raw, :handle_extension

#parse_codeblock_fenced_gfmObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rabbit/parser/markdown.rb', line 31

def parse_codeblock_fenced_gfm
  original_match = self.class::FENCED_CODEBLOCK_MATCH
  begin
    self.class.send(:remove_const, :FENCED_CODEBLOCK_MATCH)
    self.class.const_set(:FENCED_CODEBLOCK_MATCH,
                         GFM::FENCED_CODEBLOCK_MATCH)
    parse_codeblock_fenced
  ensure
    self.class.send(:remove_const, :FENCED_CODEBLOCK_MATCH)
    self.class.const_set(:FENCED_CODEBLOCK_MATCH, original_match)
  end
end