diff options
-rw-r--r-- | bin/index.md.erb | 2 | ||||
-rw-r--r-- | bin/page.html.erb | 4 | ||||
-rw-r--r-- | bin/util.rb | 26 | ||||
-rw-r--r-- | src/main.scss | 13 | ||||
-rw-r--r-- | src/tags.txt | 6 |
5 files changed, 34 insertions, 17 deletions
diff --git a/bin/index.md.erb b/bin/index.md.erb index a9419ba..f7a463b 100644 --- a/bin/index.md.erb +++ b/bin/index.md.erb @@ -3,4 +3,4 @@ title: "<%= @path %>" --- <% @pages.sort_by{|a|a.published}.reverse.each do |a| %> - * <time><%= a.published.strftime('%Y-%m-%d') %></time> - [<%= a.title %>](<%= a.url %>) (last updated <time><%= a.updated.strftime('%Y-%m-%d') %></time>)<% end %> + * <time><%= a.published.strftime('%Y-%m-%d') %></time> - [<%= a.title %>](<%= a.url %>)<% if a.updated != a.published %> (last updated <time><%= a.updated.strftime('%Y-%m-%d') %></time>)<% end %> <% a.tags.each do |t| %><%= t.html %><% end %><% end %> diff --git a/bin/page.html.erb b/bin/page.html.erb index 8317282..908790c 100644 --- a/bin/page.html.erb +++ b/bin/page.html.erb @@ -2,7 +2,7 @@ <html lang="en"> <head> <meta charset="utf-8"> - <title><%= @page.title %></title> + <title><%= @page.title %><% unless @page.title.empty? %> — <% end %>AndrewDM</title> <link rel="stylesheet" href="/main.css"> <link rel="alternate" type="application/atom+xml" href="./index.atom" name="web log entries"/> <%= @page.head %> @@ -24,7 +24,7 @@ </nav> </header> <article> - <% if @page.tags.count > 0 %><p>Tags: <%= @page.tags.join(' ') %></p><% end %> + <% if @page.tags.count > 0 %><p>Tags: <% @page.tags.each do |t| %><%= t.html %><% end %></p><% end %> <% if @page.showtitle %><h1 class=title><%= @page.title %></h1><% end %> <%= @page.content %> </article> diff --git a/bin/util.rb b/bin/util.rb index 3ded48e..7b4805f 100644 --- a/bin/util.rb +++ b/bin/util.rb @@ -17,6 +17,30 @@ $person_emails = { "Andrew Murrell" => "ImFromNASA@gmail.com", } +$tag_names = { + "DM" => "DMing Resource", + "ES" => "Essay", + "FF" => "Flash Fiction", + "HB" => "Homebrew", + "SS" => "Short Story", + "WP" => "WIP", +} + +class Tag + def initialize(abbr) + @abbr = abbr + end + def abbr + @abbr + end + def name + $tag_names[@abbr] + end + def html + return "<a class=\"tag #{abbr}\" href=\"/tags/#{abbr}.html\">#{name}</a>" + end +end + class Person def initialize(name) @name = name @@ -94,7 +118,7 @@ class Page def slug ; @slug ||= infile.sub(/\..*$/,'').sub(/^.*\//,'') ; end def content ; @content ||= pandoc.to('html5 '+(pandoc['pandoc_flags']||'')) ; end def head ; @head ||= pandoc['html_head_extra'] ; end - def tags ; @tags ||= (pandoc['tags'] || '').split ; end + def tags ; @tags ||= (pandoc['tags'] || '').split.map{|tag|Tag.new(tag)} ; end def published if @published.nil? diff --git a/src/main.scss b/src/main.scss index 9a89e6d..4f5efc9 100644 --- a/src/main.scss +++ b/src/main.scss @@ -120,13 +120,12 @@ article { text-decoration: none; color: white; } - - .FF { background: FireBrick; } - .SS { background: SeaGreen; } - .ES { background: DarkViolet; } - .HB { background: DimGray; } - .DM { background: DarkSlateGray; } - .WP { background: GhostWhite; color: black; } + .tag.FF { background: FireBrick; } + .tag.SS { background: SeaGreen; } + .tag.ES { background: DarkViolet; } + .tag.HB { background: DimGray; } + .tag.DM { background: DarkSlateGray; } + .tag.WP { background: GhostWhite; color: black; } border-bottom: solid 1px #333333; } diff --git a/src/tags.txt b/src/tags.txt deleted file mode 100644 index ee5d25c..0000000 --- a/src/tags.txt +++ /dev/null @@ -1,6 +0,0 @@ -DM DMing Resource -ES Essay -FF Flash Fiction -HB Homebrew -SS Short Story -WP WIP |