summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/index8
-rw-r--r--bin/index.atom.erb7
-rw-r--r--bin/index.md.erb2
-rwxr-xr-xbin/page2
-rw-r--r--bin/page.html.erb2
-rw-r--r--bin/util.rb22
-rw-r--r--out/dnd/index.atom22
-rw-r--r--out/dnd/index.html10
-rw-r--r--out/dnd/index.md8
-rw-r--r--out/index.atom27
-rw-r--r--out/index.html12
-rw-r--r--out/index.md10
12 files changed, 68 insertions, 64 deletions
diff --git a/bin/index b/bin/index
index 2443380..dc57798 100755
--- a/bin/index
+++ b/bin/index
@@ -4,12 +4,18 @@ load 'util.rb'
require 'yaml'
# ARGV[0]
-template = "bin/index.#{ARGV.shift}.erb"
+type = ARGV.shift
+template = "bin/index.#{type}.erb"
erb = ERB.new(File.read(template));
erb.filename = template
# ARGV[1]
@path = ARGV.shift
+webpath = (@path+'/').sub(/^(src|out)\//, '/')
+if type == 'atom'
+ webpath += 'index.atom'
+end
+@url = URI::parse('https://www.andrewdm.me') + webpath
indexyaml = @path.sub('out', 'src')+'/index.yaml'
if File.exists?(indexyaml)
diff --git a/bin/index.atom.erb b/bin/index.atom.erb
index 1afbf8c..c02f709 100644
--- a/bin/index.atom.erb
+++ b/bin/index.atom.erb
@@ -7,13 +7,12 @@
<link rel="alternate" type="text/markdown" href="./index.md"/>
<updated><%= @pages.map{|p|p.updated}.sort.last.rfc3339 %></updated>
<author><%= Person.new("Andrew Murrell").atom %></author>
- <id>https://lukeshu.com/blog/</id>
+ <id><%= $url %></id>
<% @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.url %>.html"/>
- <link rel="alternate" type="text/markdown" href="<%= page.url %>.md"/>
- <id>https://andrewdm.me/<%= page.url %></id>
+ <link rel="alternate" type="text/html" href="<%= page.url %>"/>
+ <id><%= 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 ce5e030..34f8677 100644
--- a/bin/index.md.erb
+++ b/bin/index.md.erb
@@ -4,4 +4,4 @@ class: "index"
---
<% @pages.sort_by{|a|a.published}.reverse.each do |a| %>
- * <a href="<%= a.url %>" title="Published on <%= a.published.strftime('%Y-%m-%d') %><% if a.updated != a.published %> (updated on<%= a.updated.strftime('%Y-%m-%d') %>)<% end %>"><%= a.title %></a><span><% a.tags.each do |t| %><%= t.html %><% end %></span><% end %>
+ * <a href="<%= @url.route_to(a.url) %>" title="Published on <%= a.published.strftime('%Y-%m-%d') %><% if a.updated != a.published %> (updated on<%= a.updated.strftime('%Y-%m-%d') %>)<% end %>"><%= a.title %></a><span><% a.tags.each do |t| %><%= t.html %><% end %></span><% end %>
diff --git a/bin/page b/bin/page
index ca8b5bd..1b631cf 100755
--- a/bin/page
+++ b/bin/page
@@ -1,9 +1,11 @@
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
load 'util.rb'
+require 'uri'
template = "bin/page.#{ARGV[0]}.erb"
@page = Page.new(ARGV[1])
+@url = URI::parse('https://www.andrewdm.me') + @page.absoutpath
erb = ERB.new(File.read(template));
erb.filename = template
diff --git a/bin/page.html.erb b/bin/page.html.erb
index 354b123..49be4e8 100644
--- a/bin/page.html.erb
+++ b/bin/page.html.erb
@@ -30,7 +30,7 @@
</article>
<footer>
<%= @page.rights %>
- <p>Page source: <a href="<%= File.basename(@page.src) %>"><%= File.basename(@page.src) %></a></p>
+ <p>Page source: <a href="<%= @url.route_to(@page.srcurl) %>"><%= File.basename(@page.srcurl.to_s) %></a></p>
<p>Website source: <a href="https://git.andrewdm.me/www.git">www.git</a></p>
</footer>
</body>
diff --git a/bin/util.rb b/bin/util.rb
index 05808b7..2cfc63e 100644
--- a/bin/util.rb
+++ b/bin/util.rb
@@ -3,6 +3,7 @@ load 'pandoc.rb'
require 'erb'
require 'date'
require 'set'
+require 'uri'
$license_urls = {
"CC BY-SA-3.0" => 'https://creativecommons.org/licenses/by-sa/3.0/',
@@ -26,6 +27,8 @@ $tag_names = {
"WP" => "WIP",
}
+$url = URI::parse('https://www.andrewdm.me')
+
class Tag
def initialize(abbr)
@abbr = abbr
@@ -178,22 +181,25 @@ class Page
"<p>This page is licensed under the #{license.html} license.</p>"
end
- def src
- @src ||= infile.sub(/^(src|out)\//, '/')
+ def abssrcpath
+ @srcpath ||= infile.sub(/^(src|out)\//, '/')
+ end
+ def absoutpath
+ @outpath ||= abssrcpath.sub(/\.[^\/.]*$/, '.html').sub(/\/index[.]html$/, '')
end
def url
- if @url.nil?
- u = src.sub(/\.[^\/.]*$/, '.html').sub(/\/index[.]html$/, '')
- @url = u == '' ? '/' : u
- end
- @url
+ @url ||= $url + absoutpath
+ end
+ def srcurl
+ @srcurl ||= $url + abssrcpath
end
def breadcrumbs
if @breadcrumbs.nil?
bc = []
- u = url
+ u = url.path
+ u = "/" if u == ""
while u != "/"
bc.unshift("<a href=\"#{u}\">#{File.basename(u, File.extname(u))}</a>")
u = File.dirname(u)
diff --git a/out/dnd/index.atom b/out/dnd/index.atom
index 3ba47a8..656b2af 100644
--- a/out/dnd/index.atom
+++ b/out/dnd/index.atom
@@ -7,13 +7,12 @@
<link rel="alternate" type="text/markdown" href="./index.md"/>
<updated>2017-01-03T19:05:27-05:00</updated>
<author><name>Andrew Murrell</name><uri>https://andrewdm.me/</uri><email>ImFromNASA@gmail.com</email></author>
- <id>https://lukeshu.com/blog/</id>
+ <id>https://www.andrewdm.me</id>
<entry xmlns="http://www.w3.org/2005/Atom">
- <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>
+ <link rel="alternate" type="text/html" href="https://www.andrewdm.me/dnd/PsionicSchools.html"/>
+ <id>https://www.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 +94,8 @@
</entry>
<entry xmlns="http://www.w3.org/2005/Atom">
- <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>
+ <link rel="alternate" type="text/html" href="https://www.andrewdm.me/dnd/SpellGauntlet.html"/>
+ <id>https://www.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 +280,8 @@
</entry>
<entry xmlns="http://www.w3.org/2005/Atom">
- <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>
+ <link rel="alternate" type="text/html" href="https://www.andrewdm.me/dnd/Tastavi.html"/>
+ <id>https://www.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 +1653,8 @@ 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="/dnd/Psionist.html.html"/>
- <link rel="alternate" type="text/markdown" href="/dnd/Psionist.html.md"/>
- <id>https://andrewdm.me//dnd/Psionist.html</id>
+ <link rel="alternate" type="text/html" href="https://www.andrewdm.me/dnd/Psionist.html"/>
+ <id>https://www.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 37ec724..a11dc3e 100644
--- a/out/dnd/index.html
+++ b/out/dnd/index.html
@@ -27,17 +27,17 @@
<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>
-<li><a href="/dnd/Tastavi.html" title="Published on 2016-08-30">Tastavi D'Maelnor of Llolethane</a><span><a class="tag SS" href="/tags/SS.html">Short Story</a></span></li>
-<li><a href="/dnd/Psionist.html" title="Published on 2016-07-16">Psionist</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="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="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>
+<li><a href="Tastavi.html" title="Published on 2016-08-30">Tastavi D'Maelnor of Llolethane</a><span><a class="tag SS" href="/tags/SS.html">Short Story</a></span></li>
+<li><a href="Psionist.html" title="Published on 2016-07-16">Psionist</a><span><a class="tag ES" href="/tags/ES.html">Essay</a><a class="tag HB" href="/tags/HB.html">Homebrew</a></span></li>
</ul>
</article>
<footer>
<p>The content of this page is Copyright © <a href="mailto:ImFromNASA@gmail.com">Andrew Murrell</a>.</p>
<p>This page is licensed under the <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA-3.0</a> license.</p>
- <p>Page source: <a href="index.md">index.md</a></p>
+ <p>Page source: <a href="dnd/index.md">index.md</a></p>
<p>Website source: <a href="https://git.andrewdm.me/www.git">www.git</a></p>
</footer>
</body>
diff --git a/out/dnd/index.md b/out/dnd/index.md
index 6998c1c..d18554c 100644
--- a/out/dnd/index.md
+++ b/out/dnd/index.md
@@ -4,7 +4,7 @@ class: "index"
---
- * <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>
- * <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>
- * <a href="/dnd/Tastavi.html" title="Published on 2016-08-30">Tastavi D'Maelnor of Llolethane</a><span><a class="tag SS" href="/tags/SS.html">Short Story</a></span>
- * <a href="/dnd/Psionist.html" title="Published on 2016-07-16">Psionist</a><span><a class="tag ES" href="/tags/ES.html">Essay</a><a class="tag HB" href="/tags/HB.html">Homebrew</a></span>
+ * <a href="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>
+ * <a href="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>
+ * <a href="Tastavi.html" title="Published on 2016-08-30">Tastavi D'Maelnor of Llolethane</a><span><a class="tag SS" href="/tags/SS.html">Short Story</a></span>
+ * <a href="Psionist.html" title="Published on 2016-07-16">Psionist</a><span><a class="tag ES" href="/tags/ES.html">Essay</a><a class="tag HB" href="/tags/HB.html">Homebrew</a></span>
diff --git a/out/index.atom b/out/index.atom
index 2616e21..8c0349c 100644
--- a/out/index.atom
+++ b/out/index.atom
@@ -7,13 +7,12 @@
<link rel="alternate" type="text/markdown" href="./index.md"/>
<updated>2017-01-03T19:05:27-05:00</updated>
<author><name>Andrew Murrell</name><uri>https://andrewdm.me/</uri><email>ImFromNASA@gmail.com</email></author>
- <id>https://lukeshu.com/blog/</id>
+ <id>https://www.andrewdm.me</id>
<entry xmlns="http://www.w3.org/2005/Atom">
- <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>
+ <link rel="alternate" type="text/html" href="https://www.andrewdm.me/dnd/PsionicSchools.html"/>
+ <id>https://www.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 +94,8 @@
</entry>
<entry xmlns="http://www.w3.org/2005/Atom">
- <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>
+ <link rel="alternate" type="text/html" href="https://www.andrewdm.me/dnd/SpellGauntlet.html"/>
+ <id>https://www.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 +280,8 @@
</entry>
<entry xmlns="http://www.w3.org/2005/Atom">
- <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>
+ <link rel="alternate" type="text/html" href="https://www.andrewdm.me/Andrew.html"/>
+ <id>https://www.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 +295,8 @@
</entry>
<entry xmlns="http://www.w3.org/2005/Atom">
- <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>
+ <link rel="alternate" type="text/html" href="https://www.andrewdm.me/dnd/Tastavi.html"/>
+ <id>https://www.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 +1668,8 @@ 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="/dnd/Psionist.html.html"/>
- <link rel="alternate" type="text/markdown" href="/dnd/Psionist.html.md"/>
- <id>https://andrewdm.me//dnd/Psionist.html</id>
+ <link rel="alternate" type="text/html" href="https://www.andrewdm.me/dnd/Psionist.html"/>
+ <id>https://www.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/index.html b/out/index.html
index 49e59df..c631c8a 100644
--- a/out/index.html
+++ b/out/index.html
@@ -27,18 +27,18 @@
<h1 class=title></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>
-<li><a href="/Andrew.html" title="Published on 2016-12-31">Hello Internet Person!</a><span></span></li>
-<li><a href="/dnd/Tastavi.html" title="Published on 2016-08-30">Tastavi D'Maelnor of Llolethane</a><span><a class="tag SS" href="/tags/SS.html">Short Story</a></span></li>
-<li><a href="/dnd/Psionist.html" title="Published on 2016-07-16">Psionist</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/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>
+<li><a href="Andrew.html" title="Published on 2016-12-31">Hello Internet Person!</a><span></span></li>
+<li><a href="dnd/Tastavi.html" title="Published on 2016-08-30">Tastavi D'Maelnor of Llolethane</a><span><a class="tag SS" href="/tags/SS.html">Short Story</a></span></li>
+<li><a href="dnd/Psionist.html" title="Published on 2016-07-16">Psionist</a><span><a class="tag ES" href="/tags/ES.html">Essay</a><a class="tag HB" href="/tags/HB.html">Homebrew</a></span></li>
</ul>
</article>
<footer>
<p>The content of this page is Copyright © <a href="mailto:ImFromNASA@gmail.com">Andrew Murrell</a>.</p>
<p>This page is licensed under the <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA-3.0</a> license.</p>
- <p>Page source: <a href="index.md">index.md</a></p>
+ <p>Page source: <a href="/index.md">index.md</a></p>
<p>Website source: <a href="https://git.andrewdm.me/www.git">www.git</a></p>
</footer>
</body>
diff --git a/out/index.md b/out/index.md
index c68c94c..0727f52 100644
--- a/out/index.md
+++ b/out/index.md
@@ -4,8 +4,8 @@ class: "index"
---
- * <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>
- * <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>
- * <a href="/Andrew.html" title="Published on 2016-12-31">Hello Internet Person!</a><span></span>
- * <a href="/dnd/Tastavi.html" title="Published on 2016-08-30">Tastavi D'Maelnor of Llolethane</a><span><a class="tag SS" href="/tags/SS.html">Short Story</a></span>
- * <a href="/dnd/Psionist.html" title="Published on 2016-07-16">Psionist</a><span><a class="tag ES" href="/tags/ES.html">Essay</a><a class="tag HB" href="/tags/HB.html">Homebrew</a></span>
+ * <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>
+ * <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>
+ * <a href="Andrew.html" title="Published on 2016-12-31">Hello Internet Person!</a><span></span>
+ * <a href="dnd/Tastavi.html" title="Published on 2016-08-30">Tastavi D'Maelnor of Llolethane</a><span><a class="tag SS" href="/tags/SS.html">Short Story</a></span>
+ * <a href="dnd/Psionist.html" title="Published on 2016-07-16">Psionist</a><span><a class="tag ES" href="/tags/ES.html">Essay</a><a class="tag HB" href="/tags/HB.html">Homebrew</a></span>