]> git.draconx.ca Git - homepage.git/blobdiff - layouts/default.xml
Solar Eclipse in Ottawa on 2021-06-10.
[homepage.git] / layouts / default.xml
index 47470e0c84c45f12b4ee9c82c352f4c3f434d84e..2e003aefeb975fd077edf9e3b8848782b06c07a8 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   Nick's web site: Intermediate document structure.
 
-  Copyright © 2016-2018 Nick Bowler
+  Copyright © 2016-2020 Nick Bowler
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>
 -->
-<document>
-  <title><%= @item[:title] %></title>
-  <html xmlns="http://www.w3.org/1999/xhtml">
-    <h1><%= @item.fetch(:header, @item[:title]) %></h1>
-    <%= yield() %>
-  </html>
+<%
+  doc_str = yield()
+  doc = Nokogiri::XML(sprintf("<html xmlns='%s'>%s</html>",
+                              Xmlns['xhtml'], doc_str))
+
+  doc_header = nil
+  if !doc.xpath("//xhtml:h1", Xmlns).empty? then
+    doc_header = doc.xpath("string(//xhtml:h1)", Xmlns)
+  end
+%><document>
+  <title><%= @item.fetch(:title, doc_header) %></title><%=
+render '/copyright.xml' %><%
+find_images.each do |item| %>
+  <image>
+    <title><%= item[:attrname] || item[:title] %></title>
+    <uri><%= item_uri(item, rep: :info) %></uri><%=
+render '/copyright.xml', :item => item, :indent => 4
+%>  </image><%
+end %>
+  <source>
+<% if @item.raw_filename %>
+    <file><%= item_source(@item) %></file>
+<% elsif File.basename(@item.identifier) == "index.lst" %>
+    <dir><%= "content" + File.dirname(@item.identifier) %></dir>
+<% end %>
+    <revision><%= @item.fetch(:gitrev) %></revision>
+    <compiletime><%=
+      Time.now.gmtime.strftime "%Y-%m-%d %H:%M UTC"
+    %></compiletime>
+  </source>
+  <hierarchy><% breadcrumbs_trail().compact.each do |item|
+    next if item == @item || item[:"breadcrumb-ignore"] %>
+    <parent>
+      <name><%=
+        if item == @items["/index.*"] then
+          "Entrance"
+        else
+          item[:title]
+        end
+      %></name>
+      <uri><%= item_uri(item) %></uri>
+    </parent><% end %>
+  </hierarchy>
+<% if @item[:kind] == "article" then
+%>  <article>
+<%= attribute_to_time(@item[:published]).strftime \
+"    <published>%Y-%m-%d</published>\n" if @item[:published]
+%>  </article>
+<% end
+%>  <html xmlns="<%= Xmlns['xhtml'] %>">
+<% if !doc_header then
+%>    <h1><%= @item.fetch(:header, @item[:title]) %></h1>
+<% end %><%= doc_str
+%>  </html>
 </document>