diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-08-27 17:36:46 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-08-27 17:36:46 -0400 |
commit | b373a3a6e1702e7514bb405122a2311d16d85fcd (patch) | |
tree | 1b8ededef1b8ac60ec3b1a8a347cfc1669f61bb1 /util.rb | |
parent | d4359dc767d3524a16f529f3545d89ab558e1b8f (diff) |
Teach it to make atom:entry files
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 |