Commits

Anonymous committed ef9cddc

Revamped the default templates, adding more hooks (via Jinja2 blocks) and fixing some minor issues.

  • Participants
  • Parent commits 90bcd32

Comments (0)

Files changed (4)

File src/markdoc/static/default-templates/markdoc-default/404.html

 {% extends 'base.html' %}
 
-{% block body %}
+{% block title %}Not Found: {{ request.path_info|e }}{% endblock %}
+
+{% block content %}
 <h1>Not Found: <code>{{ request.path_info|e }}</code></h1>
 <p>
-  We couldn&#8217;t find what you were looking for.
+  We couldnt find what you were looking for.
   {% if not is_index %}You could try going <a href="/">home</a>.{% endif %}
 </p>
 {% endblock %}

File src/markdoc/static/default-templates/markdoc-default/base.html

       xmlns:foaf="http://xmlns.com/foaf/0.1/"
       {%- endblock %}>
   
+  {% import "macros/html" as html -%}
+  
   <head>
-    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+    {% block head %}
     
-    <title>
-      {% if 'wiki-name' in config %}{{ config['wiki-name']|e }} » {% endif -%}
-      {% block title %}{{ title }}{% endblock %}
-    </title>
+      {% block meta %}
+        <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+      {% endblock %}
+      
+      <title>
+        {% block title_prefix -%}
+          {% if 'wiki-name' in config %}{{ config['wiki-name']|e }} » {% endif %}
+        {%- endblock %}
+        {% block title -%}
+          {{ title }}
+        {%- endblock %}
+      </title>
+      
+      {% block css %}
+        {{ html.cssimport(make_relative("/media/css/reset.css")) }}
+        {{ html.cssimport(make_relative("/media/css/layout.css")) }}
+        {{ html.cssimport(make_relative("/media/css/typography.css")) }}
+        {{ html.cssimport(make_relative("/media/css/pygments.css")) }}
+      {% endblock %}
+      
+      {% block js %}{% endblock %}
     
-    {% import "macros/html" as html -%}
-    
-    {{ html.cssimport(make_relative("/media/css/reset.css")) }}
-    {{ html.cssimport(make_relative("/media/css/layout.css")) }}
-    {{ html.cssimport(make_relative("/media/css/typography.css")) }}
-    {{ html.cssimport(make_relative("/media/css/pygments.css")) }}
+    {% endblock head %}
   </head>
   
-  <body>
+  <body {% block body_attrs %}{% endblock %}>{% block body %}
     <div id="content">
-
-      {% if crumbs %}
-        <div id="breadcrumbs">
-          <p>
-              {% for name, href in crumbs %}
-                {% if href == None %}
-                  {{ name|e }}
-                {% else %}
-                  <a href="{{ make_relative(href)|e }}">{{ name|e }}</a>{% if loop.revindex0 %} &#187;{% endif %}
-                {% endif %}
-              {% endfor %}
-          </p>
-        </div> <!-- div#breadcrumbs -->
-      {% endif %}
       
-      {% block body %}
-      {% endblock %}
-    
-      <p id="footer">
-        {% if 'wiki-name' in config %}
-          {{ config['wiki-name']|e }} —
+      {% block crumbs %}
+        {% if crumbs %}
+          <div id="breadcrumbs">
+            <p>
+                {% for name, href in crumbs %}
+                  {% if href == None %}
+                    {{ name|e }}
+                  {% else %}
+                    <a href="{{ make_relative(href)|e }}">{{ name|e }}</a>{% if loop.revindex0 %} &#187;{% endif %}
+                  {% endif %}
+                {% endfor %}
+            </p>
+          </div> <!-- div#breadcrumbs -->
         {% endif %}
-        Powered by <a href="http://bitbucket.org/zacharyvoase/markdoc">Markdoc</a>.
-      </p>
+      {% endblock crumbs %}
+      
+      {% block content %}
+      {% endblock content %}
+      
+      {% block footer %}
+        <p id="footer">
+          {% if 'wiki-name' in config %}
+            {{ config['wiki-name']|e }} —
+          {% endif %}
+          Powered by <a href="http://bitbucket.org/zacharyvoase/markdoc">Markdoc</a>.
+        </p>
+      {% endblock footer %}
     
     </div> <!-- div#content -->
     
-    {% if 'google-analytics' in config %}
-    <!-- Google Analytics -->
-      <script type="text/javascript">
-      var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-      document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-      </script>
-      <script type="text/javascript">
-      try{
-      var pageTracker = _gat._getTracker("{{ config['google-analytics'] }}");
-      pageTracker._trackPageview();
-      } catch(err) {}</script>
-    {% endif %}
-  </body>
+    {% block analytics %}
+      {% if 'google-analytics' in config %}
+        <!-- Google Analytics -->
+        <script type="text/javascript">
+        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+        </script>
+        <script type="text/javascript">
+        try{
+        var pageTracker = _gat._getTracker("{{ config['google-analytics'] }}");
+        pageTracker._trackPageview();
+        } catch(err) {}</script>
+      {% endif %}
+    {% endblock analytics %}
+    
+    {% block end %}{% endblock %}
+  {% endblock body %}</body>
 </html>

File src/markdoc/static/default-templates/markdoc-default/document.html

 {% extends 'base.html' %}
 
-{% block body %}
-  {{ content }}
-{% endblock %}
+{% block content %}{{ content }}{% endblock %}

File src/markdoc/static/default-templates/markdoc-default/listing.html

 
 {% block title %}ls /{{ directory|e }}{% endblock %}
 
-{% block body %}
+{% block content %}
   <h1><code>ls /{{ directory|e }}</code></h1>
 
   {% if sub_directories %}