]> git.draconx.ca Git - homepage.git/blobdiff - layouts/default.xml
Put some actual material on the site.
[homepage.git] / layouts / default.xml
index 901b0c36693e48391ddaa272f3efd9067faf6a91..74c454a42d679b59dd8ea7da5909114204bdc91c 100644 (file)
   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>
-  <source>
+<%
+  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>
+<% [@item.fetch(:copyright, [])].flatten.each do |copyright|
+%>  <copyright><%= copyright %></copyright>
+<% end
+  if @item[:license] then
+    licref = @item[:license].split
+    lic = find_license(licref[0])
+%>  <license>
+    <identifier><%= File::basename(lic.identifier.without_ext) %></identifier>
+    <name><%= [lic[:title], licref[1..-1]].compact.join(" ").strip %></name>
+    <uri><%= item_uri(lic) %></uri>
+    <modification-allowed><%=
+      lic[:"modification-allowed"] == true ? "yes" : "no"
+    %></modification-allowed>
+  </license>
+<% end
+%>  <source>
     <file><%= item_source(@item) %></file>
     <revision><%= item.fetch(:gitrev) %></revision>
     <compiletime><%=
       Time.now.gmtime.strftime "%Y-%m-%d %H:%M UTC"
     %></compiletime>
   </source>
-  <html xmlns="http://www.w3.org/1999/xhtml">
-    <h1><%= @item.fetch(:header, @item[:title]) %></h1>
-    <%= yield() %>
-  </html>
+  <hierarchy><% breadcrumbs_trail().compact.each do |i|
+    if i == @item then next end %>
+    <parent>
+      <name><%=
+        if i == @items["/index.*"] then
+          "Entrance"
+        else
+          i[:title]
+        end
+      %></name>
+      <uri><%= item_uri(i) %></uri>
+    </parent><% end %>
+  </hierarchy>
+  <html xmlns="<%= Xmlns['xhtml'] %>">
+<% if !doc_header then
+%>    <h1><%= @item.fetch(:header, @item[:title]) %></h1>
+<% end %><%= doc_str
+%>  </html>
 </document>