Class: Facwparser::Element::P

Inherits:
ElementBase show all
Defined in:
lib/facwparser/element.rb

Instance Attribute Summary

Attributes inherited from ElementBase

#children, #source

Instance Method Summary collapse

Methods inherited from ElementBase

#==, #initialize, #render_text

Constructor Details

This class inherits a constructor from Facwparser::Element::ElementBase

Instance Method Details

#append(source) ⇒ Object



44
45
46
# File 'lib/facwparser/element.rb', line 44

def append(source)
  @source += source
end

#render_html(options) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/facwparser/element.rb', line 47

def render_html(options)
  if @source =~ /\A *bq. (.+)/m
    "<blockquote>\n" +
      render_html_by_name_and_value('p', $1).gsub("\n", '<br>') + "\n" +
      "</blockquote>\n"
  else
    @children ||= Parser.parse_value(@source, options)
    render_html_by_name_and_children('p', @children, options) + "\n"
  end
end