]> git.draconx.ca Git - homepage.git/blob - layouts/default.xml
Remove dead definition list cruft.
[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-2018 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 <% [@item.fetch(:copyright, [])].flatten.each do |copyright|
32 %>  <copyright><%= copyright %></copyright>
33 <% end
34   if @item[:license] then
35     licref = @item[:license].split
36     lic = find_license(licref[0])
37 %>  <license>
38     <identifier><%= File::basename(lic.identifier.without_ext) %></identifier>
39     <name><%= [lic[:title], licref[1..-1]].compact.join(" ").strip %></name>
40     <uri><%= item_uri(lic) %></uri>
41     <modification-allowed><%=
42       lic[:"modification-allowed"] == true ? "yes" : "no"
43     %></modification-allowed>
44   </license>
45 <% end
46 %>  <source>
47     <file><%= item_source(@item) %></file>
48     <revision><%= item.fetch(:gitrev) %></revision>
49     <compiletime><%=
50       Time.now.gmtime.strftime "%Y-%m-%d %H:%M UTC"
51     %></compiletime>
52   </source>
53   <hierarchy><% breadcrumbs_trail().compact.each do |i|
54     if i == @item then next end %>
55     <parent>
56       <name><%=
57         if i == @items["/index.*"] then
58           "Entrance"
59         else
60           i[:title]
61         end
62       %></name>
63       <uri><%= item_uri(i) %></uri>
64     </parent><% end %>
65   </hierarchy>
66   <html xmlns="<%= Xmlns['xhtml'] %>">
67 <% if !doc_header then
68 %>    <h1><%= @item.fetch(:header, @item[:title]) %></h1>
69 <% end %><%= doc_str
70 %>  </html>
71 </document>