Module: Minidown::HtmlHelper

Included in:
Element
Defined in:
lib/minidown/html_helper.rb

Instance Method Summary collapse

Instance Method Details

#br_tagObject



14
15
16
# File 'lib/minidown/html_helper.rb', line 14

def br_tag
  '<br>'
end

#build_tag(name, attr = nil) {|content| ... } ⇒ Object

Yields:

  • (content)


3
4
5
6
7
8
9
10
11
12
# File 'lib/minidown/html_helper.rb', line 3

def build_tag name, attr = nil
  content = ''
  yield content if block_given?
  if attr
    attr = attr.map{|k, v| "#{k}=\"#{v}\""}.join ' '.freeze
    "<#{name} #{attr}>#{content}</#{name}>"
  else
    "<#{name}>#{content}</#{name}>"
  end
end