From: Vladimír Vondruš Date: Mon, 11 Dec 2017 11:41:19 +0000 (+0100) Subject: m.htmlsanity: improve the test. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=fee3837320d1c62b3dcb333a415b00a917338445;p=blog.git m.htmlsanity: improve the test. In particular, hyphenation is used inside the theme itself, verify that things are not wrongly escaped for example. --- diff --git a/pelican-plugins/m/test/htmlsanity_typography/article-jumbo.html b/pelican-plugins/m/test/htmlsanity_typography/article-jumbo.html new file mode 100644 index 00000000..998bc35c --- /dev/null +++ b/pelican-plugins/m/test/htmlsanity_typography/article-jumbo.html @@ -0,0 +1,105 @@ + + + + + A jumbo article | A Pelican Blog + + + + + + + + + + + + + + + + +
+
+ + +
+ + + diff --git a/pelican-plugins/m/test/htmlsanity_typography/article-lang.html b/pelican-plugins/m/test/htmlsanity_typography/article-lang.html index 5d385fc3..5084f4e3 100644 --- a/pelican-plugins/m/test/htmlsanity_typography/article-lang.html +++ b/pelican-plugins/m/test/htmlsanity_typography/article-lang.html @@ -6,11 +6,11 @@ - + - - + + @@ -29,7 +29,7 @@
diff --git a/pelican-plugins/m/test/htmlsanity_typography/articles/jumbo.rst b/pelican-plugins/m/test/htmlsanity_typography/articles/jumbo.rst new file mode 100644 index 00000000..1cc51cc0 --- /dev/null +++ b/pelican-plugins/m/test/htmlsanity_typography/articles/jumbo.rst @@ -0,0 +1,10 @@ +A jumbo article +############### + +:date: 2017-12-10 +:cover: image.jpg +:category: A category +:author: An Author +:tags: Tagging a name + +Article content. diff --git a/pelican-plugins/m/test/htmlsanity_typography/articles/lang.rst b/pelican-plugins/m/test/htmlsanity_typography/articles/lang.rst index 4e22a812..a7073b21 100644 --- a/pelican-plugins/m/test/htmlsanity_typography/articles/lang.rst +++ b/pelican-plugins/m/test/htmlsanity_typography/articles/lang.rst @@ -2,6 +2,9 @@ Article in different language ############################# :date: 2017-12-10 +:category: A category +:author: An Author +:tags: Tagging a name :lang: cs Text tohoto článku je česky (přičemž ``DEFAULT_LANG`` je ``'en'``) a měl by diff --git a/pelican-plugins/m/test/htmlsanity_typography/author-an-author.html b/pelican-plugins/m/test/htmlsanity_typography/author-an-author.html new file mode 100644 index 00000000..2290f3f9 --- /dev/null +++ b/pelican-plugins/m/test/htmlsanity_typography/author-an-author.html @@ -0,0 +1,84 @@ + + + + + Posts by An Au­thor | A Pelican Blog + + + + + +
+
+
+
+
+
+ Showing only posts by An Au­thor. Show all posts. +
+ + +
+ +
+
+
+ + + diff --git a/pelican-plugins/m/test/htmlsanity_typography/category-a-category.html b/pelican-plugins/m/test/htmlsanity_typography/category-a-category.html new file mode 100644 index 00000000..2ecb71d8 --- /dev/null +++ b/pelican-plugins/m/test/htmlsanity_typography/category-a-category.html @@ -0,0 +1,84 @@ + + + + + A category | A Pelican Blog + + + + + +
+
+
+
+
+
+ Showing only posts in A category. Show all posts. +
+ + +
+ +
+
+
+ + + diff --git a/pelican-plugins/m/test/htmlsanity_typography/tag-tagging-a-name.html b/pelican-plugins/m/test/htmlsanity_typography/tag-tagging-a-name.html new file mode 100644 index 00000000..e335bda5 --- /dev/null +++ b/pelican-plugins/m/test/htmlsanity_typography/tag-tagging-a-name.html @@ -0,0 +1,84 @@ + + + + + Posts tagged Tagging a name | A Pelican Blog + + + + + +
+
+
+
+
+
+ Showing only posts tagged Tagging a name. Show all posts. +
+ + +
+ +
+
+
+ + + diff --git a/pelican-plugins/m/test/test_htmlsanity.py b/pelican-plugins/m/test/test_htmlsanity.py index b9fff16a..8fc02508 100644 --- a/pelican-plugins/m/test/test_htmlsanity.py +++ b/pelican-plugins/m/test/test_htmlsanity.py @@ -25,24 +25,40 @@ class Typography(PluginTestCase): 'M_HTMLSANITY_HYPHENATION': True, 'M_HTMLSANITY_SMART_QUOTES': True, 'M_FINE_PRINT': "The footer should be hyphenated as well. \"And with smart quotes.\"", - 'DATE_FORMATS': {'cs': ('en_US.UTF-8', '%b %d, %Y')}, + 'M_SHOW_AUTHOR_LIST': True, + 'DATE_FORMATS': {'en': ('en_US.UTF-8', '%b %d, %Y'), + 'cs': ('en_US.UTF-8', '%b %d, %Y')}, 'PAGE_LANG_SAVE_AS': '{slug}.html', 'ARTICLE_SAVE_AS': 'article-{slug}.html', + 'ARTICLE_URL': 'article-{slug}.html', 'ARTICLE_LANG_SAVE_AS': 'article-{slug}.html', + 'ARTICLE_LANG_URL': 'article-{slug}.html', + 'CATEGORY_SAVE_AS': 'category-{slug}.html', + 'CATEGORY_URL': 'category-{slug}.html', + 'AUTHOR_SAVE_AS': 'author-{slug}.html', + 'AUTHOR_URL': 'author-{slug}.html', + 'TAG_SAVE_AS': 'tag-{slug}.html', + 'TAG_URL': 'tag-{slug}.html', 'FORMATTED_FIELDS': ['summary', 'description', 'header', 'footer'], # Disable unneeded stuff 'TRANSLATION_FEED_ATOM': None, 'CATEGORY_FEED_ATOM': None, - 'CATEGORY_SAVE_AS': '', + 'AUTHOR_FEED_ATOM': None, + 'AUTHOR_FEED_RSS': None, }) # The ­ should be at proper places and not where it shouldn't be. + # The lang element should be set correctly as well. Verify that + # hyphenation and smart quotes are correctly used across the whole + # theme. self.assertEqual(*self.actual_expected_contents('page.html')) - - # The lang element should be set correctly as well. self.assertEqual(*self.actual_expected_contents('page-lang.html')) self.assertEqual(*self.actual_expected_contents('article-lang.html')) + self.assertEqual(*self.actual_expected_contents('article-jumbo.html')) + self.assertEqual(*self.actual_expected_contents('author-an-author.html')) + self.assertEqual(*self.actual_expected_contents('category-a-category.html')) + self.assertEqual(*self.actual_expected_contents('tag-tagging-a-name.html')) class TypographyGlobalLang(PluginTestCase): def __init__(self, *args, **kwargs):