summaryrefslogtreecommitdiff
path: root/lib/siteutil.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/siteutil.rb')
-rw-r--r--lib/siteutil.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/siteutil.rb b/lib/siteutil.rb
new file mode 100644
index 0000000..3f36ff2
--- /dev/null
+++ b/lib/siteutil.rb
@@ -0,0 +1,27 @@
+# coding: utf-8
+require 'config'
+require 'sitegen'
+
+module Sitegen
+ def self.html_escape(html)
+ html
+ .gsub('&', '&')
+ .gsub('>', '>')
+ .gsub('<', '&lt;')
+ end
+
+ def self.breadcrumbs(url)
+ path = url.path
+ path = "/" if path == ""
+ bc = []
+ while true
+ a = 'out'+path
+ b = ('out'+path+'/index.html').gsub('//', '/')
+ page = @mk[a] || @mk[b]
+ bc.unshift("<a href=\"#{url.route_to(page.url)}\">#{page.atom_title}</a>")
+ break if path == "/"
+ path = File::dirname(path)
+ end
+ return bc.join(' ยป ')
+ end
+end