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

but it has tag information so moved to here(tag.rb)

Methods

Attributes

attrs  [R] 
name  [R] 

Public Class methods

[Source]

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

Public Instance methods

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

# File lib/amrita/tag.rb, line 221
    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 209
    def start_tag?
      @name[0] != ?/
    end

[Source]

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

[Validate]