Class: MarkdownUI::Tag

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

Instance Method Summary collapse

Constructor Details

#initialize(tag, content, klass = nil, data = nil) ⇒ Tag

Returns a new instance of Tag.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/markdown-ui/tag/tag.rb', line 3

def initialize(tag, content, klass = nil, data = nil)
  @mode = OpenStruct.new(
    :div?      => !(tag =~ /div/i).nil?,
    :label?    => !(tag =~ /label/i).nil?,
    :span?     => !(tag =~ /span/i).nil?,
    :article?  => !(tag =~ /article/i).nil?,
    :section?  => !(tag =~ /section/i).nil?,
    :header?   => !(tag =~ /header/i).nil?,
    :footer?   => !(tag =~ /footer/i).nil?
  )
  @tag = tag
  @content = content
  @klass = klass
  @data = data
end

Instance Method Details

#renderObject



19
20
21
22
23
24
25
# File 'lib/markdown-ui/tag/tag.rb', line 19

def render
  if @mode.div?
    MarkdownUI::StandardTag.new(@content, @klass, nil, @data).render
  elsif @mode.label?
    MarkdownUI::LabelTag.new(@content, @klass, nil, @data).render
  end
end