Module: RbbCode::ParagraphNode

Includes:
RecursiveConversion
Defined in:
lib/rbbcode/node_extensions.rb

Instance Method Summary collapse

Methods included from RecursiveConversion

#recursively_convert

Instance Method Details

#to_html(options) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/rbbcode/node_extensions.rb', line 51

def to_html(options)
  # Convert all child nodes, concatenate the results,

  # and wrap the concatenated HTML in <p> tags.

  html = elements.collect do |node|
    recursively_convert(node, :to_html, options)
  end.join
  "\n<p>" + html + "</p>\n"
end

#to_markdown(options) ⇒ Object



60
61
62
63
64
65
66
67
# File 'lib/rbbcode/node_extensions.rb', line 60

def to_markdown(options)
  # Convert all child nodes, concatenate the results,

  # and append newline characters.

  markdown = elements.collect do |node|
    recursively_convert(node, :to_markdown, options)
  end.join
  markdown + "\n\n"
end