summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/page.html.erb3
-rw-r--r--bin/util.rb17
2 files changed, 18 insertions, 2 deletions
diff --git a/bin/page.html.erb b/bin/page.html.erb
index 6f56573..a8e5154 100644
--- a/bin/page.html.erb
+++ b/bin/page.html.erb
@@ -10,7 +10,8 @@
<body>
<header>
<h1>Andrew D. Murrell</h1>
- <p><%= @page.breadcrumbs %></p>
+ <p><%= @page.breadcrumbs %>
+ (<a href="<%= File.basename(@page.src) %>"><%= File.extname(@page.src).upcase %></a>)</p>
<nav>
<ul>
<li><a href="/">Projects</a>
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