Method: HTML::Tag.add_tag

Defined in:
lib/html/tags.rb

.add_tag(name, is_block, is_inline, is_empty, can_omit) ⇒ Object

Add the given tag to the tag lookup table.

This can be called by user code to add otherwise unknown tags to the table.

name

the tag name, a String.

is_block

true if I am a block element.

is_inline

true if I am an inline element.

is_empty

true if I am an empty element.

can_omit

true if my end tag can be omitted.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/html/tags.rb', line 105

def Tag.add_tag(name, is_block, is_inline, is_empty, can_omit)
  @table[ name.upcase ] = @table[ name.downcase ] = \
  if is_empty
    EmptyTag.new(name, true)
  elsif is_block
    if is_inline
      BlockOrInlineTag.new(name, can_omit)
    else
      BlockTag.new(name, can_omit)
    end
  else
    InlineTag.new(name, can_omit)
  end
end