diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2017-01-09 17:27:26 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2017-01-09 17:27:26 -0500 |
commit | f582680627713f2b67c8506b4e3692d25b742298 (patch) | |
tree | 19fb135ba6b9bc000ac670acaaa3db1bcad4d08b /lib | |
parent | a70b39250252962df17670cee743d01d1a6f7c16 (diff) |
fix
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 |