diff options
Diffstat (limited to 'util.rb')
-rw-r--r-- | util.rb | 51 |
1 files changed, 51 insertions, 0 deletions
@@ -0,0 +1,51 @@ +class Person + def initialize(name) + @name = name + end + def name + @name + end + def uri + $person_uris[@name] + end + def email + $person_emails[@name] + end + def html + if not email.nil? + return "<a href=\"mailto:#{email}\">#{name}</a>" + elsif not uri.nil? + return "<a href=\"#{uri}\">#{name}</a>" + else + return @name + end + end + def atom + ret = "" + ret += "<name>#{name}</name>" unless name.nil? + ret += "<uri>#{uri}</uri>" unless uri.nil? + ret += "<email>#{email}</email>" unless email.nil? + end +end + +class License + def initialize(name) + @name = name + end + def name + @name + end + def url + $license_urls[@name] + end + def html + "<a href=\"#{url}\">#{name}</a>" + end +end + +def html_escape(html) + html + .gsub('&', '&') + .gsub('>', '>') + .gsub('<', '<') +end |