diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/siteutil.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/siteutil.rb b/lib/siteutil.rb index 2b4eda7..3f36ff2 100644 --- a/lib/siteutil.rb +++ b/lib/siteutil.rb @@ -1,6 +1,8 @@ # coding: utf-8 +require 'config' +require 'sitegen' -module SiteUtil +module Sitegen def self.html_escape(html) html .gsub('&', '&') @@ -9,15 +11,17 @@ module SiteUtil end def self.breadcrumbs(url) - # TODO + path = url.path + path = "/" if path == "" 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) + 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 - bc.unshift("<a href=\"/\">Andrew D. Murrell</a>") return bc.join(' ยป ') end end |