"DTD/xhtml1-strict.dtd">
this class is used only by compiler.rb but it has tag information so moved
to here(tag.rb)
# File lib/amrita/tag.rb, line 145
def initialize(name="", attrs=[])
@name = name.downcase
@attrs = attrs
end
# 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
# File lib/amrita/tag.rb, line 158
def ==(t)
t.kind_of?(Tag) and name == t.name and attrs == t.attrs
end
# File lib/amrita/tag.rb, line 162
def start_tag?
@name[0] != ?/
end
# File lib/amrita/tag.rb, line 166
def end_tag?
@name[0] == ?/
end
# File lib/amrita/tag.rb, line 170
def empty_tag?
HtmlTagInfo::EMPTY.include?(@name)
end
# File lib/amrita/tag.rb, line 174
def block_tag?
HtmlTagInfo::BLOCK.include?(@name)
end
# 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
# File lib/amrita/tag.rb, line 189
def accept_child(child_tag)
true
end
# File lib/amrita/tag.rb, line 193
def can_omit_endtag?
HtmlTagInfo::CAN_OMIT_ENDTAG.include?(@name)
end
|