From 39a34b63b0615002172e7db314e2caf663404e09 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 9 Jan 2017 15:53:51 -0500 Subject: fixfixfix --- lib/page.rb | 6 +++--- lib/page_local.rb | 2 +- lib/siteutil.rb | 23 +++++++++++++++++++++++ lib/util.rb | 23 ----------------------- tmpl/page.html.erb | 21 ++++++++++----------- 5 files changed, 37 insertions(+), 38 deletions(-) create mode 100644 lib/siteutil.rb delete mode 100644 lib/util.rb diff --git a/lib/page.rb b/lib/page.rb index 130abdf..98223c5 100644 --- a/lib/page.rb +++ b/lib/page.rb @@ -65,11 +65,11 @@ class Page def years # => Enumerable if @years.nil? - if published.nil? || updated.nil? + if atom_published.nil? || atom_updated.nil? @years = Set[] else - first = published.year - last = updated.year + first = atom_published.year + last = atom_updated.year years = page_years years.add(first) diff --git a/lib/page_local.rb b/lib/page_local.rb index 7846a3b..ca3aa31 100644 --- a/lib/page_local.rb +++ b/lib/page_local.rb @@ -53,7 +53,7 @@ class LocalPage < Page # if the title was inferred from the the body content, # then it is already in the page. unless _pandoc['title'].nil? - @content += "

#{title}

\n" + @content += "

#{atom_title}

\n" end # Insert the body diff --git a/lib/siteutil.rb b/lib/siteutil.rb new file mode 100644 index 0000000..2b4eda7 --- /dev/null +++ b/lib/siteutil.rb @@ -0,0 +1,23 @@ +# coding: utf-8 + +module SiteUtil + def self.html_escape(html) + html + .gsub('&', '&') + .gsub('>', '>') + .gsub('<', '<') + end + + def self.breadcrumbs(url) + # TODO + bc = [] + u = url.path + u = "/" if u == "" + while u != "/" + bc.unshift("#{File::basename(u, File::extname(u))}") + u = File::dirname(u) + end + bc.unshift("Andrew D. Murrell") + return bc.join(' » ') + end +end diff --git a/lib/util.rb b/lib/util.rb deleted file mode 100644 index 075ebb8..0000000 --- a/lib/util.rb +++ /dev/null @@ -1,23 +0,0 @@ -# coding: utf-8 - -module Util - def self.html_escape(html) - html - .gsub('&', '&') - .gsub('>', '>') - .gsub('<', '<') - end - - def self.breadcrumbs(url) - # TODO - bc = [] - u = url.path - u = "/" if u == "" - while u != "/" - bc.unshift("#{File::basename(u, File::extname(u))}") - u = File::dirname(u) - end - bc.unshift("Andrew D. Murrell") - return bc.join(' » ') - end -end diff --git a/tmpl/page.html.erb b/tmpl/page.html.erb index e2dc9fe..dae08eb 100644 --- a/tmpl/page.html.erb +++ b/tmpl/page.html.erb @@ -1,15 +1,15 @@ - +<% require 'siteutil' %> - <%= @page.title %><% unless @page.title.empty? %> — <% end %>AndrewDM + <%= atom_title %> — AndrewDM - <%= @page.head %> + <%= html_head_extra %> - class="<%= @page.class %>"<% end %>> +
-

AndrewDM

+

<%= SiteUtil::breadcrumbs(url) %>

- +

- <% if @page.tags.count > 0 %>

Tags: <% @page.tags.each do |t| %><%= t.html %><% end %>

<% end %> - <% if @page.showtitle %>

<%= @page.title %>

<% end %> - <%= @page.content %> + <% if atom_categories.count > 0 %>

Tags: <% atom_categories.each do |t| %><%= t.html %><% end %>

<% end %> + <%= atom_content %>
-- cgit v1.2.3-2-g168b