diff options
-rw-r--r-- | lib/page.rb | 6 | ||||
-rw-r--r-- | lib/page_local.rb | 2 | ||||
-rw-r--r-- | lib/siteutil.rb (renamed from lib/util.rb) | 2 | ||||
-rw-r--r-- | tmpl/page.html.erb | 21 |
4 files changed, 15 insertions, 16 deletions
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<Fixnum> 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 += "<h1 class=title>#{title}</h1>\n" + @content += "<h1 class=title>#{atom_title}</h1>\n" end # Insert the body diff --git a/lib/util.rb b/lib/siteutil.rb index 075ebb8..2b4eda7 100644 --- a/lib/util.rb +++ b/lib/siteutil.rb @@ -1,6 +1,6 @@ # coding: utf-8 -module Util +module SiteUtil def self.html_escape(html) html .gsub('&', '&') 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 @@ -<!DOCTYPE html> +<% require 'siteutil' %><!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> - <title><%= @page.title %><% unless @page.title.empty? %> — <% end %>AndrewDM</title> + <title><%= atom_title %> — AndrewDM</title> <link rel="stylesheet" href="/main.css"> <link rel="alternate" type="application/atom+xml" href="/index.atom" /> - <%= @page.head %> + <%= html_head_extra %> </head> - <body<% if @page.class %> class="<%= @page.class %>"<% end %>> + <body class="<%= html_class %>"> <header> - <h1>AndrewDM</h1> + <h1 class=breadcrumbs><%= SiteUtil::breadcrumbs(url) %></h1> <nav> <ul> <li><a href="/">Projects</a> @@ -21,16 +21,15 @@ </form> </ul> </nav> - <p class=breadcrumbs><%= @page.breadcrumbs %></p> + <p </p> </header> <article> - <% if @page.tags.count > 0 %><p>Tags: <% @page.tags.each do |t| %><%= t.html %><% end %></p><% end %> - <% if @page.showtitle %><h1 class=title><%= @page.title %></h1><% end %> - <%= @page.content %> + <% if atom_categories.count > 0 %><p>Tags: <% atom_categories.each do |t| %><%= t.html %><% end %></p><% end %> + <%= atom_content %> </article> <footer> - <%= @page.rights %> - <p>Page source: <a href="<%= @url.route_to(@page.srcurl) %>"><%= File.basename(@page.srcurl.to_s) %></a></p> + <%= atom_rights %> + <p>Page source: <a href="<%= url.route_to(local_srcurl) %>"><%= File.basename(local_srcurl.to_s) %></a></p> <p>Website source: <a href="https://git.andrewdm.me/www.git">www.git</a></p> </footer> </body> |