chiark / gitweb /
pelican-theme: better align tags on jumbo articles.
authorVladimír Vondruš <mosra@centrum.cz>
Tue, 9 Jun 2020 17:09:12 +0000 (19:09 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Tue, 9 Jun 2020 19:32:22 +0000 (21:32 +0200)
With a large amount of tags (like on magnum.graphics) it was uglily
misbalanced. Now it should be better.

pelican-theme/templates/base_blog.html
pelican-theme/test/blog_author_list_tags/article-jumbo.html [new file with mode: 0644]
pelican-theme/test/blog_author_list_tags/article-jumbo.rst [new file with mode: 0644]
pelican-theme/test/blog_html_escape/article-jumbo.html
pelican-theme/test/test_blog.py
plugins/m/test/htmlsanity_typography/article-jumbo.html
plugins/m/test/metadata/article-jumbo.html

index d41236df5e020f5318c4debd6843b78c31820fb8..868d470b8313195f207c4d884cc172307d8c92f5 100644 (file)
 {% if article and article.cover %}
   <nav class="m-navpanel m-container">
     <div class="m-row">
-      <div class="m-col-s-4 m-col-l-2 {% if M_SHOW_AUTHOR_LIST %}m-push-l-1{% elif tags %}m-push-s-2 m-push-l-3{% else %}m-push-s-4 m-push-l-5{% endif %}">
+      {# If we have both an author list and tags, put tags into a wider column
+         in the center on M and L size and onto a full-width row below the
+         category/authors on S size -- that way if there's many tags, it
+         doesn't cause a bottom of the page to look weirdly misbalanced.
+
+         In other cases put two columns next to each other with the same size,
+         as there's not really much we can do to make that work. See the
+         article-jumbo.html in Blog, BlogAuthorList and BlogAuthorListTags
+         tests for a visual, don't forget to resize your browser to all
+         T/S/M/l stops when making further changes. #}
+      <div class="{% if M_SHOW_AUTHOR_LIST and tags %}m-col-s-6 m-col-m-3 m-col-l-2 m-push-l-1{% else %}m-col-s-4 m-col-l-2 {% if M_SHOW_AUTHOR_LIST %}m-push-l-1{% elif tags %}m-push-s-2 m-push-l-3{% else %}m-push-s-4 m-push-l-5{% endif %}{% endif %}">
         <h3>{{ "Categories"|hyphenate(lang='en') }}</h3>
         <ol class="m-block-bar-s">
           {% for cat, null in categories %}
@@ -34,7 +44,7 @@
         </ol>
       </div>
       {% if M_SHOW_AUTHOR_LIST %}
-      <div class="m-col-s-4 m-col-l-2 {% if tags %}m-push-l-3{% else %}m-push-s-4 m-push-l-7{% endif %}">
+      <div class="{% if tags %}m-col-s-6 m-col-m-3 m-push-m-6 m-col-l-2 m-push-l-7{% else %}m-col-s-4 m-col-l-2 m-push-s-4 m-push-l-7{% endif %}">
         <h3>{{ "Authors"|hyphenate(lang='en') }}</h3>
         <ol class="m-block-bar-s">
           {% for author, null in authors %}
@@ -44,7 +54,7 @@
       </div>
       {% endif %}
       {% if tags %}
-      <div class="m-col-s-4 m-col-l-2 {% if M_SHOW_AUTHOR_LIST %}m-push-l-5{% else %}m-push-s-2 m-push-l-5{% endif %}">
+      <div class="{% if M_SHOW_AUTHOR_LIST and tags %}m-col-s-12 m-col-m-6 m-col-l-4 m-pull-m-3 m-pull-l-0{% else %}m-col-s-4 m-col-l-2 {% if M_SHOW_AUTHOR_LIST %}m-push-l-5{% else %}m-push-s-2 m-push-l-5{% endif %}{% endif %}">
         <h3>{{ "Tag cloud"|hyphenate(lang='en') }}</h3>
         <ul class="m-tagcloud">
           {% set max_articles_per_tag = tags|map(attribute='1')|map('length')|sort|last %}
diff --git a/pelican-theme/test/blog_author_list_tags/article-jumbo.html b/pelican-theme/test/blog_author_list_tags/article-jumbo.html
new file mode 100644 (file)
index 0000000..8feee5d
--- /dev/null
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>A jumbo article | A Pelican Blog</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
+  <link rel="stylesheet" href="static/m-dark.css" />
+  <link rel="canonical" href="article-jumbo.html" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation" class="m-navbar-cover">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="./" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m">A Pelican Blog</a>
+    </div>
+  </div>
+</nav></header>
+<main>
+  <article id="m-jumbo">
+    <header>
+      <div id="m-jumbo-image" style="background-image: url('image.jpg');">
+        <div id="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">Dec 09, 2017</div>
+              <div class="m-col-t-6 m-col-s-5 m-push-s-1 m-text-right"><a href="author-an-author.html">An Author</a></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">
+                <h1><a href="article-jumbo.html" rel="bookmark" title="Permalink to A jumbo article">A jumbo article</a></h1>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </header>
+    <footer class="m-container">
+      <div class="m-row">
+        <div class="m-col-m-10 m-push-m-1 m-nopadb">
+          <p>Posted by <a href="author-an-author.html">An Author</a> on <time datetime="2017-12-09T00:00:00+00:00">Dec 09, 2017</time> in <a href="category-misc.html">misc</a>. Tags: <a href="tag-all.html">All</a>, <a href="tag-the.html">the</a>, <a href="tag-cool.html">Cool</a>, <a href="tag-tags.html">Tags</a>, <a href="tag-which.html">Which</a>, <a href="tag-are.html">Are</a>, <a href="tag-really-really-really.html">Really really really</a>, <a href="tag-a-lot.html">A Lot</a>.</p>
+        </div>
+      </div>
+    </footer>
+  </article>
+  <nav class="m-navpanel m-container">
+    <div class="m-row">
+      <div class="m-col-s-6 m-col-m-3 m-col-l-2 m-push-l-1">
+        <h3>Categories</h3>
+        <ol class="m-block-bar-s">
+          <li><a href="category-misc.html">misc</a></li>
+        </ol>
+      </div>
+      <div class="m-col-s-6 m-col-m-3 m-push-m-6 m-col-l-2 m-push-l-7">
+        <h3>Authors</h3>
+        <ol class="m-block-bar-s">
+          <li><a href="author-an-author.html">An Author</a></li>
+        </ol>
+      </div>
+      <div class="m-col-s-12 m-col-m-6 m-col-l-4 m-pull-m-3 m-pull-l-0">
+        <h3>Tag cloud</h3>
+        <ul class="m-tagcloud">
+          <li class="m-tag-5"><a href="tag-a-lot.html">A Lot</a></li>
+          <li class="m-tag-5"><a href="tag-all.html">All</a></li>
+          <li class="m-tag-5"><a href="tag-are.html">Are</a></li>
+          <li class="m-tag-5"><a href="tag-cool.html">Cool</a></li>
+          <li class="m-tag-5"><a href="tag-really-really-really.html">Really really really</a></li>
+          <li class="m-tag-5"><a href="tag-tags.html">Tags</a></li>
+          <li class="m-tag-5"><a href="tag-the.html">the</a></li>
+          <li class="m-tag-5"><a href="tag-which.html">Which</a></li>
+        </ul>
+      </div>
+    </div>
+  </nav>
+</main>
+</body>
+</html>
diff --git a/pelican-theme/test/blog_author_list_tags/article-jumbo.rst b/pelican-theme/test/blog_author_list_tags/article-jumbo.rst
new file mode 100644 (file)
index 0000000..00f9010
--- /dev/null
@@ -0,0 +1,6 @@
+A jumbo article
+###############
+
+:date: 2017-12-09
+:cover: image.jpg
+:tags: All, the, Cool, Tags, Which, Are, Really really really, A Lot
index 2da607567eab2a3d255b19c09c415da10d0ae65b..4855b9775dfea91c949bc83c70f47a1ac0213348 100644 (file)
   </article>
   <nav class="m-navpanel m-container">
     <div class="m-row">
-      <div class="m-col-s-4 m-col-l-2 m-push-l-1">
+      <div class="m-col-s-6 m-col-m-3 m-col-l-2 m-push-l-1">
         <h3>Categories</h3>
         <ol class="m-block-bar-s">
           <li><a href="category-and-in-category.html?and&amp;in&amp;url=&#34;&#34;">And &lt;&amp;&gt; in category</a></li>
         </ol>
       </div>
-      <div class="m-col-s-4 m-col-l-2 m-push-l-3">
+      <div class="m-col-s-6 m-col-m-3 m-push-m-6 m-col-l-2 m-push-l-7">
         <h3>Authors</h3>
         <ol class="m-block-bar-s">
           <li><a href="author-and-in-author.html?and&amp;in&amp;url=&#34;&#34;">And &lt;&amp;&gt; in author</a></li>
         </ol>
       </div>
-      <div class="m-col-s-4 m-col-l-2 m-push-l-5">
+      <div class="m-col-s-12 m-col-m-6 m-col-l-4 m-pull-m-3 m-pull-l-0">
         <h3>Tag cloud</h3>
         <ul class="m-tagcloud">
           <li class="m-tag-5"><a href="tag-and-in-tag.html?and&amp;in&amp;url=&#34;&#34;">And &lt;&amp;&gt; in tag</a></li>
index e81e25d1ec42bccb855af158b438ec6aeef308ac..1d793b58a1037ec021790d07485ff1357a3aa219 100644 (file)
@@ -94,10 +94,24 @@ class AuthorList(BlogTestCase):
         })
 
         # Verify both right sidebar and bottom columns on jumbo articles. It's
