Class: MarkdownFormatter::ASTNode::LeafBlock

Inherits:
Base
  • Object
show all
Defined in:
lib/markdown_formatter/nodes/leaf_block.rb

Instance Attribute Summary

Attributes inherited from Base

#node

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from MarkdownFormatter::ASTNode::Base

Instance Method Details

#to_sObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/markdown_formatter/nodes/leaf_block.rb', line 4

def to_s
  case node[:type]
    when :a
      Link.new(c).to_s
    when :p
      Paragraph.new(c).to_s
    when :strong
      Strong.new(c).to_s
    when :codespan
      CodeSpan.new(c).to_s
    when :em
      Emphasis.new(c).to_s
    when :html_element
      str += HTMLElement.new(c).to_s
    when :footnote
      str += Footnote.new(c).to_s
    else
      pp c
      raise "Unexpected type `#{c[:type]}'"
  end
end