chiark / gitweb /
theme: make the output pretty indented.
authorVladimír Vondruš <mosra@centrum.cz>
Wed, 23 Aug 2017 11:18:47 +0000 (13:18 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Wed, 23 Aug 2017 11:18:47 +0000 (13:18 +0200)
There will be a minifier step later anyway, but this helps debugging
(and my OCD) a lot.

pelican-theme/templates/archives.html
pelican-theme/templates/article.html
pelican-theme/templates/article_header.html
pelican-theme/templates/author.html
pelican-theme/templates/base.html
pelican-theme/templates/base_blog_section.html
pelican-theme/templates/category.html
pelican-theme/templates/page.html
pelican-theme/templates/pagination.html
pelican-theme/templates/tag.html

index fe744bd5cc475862058c944670f67e266d8a24b0..37a768252cbdf20689b8adf94e6448610830a6ac 100644 (file)
@@ -1,23 +1,26 @@
 {% extends "base_blog.html" %}
 {% block content %}
-<div class="m-col-m-10">
-  {% block content_title %}
-  {% endblock content_title %}
-  {% for article in articles_page.object_list %}
-  <article>
-    {% include "article_header.html" %}
-    {% if loop.first and articles_page.number == 1 %}
-    <div class="m-clearfix-l"></div>
-    {{ article.content }}
-    {% endif %}
-    {% include "article_footer.html" %}
-    {% if not loop.first or articles_page.number != 1 %}
-    <div class="m-clearfix-l"></div>
-    {% endif %}
-  </article>
-  {% endfor %}
-  {% if articles_page.has_other_pages() %}
-      {% include 'pagination.html' %}
-  {% endif %}
-</div>
+    <div class="m-col-m-10">
+      {% block content_title %}
+      {% endblock content_title %}
+      {% for article in articles_page.object_list %}
+      <article>
+        {% macro header() %}{% include "article_header.html" %}{% endmacro %}
+        {{ header()|indent(8) }}
+        {% if loop.first and articles_page.number == 1 %}
+        <div class="m-clearfix-l"></div>
+        {{ article.content|indent(8) }}
+        {% endif %}
+        {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
+        {{ footer()|indent(8) }}
+        {% if not loop.first or articles_page.number != 1 %}
+        <div class="m-clearfix-l"></div>
+        {% endif %}
+      </article>
+      {% endfor %}
+      {% if articles_page.has_other_pages() %}
+      {% macro pagination() %}{% include 'pagination.html' %}{% endmacro %}
+      {{ pagination()|indent(6) }}
+      {% endif %}
+    </div>
 {% endblock content %}
index 36ebfdc37bfe9aebaaa9dc559b37bf3385d629d6..7d0956b45dc98f5229e6499a565c18370680c020 100644 (file)
 {% endblock %}
 
 {% block content %}
-{% if article.cover %}
-<article class="m-jumbo {{ article.class }}">
-  <header>
-    <div class="m-jumbo-image" style="background-image: url('{{ article|expand_link('cover') }}');">
-      <div class="m-jumbo-cover">
-        <div class="m-container">
-          <div class="m-row">
-            <div class="m-col-t-6 m-col-s-5 m-push-s-1 m-text-left">{{ article.locale_date }}</div>
-            <div class="m-col-t-6 m-col-s-5 m-push-s-1 m-text-right">{% for author in article.authors %}<a href="{{ author.url }}">{{ author }}</a>{% endfor %}</div>
+    {% if article.cover %}
+    <article class="m-jumbo {{ article.class }}">
+      <header>
+        <div class="m-jumbo-image" style="background-image: url('{{ article|expand_link('cover') }}');">
+          <div class="m-jumbo-cover">
+            <div class="m-container">
+              <div class="m-row">
+                <div class="m-col-t-6 m-col-s-5 m-push-s-1 m-text-left">{{ article.locale_date }}</div>
+                <div class="m-col-t-6 m-col-s-5 m-push-s-1 m-text-right">{% for author in article.authors %}<a href="{{ author.url }}">{{ author }}</a>{% endfor %}</div>
+              </div>
+              <div class="m-row">
+                <div class="m-col-t-12 m-col-s-10 m-push-s-1 m-col-m-8 m-push-m-2">
+                  {% set title = article.title.split(' &#8212; ') %}
+                  <h1><a href="{{ article.url }}" rel="bookmark"
+        title="Permalink to {{ article.title|striptags }}">
+                  {{ title[0] }}
+                  </a></h1>
+                  {% if title|length >= 2 %}<h2>{{ title[1] }}</h2>{% endif %}
+                </div>
+              </div>
+            </div>
           </div>
+        </div>
+        <div class="m-container m-nopady">
           <div class="m-row">
-            <div class="m-col-t-12 m-col-s-10 m-push-s-1 m-col-m-8 m-push-m-2">
-              {% set title = article.title.split(' &#8212; ') %}
-              <h1><a href="{{ article.url }}" rel="bookmark"
-    title="Permalink to {{ article.title|striptags }}">
-              {{ title[0] }}
-              </a></h1>
-              {% if title|length >= 2 %}<h2>{{ title[1] }}</h2>{% endif %}
+            <div class="m-col-m-10 m-push-m-1 m-nopady">
+              {{ article.summary }}
             </div>
           </div>
         </div>
-      </div>
-    </div>
-    <div class="m-container m-nopady">
-      <div class="m-row">
-        <div class="m-col-m-10 m-push-m-1 m-nopady">
-          {{ article.summary }}
+      </header>
+      <div class="m-container m-nopady" id="m-container-inflatable">
+        <div class="m-row">
+          <div class="m-col-m-10 m-push-m-1 m-nopady">
+          {{ article.content }}
+          </div>
         </div>
       </div>
-    </div>
-  </header>
-  <div class="m-container m-nopady" id="m-container-inflatable">
-    <div class="m-row">
-      <div class="m-col-m-10 m-push-m-1 m-nopady">
-      {{ article.content }}
-      </div>
-    </div>
-  </div>
-  <footer class="m-container m-nopady">
-    <div class="m-row">
-      <div class="m-col-m-10 m-push-m-1 m-nopady">
-        <p>Posted {% if article.authors %}by {% for author in article.authors %}<a href="{{ author.url }}">{{ author }}</a>{% endfor %}{% endif %} on <time datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}</time> in <a href="{{ article.category.url }} ">{{ article.category }}</a>.{% if article.tags %} Tags: {% for tag in article.tags %}<a href="{{ tag.url }}">{{ tag }}</a>{% if not loop.last %}, {% endif %}{% endfor %}.{% endif %}</p>
-      </div>
-    </div>
-  </footer>
-</article>
-{% else %}
-<article class="m-col-m-10">
-  {% include "article_header.html" %}
-  <div class="m-clearfix-l"></div>
-  {{ article.content }}
-  {% include "article_footer.html" %}
-</article>
-{% endif %}
+      <footer class="m-container m-nopady">
+        <div class="m-row">
+          <div class="m-col-m-10 m-push-m-1 m-nopady">
+            <p>Posted {% if article.authors %}by {% for author in article.authors %}<a href="{{ author.url }}">{{ author }}</a>{% endfor %}{% endif %} on <time datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}</time> in <a href="{{ article.category.url }} ">{{ article.category }}</a>.{% if article.tags %} Tags: {% for tag in article.tags %}<a href="{{ tag.url }}">{{ tag }}</a>{% if not loop.last %}, {% endif %}{% endfor %}.{% endif %}</p>
+          </div>
+        </div>
+      </footer>
+    </article>
+    {% else %}
+    <article class="m-col-m-10">
+      {% macro header() %}{% include "article_header.html" %}{% endmacro %}
+      {{ header()|indent(6) }}
+      <div class="m-clearfix-l"></div>
+      {{ article.content|indent(6) }}
+      {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
+      {{ footer()|indent(6) }}
+    </article>
+    {% endif %}
 {% endblock %}
index 23492071748498dd8e95557117a3c92a0803d7db..626ab8f307d19e3388e03864e0284508d66090bc 100644 (file)
@@ -1,11 +1,10 @@
 <header>
-  <h1><a href="{{ article.url }}" rel="bookmark"
-  title="Permalink to {{ article.title|striptags }}">
+  <h1><a href="{{ article.url }}" rel="bookmark" title="Permalink to {{ article.title|striptags }}">
     <time class="m-date" datetime="{{ article.date.isoformat() }}">
-    {% set month, day, year = article.locale_date.split(' ') %}
-    {{ month }} <span class="m-date-day">{{ day }}</span> {{year}}
+      {% set month, day, year = article.locale_date.split(' ') %}
+      {{ month }} <span class="m-date-day">{{ day }}</span> {{year}}
     </time>
-  {{ article.title }}
+    {{ article.title }}
   </a></h1>
-  {{ article.summary }}
+  {{ article.summary|indent(2) }}
 </header>
index c69de7513fbe81a56cb6fac7c2924d611c805e7d..51cf82499b8430b0cccacf0be1252b7818d89ce8 100644 (file)
@@ -3,7 +3,7 @@
 {% block title %}Posts by {{ author }} | {{ BLOGNAME }}{% endblock %}
 
 {% block content_title %}
-<div class="m-info m-note">
-  Showing only posts by <em>{{ author }}</em>. <a href="{{ BLOGURL }}/">Show all posts.</a>
-</div>
+      <div class="m-info m-note">
+        Showing only posts by <em>{{ author }}</em>. <a href="{{ BLOGURL }}/">Show all posts.</a>
+      </div>
 {% endblock %}
index f9df7df0a1e105286bbe685282e30486dbb8d94e..c6e1d952aab2e347fc6cdbfa18485ba259568417 100644 (file)
@@ -23,8 +23,8 @@
     <div class="m-container">
       <div class="m-row">
         <a href="{{ SITEURL }}/" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m">
-          {% if SITE_LOGO %}<img src="{{ SITE_LOGO }}" />{% endif %}
-          {{ SITE_LOGO_TEXT }}
+          {%- if SITE_LOGO %}<img src="{{ SITE_LOGO }}" />{% endif -%}
+          {{- SITE_LOGO_TEXT -}}
         </a>
         <a id="m-navbar-show" href="#navigation" title="Show navigation" class="m-col-t-3 m-hide-m m-right">&#9776;</a>
         <a id="m-navbar-hide" href="#" title="Hide navigation" class="m-col-t-3 m-hide-m m-right">&#9776;</a>
@@ -33,7 +33,7 @@
             <ol class="m-col-t-6 m-col-m-none">
               {% for title, link, sub in LINKS_NAVBAR1 %}
               <li>
-                <a href="{{ link }}" {% if title == page_title %}id="m-navbar-current"{% endif %}>{{ title }}</a>
+                <a href="{{ link }}"{% if title == page_title %} id="m-navbar-current"{% endif %}>{{ title }}</a>
                 {% if sub %}
                 <ol>
                   {% for title, link in sub %}
             <ol class="m-col-t-6 m-col-m-none">
               {% for title, link, sub in LINKS_NAVBAR2 %}
               <li>
-                <a href="{{ link }}" {% if title == page_title %}id="m-navbar-current"{% endif %}>{{ title }}</a>
+                <a href="{{ link }}"{% if title == page_title %} id="m-navbar-current"{% endif %}>{{ title }}</a>
                 {% if sub %}
                 <ol>
                   {% for title, link in sub %}
-                    <li><a href="{{ link }}">{{ title }}</a></li>
+                  <li><a href="{{ link }}">{{ title }}</a></li>
                   {% endfor %}
                 </ol>
                 {% endif %}
       <div class="m-row">
         <div class="m-col-s-3 m-col-t-6">
           <h3>
-            {% if LINKS_FOOTER1[0][1] %}<a href="{{ LINKS_FOOTER1[0][1] }}/">{% endif %}
-            {{ LINKS_FOOTER1[0][0] }}
-            {% if LINKS_FOOTER1[0][1] %}</a>{% endif %}
+            {%- if LINKS_FOOTER1[0][1] %}<a href="{{ LINKS_FOOTER1[0][1] }}/">{% endif %}
+            {{- LINKS_FOOTER1[0][0] -}}
+            {% if LINKS_FOOTER1[0][1] -%}</a>{% endif -%}
           </h3>
           <ul>
-            {% for title, link in LINKS_FOOTER1 %}
-            {% if loop.index0 != 0 %}<li><a href="{{ link }}">{{ title }}</a></li>{% endif %}
-            {% endfor %}
+            {% for title, link in LINKS_FOOTER1 %}{% if loop.index0 != 0 %}
+            <li><a href="{{ link }}">{{ title }}</a></li>
+            {% endif %}{% endfor %}
           </ul>
         </div>
         <div class="m-col-s-3 m-col-t-6">
           <h3>
-            {% if LINKS_FOOTER2[0][1] %}<a href="{{ LINKS_FOOTER2[0][1] }}/">{% endif %}
-            {{ LINKS_FOOTER2[0][0] }}
-            {% if LINKS_FOOTER2[0][1] %}</a>{% endif %}
+            {%- if LINKS_FOOTER2[0][1] %}<a href="{{ LINKS_FOOTER2[0][1] }}/">{% endif %}
+            {{- LINKS_FOOTER2[0][0] -}}
+            {% if LINKS_FOOTER2[0][1] %}</a>{% endif -%}
           </h3>
           <ul>
-            {% for title, link in LINKS_FOOTER2 %}
-            {% if loop.index0 != 0 %}<li><a href="{{ link }}">{{ title }}</a></li>{% endif %}
-            {% endfor %}
+            {% for title, link in LINKS_FOOTER2 %}{% if loop.index0 != 0 %}
+            <li><a href="{{ link }}">{{ title }}</a></li>
+            {% endif %}{% endfor %}
           </ul>
         </div>
         <div class="m-clearfix-t"></div>
         <div class="m-col-s-3 m-col-t-6">
           <h3>
-            {% if LINKS_FOOTER3[0][1] %}<a href="{{ LINKS_FOOTER3[0][1] }}/">{% endif %}
-            {{ LINKS_FOOTER3[0][0] }}
-            {% if LINKS_FOOTER3[0][1] %}</a>{% endif %}
+            {%- if LINKS_FOOTER3[0][1] %}<a href="{{ LINKS_FOOTER3[0][1] }}/">{% endif %}
+            {{- LINKS_FOOTER3[0][0] -}}
+            {% if LINKS_FOOTER3[0][1] %}</a>{% endif -%}
           </h3>
           <ul>
-            {% for title, link in LINKS_FOOTER3 %}
-            {% if loop.index0 != 0 %}<li><a href="{{ link }}">{{ title }}</a></li>{% endif %}
-            {% endfor %}
+            {% for title, link in LINKS_FOOTER3 %}{% if loop.index0 != 0 %}
+            <li><a href="{{ link }}">{{ title }}</a></li>
+            {% endif %}{% endfor %}
           </ul>
         </div>
         <div class="m-col-s-3 m-col-t-6">
       </div>
       <div class="m-row">
         <div class="m-col-l-10 m-push-l-1">
-          {{ FINE_PRINT|render_rst }}
+          {{ FINE_PRINT|render_rst|indent(10) }}
         </div>
       </div>
     </div>
index 45634a847fcf9688257f4c16213398848dfc7039..72211f1717124eaf20bd6e56f4553a59c62990be 100644 (file)
@@ -1,16 +1,19 @@
 {% extends "base_blog.html" %}
 {% block content %}
-<div class="m-col-m-10">
-  {% block content_title %}
-  {% endblock content_title %}
-  {% for article in articles_page.object_list %}
-  <article>
-    {% include "article_header.html" %}
-    {% include "article_footer.html" %}
-  </article>
-  {% endfor %}
-  {% if articles_page.has_other_pages() %}
-    {% include 'pagination.html' %}
-  {% endif %}
-</div>
+    <div class="m-col-m-10">
+      {% block content_title %}
+      {% endblock content_title %}
+      {% for article in articles_page.object_list %}
+      <article>
+        {% macro header() %}{% include "article_header.html" %}{% endmacro %}
+        {{ header()|indent(8) }}
+        {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
+        {{ footer()|indent(8) }}
+      </article>
+      {% endfor %}
+      {% if articles_page.has_other_pages() %}
+      {% macro pagination() %}{% include 'pagination.html' %}{% endmacro %}
+      {{ pagination()|indent(6) }}
+      {% endif %}
+    </div>
 {% endblock content %}
index 7c443273cb7c1d8eaa3f7c3f16248e3fde6f6221..3b91c063d86441455f88ba6a9fc2abfd686b3505 100644 (file)
@@ -3,7 +3,7 @@
 {% block title %}{{ category }} | {{ BLOGNAME }}{% endblock %}
 
 {% block content_title %}
-<div class="m-info m-note">
-  Showing only posts in <em>{{ category }}</em>. <a href="{{ BLOGURL }}/">Show all posts.</a>
-</div>
+      <div class="m-info m-note">
+        Showing only posts in <em>{{ category }}</em>. <a href="{{ BLOGURL }}/">Show all posts.</a>
+      </div>
 {% endblock %}
index b3ebd5537c9fc7d355056dd6df114b441688f556..19d756f9a366cb8d62673d48b9e4243fdf0471ef 100644 (file)
@@ -1,14 +1,21 @@
 {% set page_title = page.title|replace('&shy;', '') %}
 {% extends "base.html" %}
 
-{% block title %}{{ page.title }} | {{ SITENAME }}{%endblock%}
+{% block title %}{{ page.title }} | {{ SITENAME }}{% endblock %}
+
+{% block head %}
+  {{- super() -}}
+  {% if page.css %}
+  <link rel="stylesheet" href="{{ page|expand_link('css') }}" />
+  {% endif %}
+{% endblock %}
 
 {% block main %}
 <article class="m-container" id="m-container-inflatable">
   <div class="m-row">
     <div class="m-col-l-10 m-push-l-1">
       <h1>{{ page.title }}</h1>
-      {{ page.content }}
+      {{ page.content|indent(6) }}
     </div>
   </div>
 </article>
index ecbb6dfdc171926764858d3f6e096024ac6dc9a6..c62e8994d43ae924d8029216e5c5c490a1dae2c0 100644 (file)
@@ -1,11 +1,7 @@
 {% if DEFAULT_PAGINATION %}
 <div class="m-article-pagination">
-  {% if articles_page.has_previous() %}
-    <a href="{{ articles_previous_page.url }}">&laquo; newer articles</a> |
-  {% endif %}
+  {%- if articles_page.has_previous() %}<a href="{{ articles_previous_page.url }}">&laquo; newer articles</a> | {% endif -%}
   page {{ articles_page.number }}
-  {% if articles_page.has_next() %}
-    | <a href="{{ articles_next_page.url }}">older articles &raquo;</a>
-  {% endif %}
+  {%- if articles_page.has_next() %} | <a href="{{ articles_next_page.url }}">older articles &raquo;</a>{% endif -%}
 </div>
 {% endif %}
index 24e620401dc568a050c8dd7403b8cd2842fe88c6..1dd694c1d6d0f60a306325d99a3593f29941cc4b 100644 (file)
@@ -3,7 +3,7 @@
 {% block title %}Posts tagged {{ tag }} | {{ BLOGNAME }}{% endblock %}
 
 {% block content_title %}
-<div class="m-info m-note">
-  Showing only posts tagged <em>{{ tag }}</em>. <a href="{{ BLOGURL }}/">Show all posts.</a>
-</div>
+      <div class="m-info m-note">
+        Showing only posts tagged <em>{{ tag }}</em>. <a href="{{ BLOGURL }}/">Show all posts.</a>
+      </div>
 {% endblock %}