Class: MarkdownUI::CustomTag

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

Instance Method Summary collapse

Constructor Details

#initialize(tag, content, klass = nil) ⇒ CustomTag

Returns a new instance of CustomTag.



5
6
7
8
9
# File 'lib/markdown-ui/tag/custom_tag.rb', line 5

def initialize(tag, content, klass = nil)
  @tag = tag
  @klass = klass
  @content = content
end

Instance Method Details

#renderObject



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

def render
  klass = MarkdownUI::KlassUtil.new("#{@klass}").klass
  tag = @tag.downcase.strip
  content = MarkdownUI::Content::Parser.new(@content).parse

  output = []
  output << "<#{tag}"
  output << "#{klass}>"
  output << content
  output << "</#{tag}>"

  output.join(' ')
end