Class: Minidown::OrderListElement

Inherits:
ListGroupElement show all
Defined in:
lib/minidown/elements/order_list_element.rb

Constant Summary collapse

NestRegexp =
/\A(\s*)\d+\.\s+(.+)/
ListRegexp =
Minidown::Utils::Regexp[:order_list]

Constants inherited from ListGroupElement

ListGroupElement::IndentRegexp, ListGroupElement::StartWithBlankRegexp

Instance Attribute Summary

Attributes inherited from ListGroupElement

#indent_level, #lists

Attributes inherited from Element

#children, #content, #doc, #nodes

Instance Method Summary collapse

Methods inherited from ListGroupElement

#parse

Methods inherited from Element

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

Methods included from HtmlHelper

#br_tag, #build_tag

Constructor Details

#initialize(doc, line, indent_level = 0) ⇒ OrderListElement

Returns a new instance of OrderListElement.



6
7
8
9
10
11
12
# File 'lib/minidown/elements/order_list_element.rb', line 6

def initialize doc, line, indent_level = 0
  super doc, line
  @children << ListElement.new(doc, content)
  @lists = @children.dup
  @indent_level = indent_level
  @put_back = []
end

Instance Method Details

#to_htmlObject



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

def to_html
  build_tag 'ol'.freeze do |content|
    children.each { |child| content << child.to_html}
  end
end