Class: MarkdownUI::ListTag

Inherits:
Shared::TagKlass
  • Object
show all
Defined in:
lib/markdown-ui/tag/list_tag.rb

Instance Method Summary collapse

Constructor Details

#initialize(_content, _klass = nil, _type = nil, _data = nil) ⇒ ListTag

Returns a new instance of ListTag.



3
4
5
6
7
8
# File 'lib/markdown-ui/tag/list_tag.rb', line 3

def initialize(_content, _klass = nil, _type = nil, _data = nil)
  @klass   = _klass
  @content = _content
  @type    = _type
  @data    = _data
end

Instance Method Details

#renderObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/markdown-ui/tag/list_tag.rb', line 10

def render
  content = @content.split(';')

  @type   = :unordered if @type.nil?

  case @type
    when :ordered
      "<ol#{klass}#{data}>#{list(content)}</ol>"
    when :unordered
      "<ul#{klass}#{data}>#{list(content)}</ul>"
  end
end