-        # without tags, which is the third option to be considered there.
+        # without tags, which is tested in AuthorListTags below.
         self.assertEqual(*self.actual_expected_contents('index.html'))
         self.assertEqual(*self.actual_expected_contents('article-jumbo.html'))
 
+class AuthorListTags(BlogTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'author_list_tags', *args, **kwargs)
+
+    def test(self):
+        self.run_pelican({
+            'AUTHOR': "An Author",
+            'M_SHOW_AUTHOR_LIST': True
+        })
+
+        # Verify alignment of categories, tags and authors on the bottom of
+        # the jumbo article
+        self.assertEqual(*self.actual_expected_contents('article-jumbo.html'))
+
 class FooterLinks(BlogTestCase):
     def __init__(self, *args, **kwargs):
         super().__init__(__file__, 'footer_links', *args, **kwargs)
index 921cbfe73c75eae2fe3b85be00a4635170c29a4c..6fec92805ea6036b16c41482808815413d56287d 100644 (file)
   </article>
   <nav class="m-navpanel m-container">
     <div class="m-row">
-      <div class="m-col-s-4 m-col-l-2 m-push-l-1">
+      <div class="m-col-s-6 m-col-m-3 m-col-l-2 m-push-l-1">
         <h3>Cat&shy;e&shy;gories</h3>
         <ol class="m-block-bar-s">
           <li><a href="category-a-category.html">A category</a></li>
         </ol>
       </div>
