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
# 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?,
    :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



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/markdown-ui/tag/tag.rb', line 18

def render
  # if @mode.div?
    MarkdownUI::StandardTag.new(@content, @klass, nil, @data).render
  # elsif @mode.span
  #   MarkdownUI::SpanTag.new(@content, @klass).render
  # elsif @mode.article
  #   MarkdownUI::ArticleTag.new(@content, @klass).render
  # elsif @mode.section
  #   MarkdownUI::SectionTag.new(@content, @klass).render
  # elsif @mode.header
  #   MarkdownUI::HeaderTag.new(@content, @klass).render
  # elsif @mode.footer
  #   MarkdownUI::FooterTag.new(@content, @klass).render
  # else
  #   MarkdownUI::CustomTag.new(@tag, @content, @klass).render
  # end
end