chiark / gitweb /
theme: render the draft status in article footer.
authorVladimír Vondruš <mosra@centrum.cz>
Sun, 6 May 2018 11:07:56 +0000 (13:07 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Sun, 6 May 2018 11:07:56 +0000 (13:07 +0200)
pelican-theme/templates/article_footer.html
pelican-theme/test/blog_draft/article.html [new file with mode: 0644]
pelican-theme/test/blog_draft/article.rst [new file with mode: 0644]
pelican-theme/test/test_blog.py

index 98c1020765ce0617fe672834d172044e29b02fa5..6282168fd5b007c7816aea4e7d3617bdacf2e2c8 100644 (file)
@@ -1 +1 @@
-<p>Posted{% if article.authors %} by {% for author in article.authors %}<a href="{{ author.url|format_siteurl|e }}">{{ author|e }}</a>{% endfor %}{% endif %} on <time datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}</time> in <a href="{{ article.category.url|format_siteurl|e }}">{{ article.category|e }}</a>.{% if article.modified %} <span class="m-label m-success">updated <time datetime="{{ article.modified.isoformat() }}">{{ article.locale_modified }}</time></span>{% endif %}{% if article.archived == 'True' %} <span class="m-label m-warning">archived</span>{% endif %}{% if article.tags %} Tags: {% for tag in article.tags %}<a href="{{ tag.url|format_siteurl|e }}">{{ tag|e }}</a>{% if not loop.last %}, {% endif %}{% endfor %}.{% endif %}</p>
+<p>Posted{% if article.authors %} by {% for author in article.authors %}<a href="{{ author.url|format_siteurl|e }}">{{ author|e }}</a>{% endfor %}{% endif %} on <time datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}</time> in <a href="{{ article.category.url|format_siteurl|e }}">{{ article.category|e }}</a>.{% if article.modified %} <span class="m-label m-success">updated <time datetime="{{ article.modified.isoformat() }}">{{ article.locale_modified }}</time></span>{% endif %}{% if article.archived == 'True' %} <span class="m-label m-warning">archived</span>{% endif %}{% if article.status == 'draft' %} <span class="m-label m-dim">draft</span>{% endif %}{% if article.tags %} Tags: {% for tag in article.tags %}<a href="{{ tag.url|format_siteurl|e }}">{{ tag|e }}</a>{% if not loop.last %}, {% endif %}{% endfor %}.{% endif %}</p>
diff --git a/pelican-theme/test/blog_draft/article.html b/pelican-theme/test/blog_draft/article.html
new file mode 100644 (file)
index 0000000..900f0eb
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>An 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.html" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <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>
+<div class="m-container">
+  <div class="m-row">
+    <article class="m-col-m-10 m-nopadb">
+      <header>
+        <h1><a href="article.html" rel="bookmark" title="Permalink to An article">
+          <time class="m-date" datetime="2017-12-09T00:00:00+00:00">
+            Dec <span class="m-date-day">09</span> 2017
+          </time>
+          An article
+        </a></h1>
+      </header>
+      <div class="m-clearfix-l"></div>
+      <footer>
+        <p>Posted on <time datetime="2017-12-09T00:00:00+00:00">Dec 09, 2017</time> in <a href="category-misc.html">misc</a>. <span class="m-label m-dim">draft</span></p>
+      </footer>
+    </article>
+    <nav class="m-navpanel m-col-m-2">
+      <h3>Categories</h3>
+      <ol class="m-block-bar-m">
+        <li><em class="m-text m-dim">(none yet)</em></li>
+      </ol>
+    </nav>
+  </div>
+</div>
+</main>
+</body>
+</html>
diff --git a/pelican-theme/test/blog_draft/article.rst b/pelican-theme/test/blog_draft/article.rst
new file mode 100644 (file)
index 0000000..1b6144f
--- /dev/null
@@ -0,0 +1,5 @@
+An article
+##########
+
+:date: 2017-12-09
+:status: draft
index bc50131c1ef6a920e16eb1adfecbb11d35b3c15f..cc595a36997f244e1c14d73c1f459364e302c008 100644 (file)
@@ -537,3 +537,15 @@ class NewsOnIndex(BlogTestCase):
         })
 
         self.assertEqual(*self.actual_expected_contents('index.html'))
+
+class Draft(BlogTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'draft', *args, **kwargs)
+
+    def test(self):
+        self.run_pelican({
+            'DRAFT_URL': '{slug}.html',
+            'DRAFT_SAVE_AS': '{slug}.html'
+        })
+
+        self.assertEqual(*self.actual_expected_contents('article.html'))