]> git.draconx.ca Git - homepage.git/blob - layouts/default.xml
Automatically adjust colour scheme for "dark mode".
[homepage.git] / layouts / default.xml
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!--
3   Nick's web site: Intermediate document structure.
4
5   Copyright © 2016-2022 Nick Bowler
6
7   This program is free software: you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation, either version 3 of the License, or
10   (at your option) any later version.
11
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with this program.  If not, see <https://www.gnu.org/licenses/>
19 -->
20 <%
21   doc_str = yield()
22   doc = Nokogiri::XML(sprintf("<html xmlns='%s'>%s</html>",
23                               Xmlns['xhtml'], doc_str))
24
25   doc_header = nil
26   if !doc.xpath("//xhtml:h1", Xmlns).empty? then
27     doc_header = doc.xpath("string(//xhtml:h1)", Xmlns)
28   end
29 %><document>
30   <title><%= @item.fetch(:title, doc_header) %></title><%=
31 render '/copyright.xml' %><%
32 find_images.each do |item| %>
33   <image>
34     <title><%= item[:attrname] || item[:title] %></title>
35     <uri><%= item_uri(item, rep: :info) %></uri><%=
36 render '/copyright.xml', :item => item, :indent => 4
37 %>  </image><%
38 end %>
39   <source>
40 <% if @item.raw_filename %>
41     <file><%= item_source(@item) %></file>
42 <% elsif File.basename(@item.identifier) == "index.lst" %>
43     <dir><%= "content" + File.dirname(@item.identifier) %></dir>
44 <% end %>
45     <revision><%= @item.fetch(:gitrev) %></revision>
46     <compiletime><%=
47       Time.now.gmtime.strftime "%Y-%m-%d %H:%M UTC"
48     %></compiletime>
49   </source>
50   <hierarchy><% breadcrumbs_trail().compact.each do |item|
51     next if item == @item || item[:"breadcrumb-ignore"] %>
52     <parent>
53       <name><%=
54         if item == @items["/index.*"] then
55           "Entrance"
56         else
57           item[:title]
58         end
59       %></name>
60       <uri><%= item_uri(item) %></uri>
61     </parent><% end %>
62   </hierarchy>
63 <% if @item[:kind] == "article" then
64 %>  <article>
65 <%= attribute_to_time(@item[:published]).strftime \
66 "    <published>%Y-%m-%d</published>\n" if @item[:published]
67 %>  </article>
68 <% end
69 %>  <html xmlns="<%= Xmlns['xhtml'] %>" id="<%=
70   "page" + @item.identifier.without_ext.gsub(/[^[:alnum:]]/, "_")
71 %>">
72 <% if !doc_header then
73 %>    <h1><%= @item.fetch(:header, @item[:title]) %></h1>
74 <% end %><%= doc_str
75 %>  </html>
76 </document>