class MarkdownUI::ListTag
Public Class Methods
new(_content, _klass = nil, _type = nil, _data = nil)
click to toggle source
# 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
Public Instance Methods
render()
click to toggle source
# 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
Protected Instance Methods
list(content)
click to toggle source
# File lib/markdown-ui/tag/list_tag.rb, line 25 def list(content) list = '' if !content.grep(/^\<li\>.*/).empty? list = content.join else content.each do |c| list += "<li>#{c}</li>" end end list end