1 <?xml version="1.0" encoding="UTF-8" ?>
3 Nick's web site: Intermediate document structure.
5 Copyright © 2016-2020 Nick Bowler
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.
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.
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/>
22 doc = Nokogiri::XML(sprintf("<html xmlns='%s'>%s</html>",
23 Xmlns['xhtml'], doc_str))
26 if !doc.xpath("//xhtml:h1", Xmlns).empty? then
27 doc_header = doc.xpath("string(//xhtml:h1)", Xmlns)
30 <title><%= @item.fetch(:title, doc_header) %></title>
31 <% [@item.fetch(:copyright, [])].flatten.each do |copyright|
32 %> <copyright><%= copyright %></copyright>
34 if @item[:license] then
35 licref = @item[:license].split
36 lic = find_license(licref[0])
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>
47 <% if @item.raw_filename %>
48 <file><%= item_source(@item) %></file>
49 <% elsif File.basename(@item.identifier) == "index.lst" %>
50 <dir><%= "content" + File.dirname(@item.identifier) %></dir>
52 <revision><%= @item.fetch(:gitrev) %></revision>
54 Time.now.gmtime.strftime "%Y-%m-%d %H:%M UTC"
57 <hierarchy><% breadcrumbs_trail().compact.each do |item|
58 next if item == @item || item[:"breadcrumb-ignore"] %>
61 if item == @items["/index.*"] then
67 <uri><%= item_uri(item) %></uri>
70 <% if @item[:kind] == "article" then
72 <%= attribute_to_time(@item[:published]).strftime \
73 " <published>%Y-%m-%d</published>\n" if @item[:published]
76 %> <html xmlns="<%= Xmlns['xhtml'] %>">
77 <% if !doc_header then
78 %> <h1><%= @item.fetch(:header, @item[:title]) %></h1>