Amrita::Tag (Class)

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)

Attributes

attrs  [R] 
name  [R] 

Public Class methods

[Source]

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

Public Instance methods

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

# 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

[Source]

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

[Source]

# 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

[Validate]