Class: Minidown::HtmlElement

Inherits:
Element
  • Object
show all
Defined in:
lib/minidown/elements/html_element.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#children, #content, #doc, #nodes

Instance Method Summary collapse

Methods inherited from Element

#blank?, #raw_content, #raw_content=, #unparsed_lines

Methods included from HtmlHelper

#br_tag, #build_tag

Constructor Details

#initialize(doc, content, name) ⇒ HtmlElement

Returns a new instance of HtmlElement.



5
6
7
8
# File 'lib/minidown/elements/html_element.rb', line 5

def initialize doc, content, name
  super doc, content
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/minidown/elements/html_element.rb', line 3

def name
  @name
end

Instance Method Details

#parseObject



10
11
12
# File 'lib/minidown/elements/html_element.rb', line 10

def parse
  nodes << self
end

#to_htmlObject



14
15
16
17
18
19
20
# File 'lib/minidown/elements/html_element.rb', line 14

def to_html
  build_tag @name do |tag|
    # self.content is some Element
    self.content = content.text if ParagraphElement === self.content
    tag << self.content.to_html
  end
end