summaryrefslogtreecommitdiff
path: root/bin/util.rb
diff options
context:
space:
mode:
Diffstat (limited to 'bin/util.rb')
-rw-r--r--bin/util.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/bin/util.rb b/bin/util.rb
index ce91007..d95ddba 100644
--- a/bin/util.rb
+++ b/bin/util.rb
@@ -98,8 +98,23 @@ class Page
"<p>This page is licensed under the #{license.html} license.</p>"
end
+ def src
+ @src ||= infile.sub(/^(src|out)\//, '/')
+ end
+
def breadcrumbs
- @breadcrumbs ||= '<a href="/">Andrew Murrell</a> » ' + ( (slug == 'index') ? "blog" : "<a href=/blog>blog</a> » #{slug}" )
+ if @breadcrumbs.nil?
+ bc = []
+ url = src.sub(/\.[^\/.]*$/, '.html').sub(/\/index[.]html$/, '')
+ url = '/' if url == ''
+ while url != "/"
+ bc.unshift("<a href=\"#{url}\">#{File.basename(url, File.extname(url))}</a>")
+ url = File.dirname(url)
+ end
+ bc.unshift("<a href=\"#{url}\">Andrew D. Murrell</a>")
+ @breadcrumbs = bc.join(' » ')
+ end
+ @breadcrumbs
end
end