summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-12-31 18:21:44 -0700
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-12-31 18:21:44 -0700
commit7445ea9d56071cfca247689e22c6fded65c3f968 (patch)
treefecb17db0eb37368c052e26d4e38a83d1ad5cb2b
parent7b11decd6a4b7f484ad35ae623941f21af7d31ec (diff)
fix breadcrumbs
-rw-r--r--Makefile2
-rw-r--r--bin/page.html.erb3
-rw-r--r--bin/util.rb17
-rw-r--r--src/DND/DND.scss (renamed from src/DND/DND.css)4
4 files changed, 21 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index d8adb8a..54f6d26 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ html.src = $(shell find src -type f \( -false $(foreach s,$(html.suffixes), -o -
# Translate the source filenames into output filenames
html.out = $(call patsubst-all,$(addprefix src/%.,$(html.suffixes)),out/%.html,$(html.src))
-all: $(html.out) out/main.css
+all: $(html.out) out/main.css out/DND/DND.css
bin/page = bin/page bin/util.rb bin/pandoc.rb
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
diff --git a/src/DND/DND.css b/src/DND/DND.scss
index b8cba44..1d4cc2a 100644
--- a/src/DND/DND.css
+++ b/src/DND/DND.scss
@@ -1,6 +1,6 @@
/* This bit is taken from the defaults of org-mode export */
-html { font-family: Times, serif; font-size: 12pt; }
+body > article { font-family: Times, serif; font-size: 12pt;
.title { text-align: center; }
.todo { color: red; }
.done { color: green; }
@@ -45,7 +45,7 @@ textarea { overflow-x: auto; }
white-space:nowrap; }
.org-info-js_search-highlight {background-color:#ffff00; color:#000000;
font-weight:bold; }
-
+}
/* Andrew wrote the following */
body > article {