Class: MarkdownList

Inherits:
DocItem show all
Defined in:
lib/almirah/doc_items/markdown_list.rb

Instance Attribute Summary collapse

Attributes inherited from DocItem

#parent_doc

Instance Method Summary collapse

Constructor Details

#initialize(first_row) ⇒ MarkdownList

Returns a new instance of MarkdownList.



7
8
9
10
# File 'lib/almirah/doc_items/markdown_list.rb', line 7

def initialize(first_row)
    @rows = Array.new
    @rows.append(first_row)
end

Instance Attribute Details

#rowsObject

Returns the value of attribute rows.



5
6
7
# File 'lib/almirah/doc_items/markdown_list.rb', line 5

def rows
  @rows
end

Instance Method Details

#addRow(row) ⇒ Object



12
13
14
# File 'lib/almirah/doc_items/markdown_list.rb', line 12

def addRow(row)
    @rows.append(row)
end

#to_htmlObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/almirah/doc_items/markdown_list.rb', line 16

def to_html
    s = ''
    if @@htmlTableRenderInProgress
        s += "</table>\n"
        @@htmlTableRenderInProgress = false
    end

    s += "<ul>\n"
    @rows.each do |r|
        s += "\t<li>#{r}</li>\n"
    end
    s += "</ul>\n"

    return s
end