summaryrefslogtreecommitdiff
path: root/lib/util.rb
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2017-01-06 19:50:45 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2017-01-06 19:50:45 -0500
commit7edb003cd1c9b53ffdff11ef85532e39f08db16d (patch)
tree180db82a4af7720508ae2732393401bf4d27cadf /lib/util.rb
parent7d875df65221d4da91953cf129a03e76fe8e5d29 (diff)
wip
Diffstat (limited to 'lib/util.rb')
-rw-r--r--lib/util.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/util.rb b/lib/util.rb
new file mode 100644
index 0000000..075ebb8
--- /dev/null
+++ b/lib/util.rb
@@ -0,0 +1,23 @@
+# coding: utf-8
+
+module Util
+ def self.html_escape(html)
+ html
+ .gsub('&', '&amp;')
+ .gsub('>', '&gt;')
+ .gsub('<', '&lt;')
+ end
+
+ def self.breadcrumbs(url)
+ # TODO
+ bc = []
+ u = url.path
+ u = "/" if u == ""
+ while u != "/"
+ bc.unshift("<a href=\"#{u}\">#{File::basename(u, File::extname(u))}</a>")
+ u = File::dirname(u)
+ end
+ bc.unshift("<a href=\"/\">Andrew D. Murrell</a>")
+ return bc.join(' ยป ')
+ end
+end