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 ----------------------- 4 files changed, 27 insertions(+), 27 deletions(-) create mode 100644 lib/siteutil.rb delete mode 100644 lib/util.rb (limited to 'lib') 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 -- cgit v1.2.3