A
download Tag.rb
Language: Ruby
LOC: 29
Project Info
IOWA
Server: RubyForge
Type: cvs
...Forge\i\iowa\iowa\iowa\src\
   Application.rb
   ApplicationStats.rb
   Association.rb
   BindingsParser.rb
   Client.rb
   Component.rb
   ComponentProxy.rb
   config.rb
   Context.rb
   DbPool.rb
   DynamicElements.rb
   Element.rb
   Form.rb
   HTTPServer.rb
   ISAAC.rb
   KeyValueCoding.rb
   LRUCache.rb
   PageStore.rb
   read_multipart.rb
   Request.rb
   SciTE.properties
   Session.rb
   SessionStats.rb
   SessionStore.rb
   Tag.rb
   TemplateParser.rb
   WEBrickServlet.rb

require 'cgi'

module Iowa

# Superclass for all Iowa tags.  Tag provides a self referential
# method to determine the tag's name, and to output opening and closing
# HTML representations of the tag.

class Tag < Element

	# Return the name of the tag.

	def tagName
		self.class.name.split("::").last.downcase
	end
		
	# Output the HTML to open the tag.

	def openTag(*args)
		if args.first.is_a? Hash
			extraAttributes = args.first
		else
			extraAttributes = Hash[*args]
		end
		
		newAttributes = @attributes.dup.update(extraAttributes)
		tag = "<#{tagName}"
		newAttributes.each do |key, value| 
			if value
				value = CGI::escapeHTML(value.to_s)
				tag += " #{key}=\"#{value}\""
			else
				tag += " #{key}"
			end
		end
		tag += ">"
	end
	
	# Output the HTML to close the tag.

	def closeTag
		"</#{tagName}>"
	end
end

end

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us