Class: MarkdownUI::ItemTag
- Inherits:
-
Object
- Object
- MarkdownUI::ItemTag
- Defined in:
- lib/markdown-ui/tag/item_tag.rb
Instance Method Summary collapse
-
#initialize(content, klass = nil, link = nil) ⇒ ItemTag
constructor
A new instance of ItemTag.
- #render ⇒ Object
Constructor Details
#initialize(content, klass = nil, link = nil) ⇒ ItemTag
Returns a new instance of ItemTag.
3 4 5 6 7 |
# File 'lib/markdown-ui/tag/item_tag.rb', line 3 def initialize(content, klass = nil, link = nil) @klass = klass @content = content @link = link end |
Instance Method Details
#render ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/markdown-ui/tag/item_tag.rb', line 9 def render content, @data = @content.split(';') klass = MarkdownUI::KlassUtil.new(@klass).klass if @klass link = " href=\'#{@link.strip}\'" if @link data = if @data _data, attribute, value = @data.split(':') " data-#{attribute}=\'#{value}\'" else nil end "<a#{klass}#{data}#{link}>#{content}</a>" end |