Class: MarkdownFormatter::ASTNode::BlockQuote
- Defined in:
- lib/markdown_formatter/nodes/block_quote.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 |
# File 'lib/markdown_formatter/nodes/block_quote.rb', line 4 def to_s node[:children].map do |c| case c[:type] when :blank ">" when :header "> " + Header.new(c).to_s.gsub(/\R/, "\n> ") when :ol, :ul "> " + List.new(c).to_s.gsub(/\R(?!\z)/, "\n> ") when :blockquote "> " + BlockQuote.new(c).to_s else "> " + Paragraph.new(c).to_s.gsub(/\R/, " ") end end.join("\n").chomp + "\n" end |