diff options
-rw-r--r-- | Makefile | 18 | ||||
-rwxr-xr-x | bin/index | 19 | ||||
-rw-r--r-- | bin/index.atom.erb | 8 | ||||
-rw-r--r-- | bin/index.md.erb | 2 | ||||
-rw-r--r-- | bin/util.rb | 1 | ||||
-rw-r--r-- | out/dnd/index.atom | 26 | ||||
-rw-r--r-- | out/dnd/index.html | 4 | ||||
-rw-r--r-- | out/dnd/index.md | 2 | ||||
-rw-r--r-- | out/index.atom | 30 | ||||
-rw-r--r-- | src/dnd/index.yaml | 3 | ||||
-rw-r--r-- | src/index.yaml | 3 |
11 files changed, 64 insertions, 52 deletions
@@ -17,8 +17,6 @@ html.src = $(shell find src -type f \( -false $(foreach s,$(html.suffixes), -o - html.out = $(call patsubst-all,$(addprefix src/%.,$(html.suffixes)),out/%.html,$(html.src)) html.out += $(foreach d,$(sort $(dir $(patsubst src/%,out/%,$(html.src)))),$dindex.html $dindex.atom) -mydir = $(patsubst %/,%,$(patsubst out/%,%,$(dir $@))) - all: $(html.out) out/main.css .PHONY: all @@ -43,14 +41,14 @@ out/%.css: src/%.scss out/%.css: out/%.scss scss --stdin < $< > $@ -out/index.md : $(bin/index) bin/index.md.erb .var.html.src $(html.src) bin/write-atomic - bin/index md '$(mydir)' $(filter $(patsubst out%,src%,$(@D))/%,$^) | bin/write-atomic $@ -out/%/index.md : $(bin/index) bin/index.md.erb .var.html.src $(html.src) bin/write-atomic - bin/index md '$(mydir)' $(filter $(patsubst out%,src%,$(@D))/%,$^) | bin/write-atomic $@ -out/index.atom : $(bin/index) bin/index.atom.erb .var.html.src $(html.src) bin/write-atomic - bin/index atom '$(mydir)' $(filter $(patsubst out%,src%,$(@D))/%,$^) | bin/write-atomic $@ -out/%/index.atom: $(bin/index) bin/index.atom.erb .var.html.src $(html.src) bin/write-atomic - bin/index atom '$(mydir)' $(filter $(patsubst out%,src%,$(@D))/%,$^) | bin/write-atomic $@ +index.all = $(html.src) $(shell find src -type f -name index.yaml) +index.filter = $(filter-out %/index.yaml,$(filter $(@D)/% $(patsubst out%,src%,$(@D))/%,$1)) +index.cmd = bin/index $(patsubst .%,%,$(suffix $@)) $(@D) $(call index.filter,$^) | bin/write-atomic $@ +index.dep = $(bin/index) bin/index.$1.erb .var.index.all $(index.all) bin/write-atomic Makefile +out/index.md : $(call index.dep,md) ; $(index.cmd) +out/%/index.md : $(call index.dep,md) ; $(index.cmd) +out/index.atom : $(call index.dep,atom) ; $(index.cmd) +out/%/index.atom : $(call index.dep,atom) ; $(index.cmd) serve: serve-8000 serve-%: all @@ -1,16 +1,29 @@ #!/usr/bin/env ruby # -*- coding: utf-8 -*- load 'util.rb' +require 'yaml' +# ARGV[0] template = "bin/index.#{ARGV.shift}.erb" +erb = ERB.new(File.read(template)); +erb.filename = template + +# ARGV[1] @path = ARGV.shift +indexyaml = @path.sub('out', 'src')+'/index.yaml' +if File.exists?(indexyaml) + metadata = YAML::load(File.read(indexyaml)) +else + metadata = {} +end + +# ARGV[2..] @pages = [] for filename in ARGV do @pages.push(Page.new(filename)) end - -erb = ERB.new(File.read(template)); -erb.filename = template +# main +@title = metadata['title'] || @path.sub('out', '') erb.run() diff --git a/bin/index.atom.erb b/bin/index.atom.erb index 0667088..1afbf8c 100644 --- a/bin/index.atom.erb +++ b/bin/index.atom.erb @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> - <title>AndrewDM.me <%= @path %></title> + <title>AndrewDM.me <%= @title %></title> <link rel="self" type="application/atom+xml" href="./index.atom"/> <link rel="alternate" type="text/html" href="./"/> <link rel="alternate" type="text/markdown" href="./index.md"/> @@ -11,9 +11,9 @@ <% @pages.sort_by{|p| p.updated}.reverse.each do |page| %> <entry xmlns="http://www.w3.org/2005/Atom"> - <link rel="alternate" type="text/html" href="./<%= page.slug %>.html"/> - <link rel="alternate" type="text/markdown" href="./<%= page.slug %>.md"/> - <id>https://lukeshu.com/blog/<%= page.slug %>.html</id> + <link rel="alternate" type="text/html" href="<%= page.url %>.html"/> + <link rel="alternate" type="text/markdown" href="<%= page.url %>.md"/> + <id>https://andrewdm.me/<%= page.url %></id> <updated><%= page.updated.rfc3339 %></updated> <published><%= page.published.rfc3339 %></published> <title><%= page.title %></title> diff --git a/bin/index.md.erb b/bin/index.md.erb index 621a323..ce5e030 100644 --- a/bin/index.md.erb +++ b/bin/index.md.erb @@ -1,5 +1,5 @@ --- -title: "<%= @path %>" +title: "<%= @title %>" class: "index" --- diff --git a/bin/util.rb b/bin/util.rb index 1318f28..05808b7 100644 --- a/bin/util.rb +++ b/bin/util.rb @@ -115,7 +115,6 @@ class Page def author ; @author ||= Person.new( pandoc['author'] || "Andrew Murrell") ; end def license ; @license ||= License.new(pandoc['license'] || "CC BY-SA-3.0") ; end - 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 class ; @class ||= pandoc['class'] ; end diff --git a/out/dnd/index.atom b/out/dnd/index.atom index 0688a32..3ba47a8 100644 --- a/out/dnd/index.atom +++ b/out/dnd/index.atom @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> - <title>AndrewDM.me dnd</title> + <title>AndrewDM.me Dungeons & Dragons</title> <link rel="self" type="application/atom+xml" href="./index.atom"/> <link rel="alternate" type="text/html" href="./"/> <link rel="alternate" type="text/markdown" href="./index.md"/> @@ -11,9 +11,9 @@ <entry xmlns="http://www.w3.org/2005/Atom"> - <link rel="alternate" type="text/html" href="./PsionicSchools.html"/> - <link rel="alternate" type="text/markdown" href="./PsionicSchools.md"/> - <id>https://lukeshu.com/blog/PsionicSchools.html</id> + <link rel="alternate" type="text/html" href="/dnd/PsionicSchools.html.html"/> + <link rel="alternate" type="text/markdown" href="/dnd/PsionicSchools.html.md"/> + <id>https://andrewdm.me//dnd/PsionicSchools.html</id> <updated>2017-01-03T19:05:27-05:00</updated> <published>2017-01-03T19:05:27-05:00</published> <title>Schools of Psionics</title> @@ -95,9 +95,9 @@ </entry> <entry xmlns="http://www.w3.org/2005/Atom"> - <link rel="alternate" type="text/html" href="./SpellGauntlet.html"/> - <link rel="alternate" type="text/markdown" href="./SpellGauntlet.md"/> - <id>https://lukeshu.com/blog/SpellGauntlet.html</id> + <link rel="alternate" type="text/html" href="/dnd/SpellGauntlet.html.html"/> + <link rel="alternate" type="text/markdown" href="/dnd/SpellGauntlet.html.md"/> + <id>https://andrewdm.me//dnd/SpellGauntlet.html</id> <updated>2017-01-03T19:05:27-05:00</updated> <published>2017-01-03T19:05:27-05:00</published> <title>Spell Gauntlet: Practical Spellcasting</title> @@ -282,9 +282,9 @@ </entry> <entry xmlns="http://www.w3.org/2005/Atom"> - <link rel="alternate" type="text/html" href="./Tastavi.html"/> - <link rel="alternate" type="text/markdown" href="./Tastavi.md"/> - <id>https://lukeshu.com/blog/Tastavi.html</id> + <link rel="alternate" type="text/html" href="/dnd/Tastavi.html.html"/> + <link rel="alternate" type="text/markdown" href="/dnd/Tastavi.html.md"/> + <id>https://andrewdm.me//dnd/Tastavi.html</id> <updated>2016-08-30T00:00:00+00:00</updated> <published>2016-08-30T00:00:00+00:00</published> <title>Tastavi D'Maelnor of Llolethane</title> @@ -1656,9 +1656,9 @@ He lay upon the ground thinking it maybe better he have died quickly in the tunn </entry> <entry xmlns="http://www.w3.org/2005/Atom"> - <link rel="alternate" type="text/html" href="./Psionist.html"/> - <link rel="alternate" type="text/markdown" href="./Psionist.md"/> - <id>https://lukeshu.com/blog/Psionist.html</id> + <link rel="alternate" type="text/html" href="/dnd/Psionist.html.html"/> + <link rel="alternate" type="text/markdown" href="/dnd/Psionist.html.md"/> + <id>https://andrewdm.me//dnd/Psionist.html</id> <updated>2016-07-16T00:00:00+00:00</updated> <published>2016-07-16T00:00:00+00:00</published> <title>Psionist</title> diff --git a/out/dnd/index.html b/out/dnd/index.html index f3b0bf4..37ec724 100644 --- a/out/dnd/index.html +++ b/out/dnd/index.html @@ -2,7 +2,7 @@ <html lang="en"> <head> <meta charset="utf-8"> - <title>dnd — AndrewDM</title> + <title>Dungeons & Dragons — AndrewDM</title> <link rel="stylesheet" href="/main.css"> <link rel="alternate" type="application/atom+xml" href="./index.atom" name="web log entries"/> @@ -25,7 +25,7 @@ </header> <article> - <h1 class=title>dnd</h1> + <h1 class=title>Dungeons & Dragons</h1> <ul> <li><a href="/dnd/PsionicSchools.html" title="Published on 2017-01-03">Schools of Psionics</a><span><a class="tag ES" href="/tags/ES.html">Essay</a><a class="tag HB" href="/tags/HB.html">Homebrew</a></span></li> <li><a href="/dnd/SpellGauntlet.html" title="Published on 2017-01-03">Spell Gauntlet: Practical Spellcasting</a><span><a class="tag FF" href="/tags/FF.html">Flash Fiction</a><a class="tag SS" href="/tags/SS.html">Short Story</a><a class="tag WP" href="/tags/WP.html">WIP</a></span></li> diff --git a/out/dnd/index.md b/out/dnd/index.md index edd0226..6998c1c 100644 --- a/out/dnd/index.md +++ b/out/dnd/index.md @@ -1,5 +1,5 @@ --- -title: "dnd" +title: "Dungeons & Dragons" class: "index" --- diff --git a/out/index.atom b/out/index.atom index 859062d..2616e21 100644 --- a/out/index.atom +++ b/out/index.atom @@ -11,9 +11,9 @@ <entry xmlns="http://www.w3.org/2005/Atom"> - <link rel="alternate" type="text/html" href="./PsionicSchools.html"/> - <link rel="alternate" type="text/markdown" href="./PsionicSchools.md"/> - <id>https://lukeshu.com/blog/PsionicSchools.html</id> + <link rel="alternate" type="text/html" href="/dnd/PsionicSchools.html.html"/> + <link rel="alternate" type="text/markdown" href="/dnd/PsionicSchools.html.md"/> + <id>https://andrewdm.me//dnd/PsionicSchools.html</id> <updated>2017-01-03T19:05:27-05:00</updated> <published>2017-01-03T19:05:27-05:00</published> <title>Schools of Psionics</title> @@ -95,9 +95,9 @@ </entry> <entry xmlns="http://www.w3.org/2005/Atom"> - <link rel="alternate" type="text/html" href="./SpellGauntlet.html"/> - <link rel="alternate" type="text/markdown" href="./SpellGauntlet.md"/> - <id>https://lukeshu.com/blog/SpellGauntlet.html</id> + <link rel="alternate" type="text/html" href="/dnd/SpellGauntlet.html.html"/> + <link rel="alternate" type="text/markdown" href="/dnd/SpellGauntlet.html.md"/> + <id>https://andrewdm.me//dnd/SpellGauntlet.html</id> <updated>2017-01-03T19:05:27-05:00</updated> <published>2017-01-03T19:05:27-05:00</published> <title>Spell Gauntlet: Practical Spellcasting</title> @@ -282,9 +282,9 @@ </entry> <entry xmlns="http://www.w3.org/2005/Atom"> - <link rel="alternate" type="text/html" href="./Andrew.html"/> - <link rel="alternate" type="text/markdown" href="./Andrew.md"/> - <id>https://lukeshu.com/blog/Andrew.html</id> + <link rel="alternate" type="text/html" href="/Andrew.html.html"/> + <link rel="alternate" type="text/markdown" href="/Andrew.html.md"/> + <id>https://andrewdm.me//Andrew.html</id> <updated>2016-12-31T17:43:33-07:00</updated> <published>2016-12-31T17:43:33-07:00</published> <title>Hello Internet Person!</title> @@ -298,9 +298,9 @@ </entry> <entry xmlns="http://www.w3.org/2005/Atom"> - <link rel="alternate" type="text/html" href="./Tastavi.html"/> - <link rel="alternate" type="text/markdown" href="./Tastavi.md"/> - <id>https://lukeshu.com/blog/Tastavi.html</id> + <link rel="alternate" type="text/html" href="/dnd/Tastavi.html.html"/> + <link rel="alternate" type="text/markdown" href="/dnd/Tastavi.html.md"/> + <id>https://andrewdm.me//dnd/Tastavi.html</id> <updated>2016-08-30T00:00:00+00:00</updated> <published>2016-08-30T00:00:00+00:00</published> <title>Tastavi D'Maelnor of Llolethane</title> @@ -1672,9 +1672,9 @@ He lay upon the ground thinking it maybe better he have died quickly in the tunn </entry> <entry xmlns="http://www.w3.org/2005/Atom"> - <link rel="alternate" type="text/html" href="./Psionist.html"/> - <link rel="alternate" type="text/markdown" href="./Psionist.md"/> - <id>https://lukeshu.com/blog/Psionist.html</id> + <link rel="alternate" type="text/html" href="/dnd/Psionist.html.html"/> + <link rel="alternate" type="text/markdown" href="/dnd/Psionist.html.md"/> + <id>https://andrewdm.me//dnd/Psionist.html</id> <updated>2016-07-16T00:00:00+00:00</updated> <published>2016-07-16T00:00:00+00:00</published> <title>Psionist</title> diff --git a/src/dnd/index.yaml b/src/dnd/index.yaml index 6e83a31..a0a0868 100644 --- a/src/dnd/index.yaml +++ b/src/dnd/index.yaml @@ -1,5 +1,6 @@ +title: "Dungeons & Dragons" external: - title: "Waterdeep Bazaar: Marketplace Generator" - url: "/dnd/WaterdeepBazaar/WaterdeepBazaar.html" + url: "dnd/WaterdeepBazaar/WaterdeepBazaar.html" published: "2015-12-14" tags: [DM, WP] diff --git a/src/index.yaml b/src/index.yaml index 3532b53..c61e1b6 100644 --- a/src/index.yaml +++ b/src/index.yaml @@ -1,3 +1,4 @@ +title: "" sections: "writing": "Writing" "dnd": "Dungeons & Dragons" @@ -8,6 +9,6 @@ external: published: "2013-12-03" tags: [FF] - title: "Waterdeep Bazaar: Marketplace Generator" - url: "/dnd/WaterdeepBazaar/WaterdeepBazaar.html" + url: "dnd/WaterdeepBazaar/WaterdeepBazaar.html" published: "2015-12-14" tags: [DM, WP] |