Class: MarkdownFormatter::ASTNode::Paragraph
- Defined in:
- lib/markdown_formatter/nodes/paragraph.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from MarkdownFormatter::ASTNode::Base
Instance Method Details
#to_s ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/markdown_formatter/nodes/paragraph.rb', line 4 def to_s node[:children].map do |c| case c[:type] when :a Link.new(c).to_s when :text c[:value] when :strong Strong.new(c).to_s when :codespan CodeSpan.new(c).to_s when :br # skip when :em Emphasis.new(c).to_s when :smart_quote SmartQuote.new(c).to_s when :typographic_sym TypographicSym.new(c).to_s when :img Image.new(c).to_s when :html_element HTMLElement.new(c).to_s when :entity Entity.new(c).to_s when :footnote Footnote.new(c).to_s else pp c raise "Unexpected type `#{c[:type]}'" end end.join end |