Class: Amrita::Tag

Class Amrita::Tag |
In: | lib/amrita/tag.rb
Parent: | Object

this class is used only by compiler.rb but it has tag information so moved to here(tag.rb)

Methods

== accept_child block_tag? can_omit_endtag? empty_tag? end_tag? generate_element new start_tag? to_s

Attributes

:attrs | [R] |
:name | [R] |

Public Class methods

new(name="", attrs=[])

    # File lib/amrita/tag.rb, line 145
        def initialize(name="", attrs=[])
          @name = name.downcase
          @attrs = attrs
        end

Public Instance methods

to_s()

    # File lib/amrita/tag.rb, line 150
        def to_s
          if attrs.size > 0
            "<#{@name} " + attrs.collect { |a| "#{a[0]}='#{a[1]}'" }.join(" ") + ">"
          else
            "<#{@name}>"
          end
        end

==(t)

    # File lib/amrita/tag.rb, line 158
        def ==(t)
          t.kind_of?(Tag) and name == t.name and attrs == t.attrs
        end

start_tag?()

    # File lib/amrita/tag.rb, line 162
        def start_tag?
          @name[0] != ?/
        end

end_tag?()

    # File lib/amrita/tag.rb, line 166
        def end_tag?
          @name[0] == ?/
        end

empty_tag?()

    # File lib/amrita/tag.rb, line 170
        def empty_tag?
          HtmlTagInfo::EMPTY.include?(@name)
        end

block_tag?()

    # File lib/amrita/tag.rb, line 174
        def block_tag?
          HtmlTagInfo::BLOCK.include?(@name)
        end

generate_element(parser)

    # File lib/amrita/tag.rb, line 178
        def generate_element(parser)
          a = attrs.collect { |attr| Attr.new(attr[0], attr[1]) }
          if empty_tag?
            Element.new(name, *a)
          else
            Element.new(name, *a) do
              parser.parse1(self)
            end
          end
        end

accept_child(child_tag)

    # File lib/amrita/tag.rb, line 189
        def accept_child(child_tag)
          true
        end

can_omit_endtag?()

    # File lib/amrita/tag.rb, line 193
        def can_omit_endtag?
          HtmlTagInfo::CAN_OMIT_ENDTAG.include?(@name)
        end