From 88faa650450cd3a8c8cfeb513c189ba8fb495e58 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 6 May 2018 13:07:56 +0200 Subject: [PATCH] theme: render the draft status in article footer. --- pelican-theme/templates/article_footer.html | 2 +- pelican-theme/test/blog_draft/article.html | 46 +++++++++++++++++++++ pelican-theme/test/blog_draft/article.rst | 5 +++ pelican-theme/test/test_blog.py | 12 ++++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 pelican-theme/test/blog_draft/article.html create mode 100644 pelican-theme/test/blog_draft/article.rst diff --git a/pelican-theme/templates/article_footer.html b/pelican-theme/templates/article_footer.html index 98c10207..6282168f 100644 --- a/pelican-theme/templates/article_footer.html +++ b/pelican-theme/templates/article_footer.html @@ -1 +1 @@ -

Posted{% if article.authors %} by {% for author in article.authors %}{{ author|e }}{% endfor %}{% endif %} on in {{ article.category|e }}.{% if article.modified %} updated {% endif %}{% if article.archived == 'True' %} archived{% endif %}{% if article.tags %} Tags: {% for tag in article.tags %}{{ tag|e }}{% if not loop.last %}, {% endif %}{% endfor %}.{% endif %}

+

Posted{% if article.authors %} by {% for author in article.authors %}{{ author|e }}{% endfor %}{% endif %} on in {{ article.category|e }}.{% if article.modified %} updated {% endif %}{% if article.archived == 'True' %} archived{% endif %}{% if article.status == 'draft' %} draft{% endif %}{% if article.tags %} Tags: {% for tag in article.tags %}{{ tag|e }}{% if not loop.last %}, {% endif %}{% endfor %}.{% endif %}

diff --git a/pelican-theme/test/blog_draft/article.html b/pelican-theme/test/blog_draft/article.html new file mode 100644 index 00000000..900f0eb9 --- /dev/null +++ b/pelican-theme/test/blog_draft/article.html @@ -0,0 +1,46 @@ + + + + + An article | A Pelican Blog + + + + + + +
+
+
+
+ + +
+
+
+ + diff --git a/pelican-theme/test/blog_draft/article.rst b/pelican-theme/test/blog_draft/article.rst new file mode 100644 index 00000000..1b6144f0 --- /dev/null +++ b/pelican-theme/test/blog_draft/article.rst @@ -0,0 +1,5 @@ +An article +########## + +:date: 2017-12-09 +:status: draft diff --git a/pelican-theme/test/test_blog.py b/pelican-theme/test/test_blog.py index bc50131c..cc595a36 100644 --- a/pelican-theme/test/test_blog.py +++ b/pelican-theme/test/test_blog.py @@ -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')) -- 2.30.2