-      <div class="m-col-s-4 m-col-l-2 m-push-l-3">
+      <div class="m-col-s-6 m-col-m-3 m-push-m-6 m-col-l-2 m-push-l-7">
         <h3>Au&shy;thors</h3>
         <ol class="m-block-bar-s">
           <li><a href="author-an-author.html">An Author</a></li>
         </ol>
       </div>
-      <div class="m-col-s-4 m-col-l-2 m-push-l-5">
+      <div class="m-col-s-12 m-col-m-6 m-col-l-4 m-pull-m-3 m-pull-l-0">
         <h3>Tag cloud</h3>
         <ul class="m-tagcloud">
           <li class="m-tag-5"><a href="tag-tagging-a-name.html">Tagging a name</a></li>
index 55651d452c4644ba7719d638ce6d8f6847653ce8..04b489d556a9dc60f107ee1095e6d08c3d7330ad 100644 (file)
@@ -86,7 +86,7 @@ category-specific one.</p>
   </article>
   <nav class="m-navpanel m-container">
     <div class="m-row">
-      <div class="m-col-s-4 m-col-l-2 m-push-l-1">
+      <div class="m-col-s-6 m-col-m-3 m-col-l-2 m-push-l-1">
         <h3>Categories</h3>
         <ol class="m-block-bar-s">
           <li><a href="category-a-category.html">A category</a></li>
@@ -94,7 +94,7 @@ category-specific one.</p>
           <li><a href="category-minimal-category.html">Minimal category</a></li>
         </ol>
       </div>
-      <div class="m-col-s-4 m-col-l-2 m-push-l-3">
+      <div class="m-col-s-6 m-col-m-3 m-push-m-6 m-col-l-2 m-push-l-7">
         <h3>Authors</h3>
         <ol class="m-block-bar-s">
           <li><a href="author-an-author.html">An Author</a></li>
@@ -102,7 +102,7 @@ category-specific one.</p>
           <li><a href="author-minimal-author.html">Minimal author</a></li>
         </ol>
       </div>
-      <div class="m-col-s-4 m-col-l-2 m-push-l-5">
+      <div class="m-col-s-12 m-col-m-6 m-col-l-4 m-pull-m-3 m-pull-l-0">
         <h3>Tag cloud</h3>
         <ul class="m-tagcloud">
           <li class="m-tag-5"><a href="tag-a-tag.html">A tag</a></li>