Commits

Anonymous committed 93fc4d1

Support for bespoke templates for types.

  • Participants
  • Parent commits 059e047

Comments (0)

Files changed (2)

File src/chrysoberyl/renderer.py

         filename = filekey(key)
         # Mercurial can't handle filenames containing ':' on Windows, so:
         filename = re.sub(':', '_', filename)
-        if node['type'] != 'type' and \
-           os.path.exists(os.path.join(self.template_dir, filename)):
+        if node['type'] == 'type':
+            if os.path.exists(os.path.join(self.template_dir, "type_" + filename)):
+                template_filename = "type_" + filename
+            else:
+                template_filename = 'type.html'
+        elif os.path.exists(os.path.join(self.template_dir, filename)):
             template_filename = filename
         else:
             filename = filekey(node['type'])

File templates/type_Book.html

+{% extends "type.html" %}
+
+{% block content %}
+
+<ul>
+{% for thing in related('type')|sort -%}
+  <li>
+    {% if not data[key].suppress_page_generation %}
+      {{ link(thing) }}
+    {% else %}
+      {{ thing }}
+    {% endif %}
+     -- ISBN {{ data[thing].isbn }}
+  </li>
+{% endfor %}
+</ul>
+
+{% endblock content %}