class DaimonMarkdown::Plugin::TableOfContents::ListItem
Attributes
items[R]
Public Class Methods
new(header: EmptyHeader.new)
click to toggle source
# File lib/daimon_markdown/plugin/toc.rb, line 120 def initialize(header: EmptyHeader.new) @header = header @items = [] end
Public Instance Methods
<<(item)
click to toggle source
# File lib/daimon_markdown/plugin/toc.rb, line 125 def <<(item) @items << item end
to_html()
click to toggle source
# File lib/daimon_markdown/plugin/toc.rb, line 129 def to_html if @items.empty? %Q(<li>#{@header.link}</li>) else %Q(<li>#{@header.link}\n#{@items.map(&:to_html).join("\n")}\n</li>) end end