module Trenni::Strings

def self.to_attribute(key, value)

`value` must already be escaped.
def self.to_attribute(key, value)
	%Q{#{key}="#{value}"}
end

def self.to_html(string)

def self.to_html(string)
	string.gsub(HTML_ESCAPE_PATTERN){|c| HTML_ESCAPE[c]}
end

def self.to_quoted_string(string)

def self.to_quoted_string(string)
	'"' + string.gsub('"', '\\"').gsub(/\r/, "\\r").gsub(/\n/, "\\n") + '"'
end

def self.to_simple_attribute(key, strict)

def self.to_simple_attribute(key, strict)
	strict ? %Q{#{key}="#{key}"} : key.to_s
end

def self.to_snake(string)

def self.to_snake(string)
	string.gsub("::", "").gsub(/([A-Z]+)/){"_" + $1.downcase}.sub(/^_+/, "")
end

def self.to_title(string)

def self.to_title(string)
	string.gsub(/(^|[ \-_])(.)/){" " + $2.upcase}.strip
end