Class: Kramdown::Parser::Marsdawn

Inherits:
Kramdown
  • Object
show all
Defined in:
lib/marsdawn/source/kramdown/parser.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.front_matterObject



5
6
7
# File 'lib/marsdawn/source/kramdown/parser.rb', line 5

def self.front_matter
  @@front_matter
end

Instance Method Details

#handle_extension(name, opts, body, type) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/marsdawn/source/kramdown/parser.rb', line 26

def handle_extension(name, opts, body, type)
  case name
  when 'front_matter'
    opts.each do |key, val|
      @@front_matter[key.to_sym] = val
      @@front_matter[:link_key] = val if key == 'title'
    end
    true
  else
    super name, opts, body, type
  end
end

#parseObject



9
10
11
12
# File 'lib/marsdawn/source/kramdown/parser.rb', line 9

def parse
  @@front_matter = {}
  super
end

#parse_atx_headerObject



20
21
22
23
24
# File 'lib/marsdawn/source/kramdown/parser.rb', line 20

def parse_atx_header
  ret = super
  handle_header @src[2].to_s.strip, @src[1].length
  ret
end

#parse_setext_headerObject



14
15
16
17
18
# File 'lib/marsdawn/source/kramdown/parser.rb', line 14

def parse_setext_header
  ret = super
  handle_header @src[1], @src[3].to_i
  ret
end