summaryrefslogtreecommitdiff
path: root/bin/util.rb
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2017-01-02 17:01:47 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2017-01-02 17:01:47 -0500
commit2c415a62e2579813278766e5903d347bf400e6f2 (patch)
treea848893e952904dbda5a90fc5b9a964a40f2e755 /bin/util.rb
parent3c80bf7cc1bd61f8c9edf4806f1e57611ba29fdd (diff)
better tags
Diffstat (limited to 'bin/util.rb')
-rw-r--r--bin/util.rb26
1 files changed, 25 insertions, 1 deletions
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?