From 877d454c8fa979343d4881a00977d9ac8786f178 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 4 Apr 2012 22:24:44 +0200 Subject: [PATCH 001/359] fix sorting of categories list --- pelican/generators.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pelican/generators.py b/pelican/generators.py index d7ebb0b0..02bed967 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -302,7 +302,9 @@ class ArticlesGenerator(Generator): # order the categories per name self.categories = list(self.categories.items()) - self.categories.sort(reverse=self.settings['REVERSE_CATEGORY_ORDER']) + self.categories.sort( + key=lambda item: item[0].name, + reverse=self.settings['REVERSE_CATEGORY_ORDER']) self.authors = list(self.authors.items()) self.authors.sort() From 7f36e0ed20745c73886d96d4af303b0d858b8a53 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 4 Apr 2012 22:24:53 +0200 Subject: [PATCH 002/359] fix sorting of authors list --- pelican/generators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/generators.py b/pelican/generators.py index 02bed967..de45f411 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -307,7 +307,7 @@ class ArticlesGenerator(Generator): reverse=self.settings['REVERSE_CATEGORY_ORDER']) self.authors = list(self.authors.items()) - self.authors.sort() + self.authors.sort(key=lambda item: item[0].name) self._update_context(('articles', 'dates', 'tags', 'categories', 'tag_cloud', 'authors')) From f903aaa1a4241e3cf35aff74ee4d231cb6d368e5 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 4 Apr 2012 22:43:08 +0200 Subject: [PATCH 003/359] remove unittest.skip statements for functional tests --- tests/test_pelican.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index c317e5b3..49328ebe 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -23,7 +23,6 @@ class TestPelican(unittest.TestCase): # general functional testing for pelican. Basically, this test case tries # to run pelican in different situations and see how it behaves - @unittest.skip("Test failing") def test_basic_generation_works(self): # when running pelican without settings, it should pick up the default # ones and generate the output without raising any exception / issuing @@ -36,7 +35,6 @@ class TestPelican(unittest.TestCase): self.assertEqual(diff.right_only, []) self.assertEqual(diff.diff_files, []) - @unittest.skip("Test failing") def test_custom_generation_works(self): # the same thing with a specified set of settings should work with temporary_folder() as temp_path: From 7fcaca85dded7b06729ec901bc80f0bf9036487c Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 4 Apr 2012 22:35:53 +0200 Subject: [PATCH 004/359] update custom output now that categories are correctly sorted pelican -o tests/output/custom/ -s samples/pelican.conf.py samples/content/ --- .../custom/a-markdown-powered-article.html | 8 ++++---- tests/output/custom/archives.html | 8 ++++---- tests/output/custom/article-1.html | 8 ++++---- tests/output/custom/article-2.html | 8 ++++---- tests/output/custom/article-3.html | 8 ++++---- tests/output/custom/author/alexis-metaireau.html | 8 ++++---- .../output/custom/author/alexis-metaireau2.html | 13 +++++++------ tests/output/custom/categories.html | 16 ++++++++-------- tests/output/custom/category/bar.html | 8 ++++---- tests/output/custom/category/cat1.html | 8 ++++---- tests/output/custom/category/content.html | 8 ++++---- tests/output/custom/category/yeah.html | 8 ++++---- tests/output/custom/drafts/a-draft-article.html | 8 ++++---- tests/output/custom/feeds/all-en.atom.xml | 14 +++++++------- tests/output/custom/feeds/all-fr.atom.xml | 4 ++-- tests/output/custom/feeds/all.atom.xml | 14 +++++++------- tests/output/custom/feeds/all.rss.xml | 16 ++++++++-------- tests/output/custom/feeds/bar.atom.xml | 2 +- tests/output/custom/feeds/bar.rss.xml | 4 ++-- tests/output/custom/feeds/cat1.atom.xml | 6 +++--- tests/output/custom/feeds/cat1.rss.xml | 8 ++++---- tests/output/custom/feeds/content.atom.xml | 4 ++-- tests/output/custom/feeds/content.rss.xml | 6 +++--- tests/output/custom/feeds/yeah.atom.xml | 2 +- tests/output/custom/feeds/yeah.rss.xml | 4 ++-- tests/output/custom/index.html | 8 ++++---- tests/output/custom/index2.html | 13 +++++++------ tests/output/custom/oh-yeah-fr.html | 8 ++++---- tests/output/custom/oh-yeah.html | 8 ++++---- .../output/custom/pages/this-is-a-test-page.html | 8 ++++---- tests/output/custom/second-article-fr.html | 8 ++++---- tests/output/custom/second-article.html | 8 ++++---- tests/output/custom/tag/bar.html | 13 +++++++------ tests/output/custom/tag/baz.html | 8 ++++---- tests/output/custom/tag/foo.html | 13 +++++++------ tests/output/custom/tag/foobar.html | 8 ++++---- tests/output/custom/tag/oh.html | 8 ++++---- tests/output/custom/tag/yeah.html | 8 ++++---- tests/output/custom/theme/css/main.css | 7 +++++++ tests/output/custom/this-is-a-super-article.html | 8 ++++---- tests/output/custom/unbelievable.html | 8 ++++---- 41 files changed, 177 insertions(+), 166 deletions(-) diff --git a/tests/output/custom/a-markdown-powered-article.html b/tests/output/custom/a-markdown-powered-article.html index c001278a..74e53913 100644 --- a/tests/output/custom/a-markdown-powered-article.html +++ b/tests/output/custom/a-markdown-powered-article.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/archives.html b/tests/output/custom/archives.html index e9393667..706c7464 100644 --- a/tests/output/custom/archives.html +++ b/tests/output/custom/archives.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/article-1.html b/tests/output/custom/article-1.html index 4bdb8f16..8c73b4ac 100644 --- a/tests/output/custom/article-1.html +++ b/tests/output/custom/article-1.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/article-2.html b/tests/output/custom/article-2.html index 6a0bb442..e8758391 100644 --- a/tests/output/custom/article-2.html +++ b/tests/output/custom/article-2.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/article-3.html b/tests/output/custom/article-3.html index 8410b4f9..ace9dfbf 100644 --- a/tests/output/custom/article-3.html +++ b/tests/output/custom/article-3.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index 1a373e5d..85f550b4 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/author/alexis-metaireau2.html b/tests/output/custom/author/alexis-metaireau2.html index 43ded360..53fec2e5 100644 --- a/tests/output/custom/author/alexis-metaireau2.html +++ b/tests/output/custom/author/alexis-metaireau2.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + @@ -165,8 +165,9 @@ Translations: - Multi-line metadata should be supported -as well as inline markup. +

    Multi-line metadata should be supported +as well as inline markup.

    + read more

    There are comments.

    diff --git a/tests/output/custom/categories.html b/tests/output/custom/categories.html index a1a44e5b..92830754 100644 --- a/tests/output/custom/categories.html +++ b/tests/output/custom/categories.html @@ -39,27 +39,27 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • +
    diff --git a/tests/output/custom/category/bar.html b/tests/output/custom/category/bar.html index 809a2bdf..53af38da 100644 --- a/tests/output/custom/category/bar.html +++ b/tests/output/custom/category/bar.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/category/cat1.html b/tests/output/custom/category/cat1.html index fa6c6556..94bb74a7 100644 --- a/tests/output/custom/category/cat1.html +++ b/tests/output/custom/category/cat1.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/category/content.html b/tests/output/custom/category/content.html index 16651436..7645d430 100644 --- a/tests/output/custom/category/content.html +++ b/tests/output/custom/category/content.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/category/yeah.html b/tests/output/custom/category/yeah.html index 3c9af4e2..dc20affb 100644 --- a/tests/output/custom/category/yeah.html +++ b/tests/output/custom/category/yeah.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/drafts/a-draft-article.html b/tests/output/custom/drafts/a-draft-article.html index 99f5ad68..e12e5bd7 100644 --- a/tests/output/custom/drafts/a-draft-article.html +++ b/tests/output/custom/drafts/a-draft-article.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/feeds/all-en.atom.xml b/tests/output/custom/feeds/all-en.atom.xml index 7356cb17..1b18c1bd 100644 --- a/tests/output/custom/feeds/all-en.atom.xml +++ b/tests/output/custom/feeds/all-en.atom.xml @@ -1,9 +1,9 @@ -Alexis' loghttp://blog.notmyidea.org2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-3.html<p>Article 3</p> -This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> +This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> +Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/all-fr.atom.xml b/tests/output/custom/feeds/all-fr.atom.xml index 27949d80..1d42bb6e 100644 --- a/tests/output/custom/feeds/all-fr.atom.xml +++ b/tests/output/custom/feeds/all-fr.atom.xml @@ -1,4 +1,4 @@ -Alexis' loghttp://blog.notmyidea.org2012-03-02T14:01:01+01:00Trop bien !2012-03-02T14:01:01+01:00Alexis Métaireauhttp://blog.notmyidea.org/oh-yeah-fr.html<p>Et voila du contenu en français</p> -Deuxième article2012-02-29T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/second-article-fr.html<p>Ceci est un article, en français.</p> +Alexis' loghttp://blog.notmyidea.org/2012-03-02T14:01:01+01:00Trop bien !2012-03-02T14:01:01+01:00Alexis Métaireautag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> +Deuxième article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/all.atom.xml b/tests/output/custom/feeds/all.atom.xml index ef6dbf52..9090f431 100644 --- a/tests/output/custom/feeds/all.atom.xml +++ b/tests/output/custom/feeds/all.atom.xml @@ -1,9 +1,9 @@ -Alexis' loghttp://blog.notmyidea.org2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-3.html<p>Article 3</p> -This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> +This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> +Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/all.rss.xml b/tests/output/custom/feeds/all.rss.xml index a3f7eff9..b726e2d1 100644 --- a/tests/output/custom/feeds/all.rss.xml +++ b/tests/output/custom/feeds/all.rss.xml @@ -1,9 +1,9 @@ -Alexis' loghttp://blog.notmyidea.orgWed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> -Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100http://blog.notmyidea.org/second-article.htmlfoobarbazA markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200http://blog.notmyidea.org/a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.org/article-1.html<p>Article 1</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-1.htmlArticle 2http://blog.notmyidea.org/article-2.html<p>Article 2</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-2.htmlArticle 3http://blog.notmyidea.org/article-3.html<p>Article 3</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-3.htmlThis is a super article !http://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.orgsecond-article.html<p>This is some article, in english</p> +Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazA markdown powered articlehttp://blog.notmyidea.orga-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.orgarticle-1.html<p>Article 1</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-1.htmlArticle 2http://blog.notmyidea.orgarticle-2.html<p>Article 2</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-2.htmlArticle 3http://blog.notmyidea.orgarticle-3.html<p>Article 3</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-3.htmlThis is a super article !http://blog.notmyidea.orgthis-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Alexis MétaireauThu, 02 Dec 2010 10:14:00 +0100http://blog.notmyidea.org/this-is-a-super-article.htmlfoobarfoobarOh yeah !http://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> +Alexis MétaireauThu, 02 Dec 2010 10:14:00 +0100tag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.htmlfoobarfoobarOh yeah !http://blog.notmyidea.orgoh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200http://blog.notmyidea.org/oh-yeah.htmlohbaryeahUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> -Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200http://blog.notmyidea.org/unbelievable.html \ No newline at end of file +Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200tag:blog.notmyidea.org,2010-10-20:oh-yeah.htmlohbaryeahUnbelievable !http://blog.notmyidea.orgunbelievable.html<p>Or completely awesome. Depends the needs.</p> +Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.html \ No newline at end of file diff --git a/tests/output/custom/feeds/bar.atom.xml b/tests/output/custom/feeds/bar.atom.xml index 84ac9cda..93961545 100644 --- a/tests/output/custom/feeds/bar.atom.xml +++ b/tests/output/custom/feeds/bar.atom.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org2010-10-20T10:14:00+02:00Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> +Alexis' loghttp://blog.notmyidea.org/2010-10-20T10:14:00+02:00Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> diff --git a/tests/output/custom/feeds/bar.rss.xml b/tests/output/custom/feeds/bar.rss.xml index bb5cb2b4..0a9d0f9d 100644 --- a/tests/output/custom/feeds/bar.rss.xml +++ b/tests/output/custom/feeds/bar.rss.xml @@ -1,8 +1,8 @@ -Alexis' loghttp://blog.notmyidea.orgWed, 20 Oct 2010 10:14:00 +0200Oh yeah !http://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> +Alexis' loghttp://blog.notmyidea.org/Wed, 20 Oct 2010 10:14:00 +0200Oh yeah !http://blog.notmyidea.orgoh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200http://blog.notmyidea.org/oh-yeah.htmlohbaryeah \ No newline at end of file +Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200tag:blog.notmyidea.org,2010-10-20:oh-yeah.htmlohbaryeah \ No newline at end of file diff --git a/tests/output/custom/feeds/cat1.atom.xml b/tests/output/custom/feeds/cat1.atom.xml index e0f01780..4fce560d 100644 --- a/tests/output/custom/feeds/cat1.atom.xml +++ b/tests/output/custom/feeds/cat1.atom.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org2011-04-20T00:00:00+02:00A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-3.html<p>Article 3</p> +Alexis' loghttp://blog.notmyidea.org/2011-04-20T00:00:00+02:00A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/cat1.rss.xml b/tests/output/custom/feeds/cat1.rss.xml index 0043b2fb..d322572b 100644 --- a/tests/output/custom/feeds/cat1.rss.xml +++ b/tests/output/custom/feeds/cat1.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.orgWed, 20 Apr 2011 00:00:00 +0200A markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200http://blog.notmyidea.org/a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.org/article-1.html<p>Article 1</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-1.htmlArticle 2http://blog.notmyidea.org/article-2.html<p>Article 2</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-2.htmlArticle 3http://blog.notmyidea.org/article-3.html<p>Article 3</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-3.html \ No newline at end of file +Alexis' loghttp://blog.notmyidea.org/Wed, 20 Apr 2011 00:00:00 +0200A markdown powered articlehttp://blog.notmyidea.orga-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.orgarticle-1.html<p>Article 1</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-1.htmlArticle 2http://blog.notmyidea.orgarticle-2.html<p>Article 2</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-2.htmlArticle 3http://blog.notmyidea.orgarticle-3.html<p>Article 3</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-3.html \ No newline at end of file diff --git a/tests/output/custom/feeds/content.atom.xml b/tests/output/custom/feeds/content.atom.xml index c141a0aa..6f93c8f4 100644 --- a/tests/output/custom/feeds/content.atom.xml +++ b/tests/output/custom/feeds/content.atom.xml @@ -1,4 +1,4 @@ -Alexis' loghttp://blog.notmyidea.org2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> -Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/content.rss.xml b/tests/output/custom/feeds/content.rss.xml index 9f36c97e..74a322e7 100644 --- a/tests/output/custom/feeds/content.rss.xml +++ b/tests/output/custom/feeds/content.rss.xml @@ -1,4 +1,4 @@ -Alexis' loghttp://blog.notmyidea.orgWed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> -Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100http://blog.notmyidea.org/second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> -Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200http://blog.notmyidea.org/unbelievable.html \ No newline at end of file +Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.orgsecond-article.html<p>This is some article, in english</p> +Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.orgunbelievable.html<p>Or completely awesome. Depends the needs.</p> +Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.html \ No newline at end of file diff --git a/tests/output/custom/feeds/yeah.atom.xml b/tests/output/custom/feeds/yeah.atom.xml index 4c6eed49..9a95fa03 100644 --- a/tests/output/custom/feeds/yeah.atom.xml +++ b/tests/output/custom/feeds/yeah.atom.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org2010-12-02T10:14:00+01:00This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/2010-12-02T10:14:00+01:00This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> diff --git a/tests/output/custom/feeds/yeah.rss.xml b/tests/output/custom/feeds/yeah.rss.xml index c4f5512e..1c5884a2 100644 --- a/tests/output/custom/feeds/yeah.rss.xml +++ b/tests/output/custom/feeds/yeah.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.orgThu, 02 Dec 2010 10:14:00 +0100This is a super article !http://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/Thu, 02 Dec 2010 10:14:00 +0100This is a super article !http://blog.notmyidea.orgthis-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -11,4 +11,4 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Alexis MétaireauThu, 02 Dec 2010 10:14:00 +0100http://blog.notmyidea.org/this-is-a-super-article.htmlfoobarfoobar \ No newline at end of file +Alexis MétaireauThu, 02 Dec 2010 10:14:00 +0100tag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.htmlfoobarfoobar \ No newline at end of file diff --git a/tests/output/custom/index.html b/tests/output/custom/index.html index 466a4db4..ae77c625 100644 --- a/tests/output/custom/index.html +++ b/tests/output/custom/index.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/index2.html b/tests/output/custom/index2.html index 9262d717..797217ad 100644 --- a/tests/output/custom/index2.html +++ b/tests/output/custom/index2.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + @@ -115,8 +115,9 @@ - Multi-line metadata should be supported -as well as inline markup. +

    Multi-line metadata should be supported +as well as inline markup.

    + read more

    There are comments.

    diff --git a/tests/output/custom/oh-yeah-fr.html b/tests/output/custom/oh-yeah-fr.html index e692105b..b699b41c 100644 --- a/tests/output/custom/oh-yeah-fr.html +++ b/tests/output/custom/oh-yeah-fr.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/oh-yeah.html b/tests/output/custom/oh-yeah.html index 6ffaad13..b8263c1b 100644 --- a/tests/output/custom/oh-yeah.html +++ b/tests/output/custom/oh-yeah.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/pages/this-is-a-test-page.html b/tests/output/custom/pages/this-is-a-test-page.html index 27d6ec69..f176e761 100644 --- a/tests/output/custom/pages/this-is-a-test-page.html +++ b/tests/output/custom/pages/this-is-a-test-page.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/second-article-fr.html b/tests/output/custom/second-article-fr.html index b3b12af7..9e5b81ad 100644 --- a/tests/output/custom/second-article-fr.html +++ b/tests/output/custom/second-article-fr.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/second-article.html b/tests/output/custom/second-article.html index 4b31dc69..a769cee4 100644 --- a/tests/output/custom/second-article.html +++ b/tests/output/custom/second-article.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/tag/bar.html b/tests/output/custom/tag/bar.html index bf468bf2..5d6237cd 100644 --- a/tests/output/custom/tag/bar.html +++ b/tests/output/custom/tag/bar.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + @@ -158,8 +158,9 @@ Translations: - Multi-line metadata should be supported -as well as inline markup. +

    Multi-line metadata should be supported +as well as inline markup.

    + read more

    There are comments.

    diff --git a/tests/output/custom/tag/baz.html b/tests/output/custom/tag/baz.html index 34bcdbc3..e1be3d77 100644 --- a/tests/output/custom/tag/baz.html +++ b/tests/output/custom/tag/baz.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/tag/foo.html b/tests/output/custom/tag/foo.html index c8f088f1..3beabbb1 100644 --- a/tests/output/custom/tag/foo.html +++ b/tests/output/custom/tag/foo.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + @@ -158,8 +158,9 @@ Translations: - Multi-line metadata should be supported -as well as inline markup. +

    Multi-line metadata should be supported +as well as inline markup.

    + read more

    There are comments.

    diff --git a/tests/output/custom/tag/foobar.html b/tests/output/custom/tag/foobar.html index 682a9b7d..2da611ed 100644 --- a/tests/output/custom/tag/foobar.html +++ b/tests/output/custom/tag/foobar.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/tag/oh.html b/tests/output/custom/tag/oh.html index 9e8239a4..73db4505 100644 --- a/tests/output/custom/tag/oh.html +++ b/tests/output/custom/tag/oh.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/tag/yeah.html b/tests/output/custom/tag/yeah.html index 675a53cb..f72400a6 100644 --- a/tests/output/custom/tag/yeah.html +++ b/tests/output/custom/tag/yeah.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/theme/css/main.css b/tests/output/custom/theme/css/main.css index 28c98b99..92905076 100644 --- a/tests/output/custom/theme/css/main.css +++ b/tests/output/custom/theme/css/main.css @@ -111,6 +111,13 @@ cite {} q {} +div.note { + float: right; + margin: 5px; + font-size: 85%; + max-width: 300px; +} + /* Tables */ table {margin: .5em auto 1.5em auto; width: 98%;} diff --git a/tests/output/custom/this-is-a-super-article.html b/tests/output/custom/this-is-a-super-article.html index 2fd6b306..9ba6bb9b 100644 --- a/tests/output/custom/this-is-a-super-article.html +++ b/tests/output/custom/this-is-a-super-article.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/unbelievable.html b/tests/output/custom/unbelievable.html index b7730421..1b611efe 100644 --- a/tests/output/custom/unbelievable.html +++ b/tests/output/custom/unbelievable.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + From c4c49678f906897fe276831ab5e5261f16f757ac Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 4 Apr 2012 22:40:03 +0200 Subject: [PATCH 005/359] update basic output now that categories are correctly sorted pelican -o tests/output/basic/ samples/content/ --- tests/output/basic/a-markdown-powered-article.html | 4 ++-- tests/output/basic/archives.html | 4 ++-- tests/output/basic/article-1.html | 4 ++-- tests/output/basic/article-2.html | 4 ++-- tests/output/basic/article-3.html | 4 ++-- tests/output/basic/author/alexis-metaireau.html | 9 +++++---- tests/output/basic/author/bruno.html | 4 ++-- tests/output/basic/categories.html | 8 ++++---- tests/output/basic/category/bar.html | 4 ++-- tests/output/basic/category/cat1.html | 4 ++-- tests/output/basic/category/content.html | 4 ++-- tests/output/basic/category/yeah.html | 4 ++-- tests/output/basic/drafts/a-draft-article.html | 4 ++-- tests/output/basic/feeds/all-en.atom.xml | 14 +++++++------- tests/output/basic/feeds/all-fr.atom.xml | 4 ++-- tests/output/basic/feeds/all.atom.xml | 14 +++++++------- tests/output/basic/feeds/bar.atom.xml | 2 +- tests/output/basic/feeds/cat1.atom.xml | 6 +++--- tests/output/basic/feeds/content.atom.xml | 4 ++-- tests/output/basic/feeds/yeah.atom.xml | 2 +- tests/output/basic/index.html | 9 +++++---- tests/output/basic/oh-yeah-fr.html | 4 ++-- tests/output/basic/oh-yeah.html | 4 ++-- tests/output/basic/pages/this-is-a-test-page.html | 4 ++-- tests/output/basic/second-article-fr.html | 4 ++-- tests/output/basic/second-article.html | 4 ++-- tests/output/basic/tag/bar.html | 9 +++++---- tests/output/basic/tag/baz.html | 4 ++-- tests/output/basic/tag/foo.html | 9 +++++---- tests/output/basic/tag/foobar.html | 4 ++-- tests/output/basic/tag/oh.html | 4 ++-- tests/output/basic/tag/yeah.html | 4 ++-- tests/output/basic/theme/css/main.css | 7 +++++++ tests/output/basic/this-is-a-super-article.html | 4 ++-- tests/output/basic/unbelievable.html | 4 ++-- 35 files changed, 98 insertions(+), 87 deletions(-) diff --git a/tests/output/basic/a-markdown-powered-article.html b/tests/output/basic/a-markdown-powered-article.html index 32a863d6..d36ba32c 100644 --- a/tests/output/basic/a-markdown-powered-article.html +++ b/tests/output/basic/a-markdown-powered-article.html @@ -31,11 +31,11 @@ -
  • content
  • +
  • bar
  • cat1
  • -
  • bar
  • +
  • content
  • yeah
  • diff --git a/tests/output/basic/archives.html b/tests/output/basic/archives.html index 840dfa02..9aedb29d 100644 --- a/tests/output/basic/archives.html +++ b/tests/output/basic/archives.html @@ -31,11 +31,11 @@ -
  • content
  • +
  • bar
  • cat1
  • -
  • bar
  • +
  • content
  • yeah
  • diff --git a/tests/output/basic/article-1.html b/tests/output/basic/article-1.html index c1199371..e681b991 100644 --- a/tests/output/basic/article-1.html +++ b/tests/output/basic/article-1.html @@ -31,11 +31,11 @@ -
  • content
  • +
  • bar
  • cat1
  • -
  • bar
  • +
  • content
  • yeah
  • diff --git a/tests/output/basic/article-2.html b/tests/output/basic/article-2.html index 62dd0368..b56d18ba 100644 --- a/tests/output/basic/article-2.html +++ b/tests/output/basic/article-2.html @@ -31,11 +31,11 @@ -
  • content
  • +
  • bar
  • cat1
  • -
  • bar
  • +
  • content
  • yeah
  • diff --git a/tests/output/basic/article-3.html b/tests/output/basic/article-3.html index 9fd6df0a..0d2525e7 100644 --- a/tests/output/basic/article-3.html +++ b/tests/output/basic/article-3.html @@ -31,11 +31,11 @@ -
  • content
  • +
  • bar
  • cat1
  • -
  • bar
  • +
  • content
  • yeah
  • diff --git a/tests/output/basic/author/alexis-metaireau.html b/tests/output/basic/author/alexis-metaireau.html index ab68482d..6bf631eb 100644 --- a/tests/output/basic/author/alexis-metaireau.html +++ b/tests/output/basic/author/alexis-metaireau.html @@ -31,11 +31,11 @@ -
  • content
  • +
  • bar
  • cat1
  • -
  • bar
  • +
  • content
  • yeah
  • @@ -115,8 +115,9 @@ YEAH !

    - Multi-line metadata should be supported -as well as inline markup. +

    Multi-line metadata should be supported +as well as inline markup.

    + read more diff --git a/tests/output/basic/author/bruno.html b/tests/output/basic/author/bruno.html index 1e2dc655..f889c94e 100644 --- a/tests/output/basic/author/bruno.html +++ b/tests/output/basic/author/bruno.html @@ -31,11 +31,11 @@ -
  • content
  • +
  • bar
  • cat1
  • -
  • bar
  • +
  • content
  • yeah
  • diff --git a/tests/output/basic/categories.html b/tests/output/basic/categories.html index 5ffb220d..2430cc96 100644 --- a/tests/output/basic/categories.html +++ b/tests/output/basic/categories.html @@ -31,11 +31,11 @@ -
  • content
  • +
  • bar
  • cat1
  • -
  • bar
  • +
  • content
  • yeah
  • @@ -44,11 +44,11 @@
      -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/category/bar.html b/tests/output/basic/category/bar.html index b268dd53..77d0187b 100644 --- a/tests/output/basic/category/bar.html +++ b/tests/output/basic/category/bar.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/category/cat1.html b/tests/output/basic/category/cat1.html index e92fd0df..ba43f8f5 100644 --- a/tests/output/basic/category/cat1.html +++ b/tests/output/basic/category/cat1.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/category/content.html b/tests/output/basic/category/content.html index 0eec912c..9f44fa9e 100644 --- a/tests/output/basic/category/content.html +++ b/tests/output/basic/category/content.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/category/yeah.html b/tests/output/basic/category/yeah.html index ccb531f1..747cad37 100644 --- a/tests/output/basic/category/yeah.html +++ b/tests/output/basic/category/yeah.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/drafts/a-draft-article.html b/tests/output/basic/drafts/a-draft-article.html index 59b6223f..0b7f6899 100644 --- a/tests/output/basic/drafts/a-draft-article.html +++ b/tests/output/basic/drafts/a-draft-article.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/feeds/all-en.atom.xml b/tests/output/basic/feeds/all-en.atom.xml index c9fe8270..66c51fdf 100644 --- a/tests/output/basic/feeds/all-en.atom.xml +++ b/tests/output/basic/feeds/all-en.atom.xml @@ -1,9 +1,9 @@ -A Pelican Blog../.2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Zbruno.././second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00Zbruno.././a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Zbruno.././article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00Zbruno.././article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00Zbruno.././article-3.html<p>Article 3</p> -This is a super article !2010-12-02T10:14:00ZAlexis Métaireau.././this-is-a-super-article.html<p>Some content here !</p> +A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Zbrunotag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00Zbrunotag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-3.html<p>Article 3</p> +This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:../.,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Oh yeah !2010-10-20T10:14:00ZAlexis Métaireau.././oh-yeah.html<div class="section" id="why-not"> +Oh yeah !2010-10-20T10:14:00ZAlexis Métaireautag:../.,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00Zbruno.././unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00Zbrunotag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/all-fr.atom.xml b/tests/output/basic/feeds/all-fr.atom.xml index 606e5186..2de714bb 100644 --- a/tests/output/basic/feeds/all-fr.atom.xml +++ b/tests/output/basic/feeds/all-fr.atom.xml @@ -1,4 +1,4 @@ -A Pelican Blog../.2012-03-02T14:01:01ZTrop bien !2012-03-02T14:01:01Zbruno.././oh-yeah-fr.html<p>Et voila du contenu en français</p> -Deuxième article2012-02-29T00:00:00Zbruno.././second-article-fr.html<p>Ceci est un article, en français.</p> +A Pelican Blog.././2012-03-02T14:01:01ZTrop bien !2012-03-02T14:01:01Zbrunotag:../.,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> +Deuxième article2012-02-29T00:00:00Zbrunotag:../.,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/all.atom.xml b/tests/output/basic/feeds/all.atom.xml index 3bb7d2fd..c496adf7 100644 --- a/tests/output/basic/feeds/all.atom.xml +++ b/tests/output/basic/feeds/all.atom.xml @@ -1,9 +1,9 @@ -A Pelican Blog../.2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Zbruno.././second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00Zbruno.././a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Zbruno.././article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00Zbruno.././article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00Zbruno.././article-3.html<p>Article 3</p> -This is a super article !2010-12-02T10:14:00ZAlexis Métaireau.././this-is-a-super-article.html<p>Some content here !</p> +A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Zbrunotag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00Zbrunotag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-3.html<p>Article 3</p> +This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:../.,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Oh yeah !2010-10-20T10:14:00ZAlexis Métaireau.././oh-yeah.html<div class="section" id="why-not"> +Oh yeah !2010-10-20T10:14:00ZAlexis Métaireautag:../.,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00Zbruno.././unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00Zbrunotag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/bar.atom.xml b/tests/output/basic/feeds/bar.atom.xml index 6ce45518..066ae95f 100644 --- a/tests/output/basic/feeds/bar.atom.xml +++ b/tests/output/basic/feeds/bar.atom.xml @@ -1,5 +1,5 @@ -A Pelican Blog../.2010-10-20T10:14:00ZOh yeah !2010-10-20T10:14:00ZAlexis Métaireau.././oh-yeah.html<div class="section" id="why-not"> +A Pelican Blog.././2010-10-20T10:14:00ZOh yeah !2010-10-20T10:14:00ZAlexis Métaireautag:../.,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> diff --git a/tests/output/basic/feeds/cat1.atom.xml b/tests/output/basic/feeds/cat1.atom.xml index f66c2e73..3a4af6a6 100644 --- a/tests/output/basic/feeds/cat1.atom.xml +++ b/tests/output/basic/feeds/cat1.atom.xml @@ -1,5 +1,5 @@ -A Pelican Blog../.2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00Zbruno.././a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Zbruno.././article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00Zbruno.././article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00Zbruno.././article-3.html<p>Article 3</p> +A Pelican Blog.././2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00Zbrunotag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-3.html<p>Article 3</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/content.atom.xml b/tests/output/basic/feeds/content.atom.xml index 0cf53aa7..e35b840f 100644 --- a/tests/output/basic/feeds/content.atom.xml +++ b/tests/output/basic/feeds/content.atom.xml @@ -1,4 +1,4 @@ -A Pelican Blog../.2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Zbruno.././second-article.html<p>This is some article, in english</p> -Unbelievable !2010-10-15T20:30:00Zbruno.././unbelievable.html<p>Or completely awesome. Depends the needs.</p> +A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Zbrunotag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> +Unbelievable !2010-10-15T20:30:00Zbrunotag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/yeah.atom.xml b/tests/output/basic/feeds/yeah.atom.xml index 7fd8e9f2..5ae933f4 100644 --- a/tests/output/basic/feeds/yeah.atom.xml +++ b/tests/output/basic/feeds/yeah.atom.xml @@ -1,5 +1,5 @@ -A Pelican Blog../.2010-12-02T10:14:00ZThis is a super article !2010-12-02T10:14:00ZAlexis Métaireau.././this-is-a-super-article.html<p>Some content here !</p> +A Pelican Blog.././2010-12-02T10:14:00ZThis is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:../.,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> diff --git a/tests/output/basic/index.html b/tests/output/basic/index.html index 8a2091b9..9bc1a2f9 100644 --- a/tests/output/basic/index.html +++ b/tests/output/basic/index.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • @@ -249,8 +249,9 @@ Translations: - Multi-line metadata should be supported -as well as inline markup. +

      Multi-line metadata should be supported +as well as inline markup.

      + read more diff --git a/tests/output/basic/oh-yeah-fr.html b/tests/output/basic/oh-yeah-fr.html index 55eec103..b380252e 100644 --- a/tests/output/basic/oh-yeah-fr.html +++ b/tests/output/basic/oh-yeah-fr.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/oh-yeah.html b/tests/output/basic/oh-yeah.html index 4b650e7d..dfa1d178 100644 --- a/tests/output/basic/oh-yeah.html +++ b/tests/output/basic/oh-yeah.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/pages/this-is-a-test-page.html b/tests/output/basic/pages/this-is-a-test-page.html index 0162232c..cc282243 100644 --- a/tests/output/basic/pages/this-is-a-test-page.html +++ b/tests/output/basic/pages/this-is-a-test-page.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/second-article-fr.html b/tests/output/basic/second-article-fr.html index 704971d2..e6244aa8 100644 --- a/tests/output/basic/second-article-fr.html +++ b/tests/output/basic/second-article-fr.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/second-article.html b/tests/output/basic/second-article.html index 94043446..3dec8d70 100644 --- a/tests/output/basic/second-article.html +++ b/tests/output/basic/second-article.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/tag/bar.html b/tests/output/basic/tag/bar.html index 4afb4bfd..bc4ffc9c 100644 --- a/tests/output/basic/tag/bar.html +++ b/tests/output/basic/tag/bar.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • @@ -150,8 +150,9 @@ Translations: - Multi-line metadata should be supported -as well as inline markup. +

      Multi-line metadata should be supported +as well as inline markup.

      + read more diff --git a/tests/output/basic/tag/baz.html b/tests/output/basic/tag/baz.html index b8df58e3..523e6f71 100644 --- a/tests/output/basic/tag/baz.html +++ b/tests/output/basic/tag/baz.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/tag/foo.html b/tests/output/basic/tag/foo.html index 20cf293a..49cc3fd8 100644 --- a/tests/output/basic/tag/foo.html +++ b/tests/output/basic/tag/foo.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • @@ -150,8 +150,9 @@ Translations: - Multi-line metadata should be supported -as well as inline markup. +

      Multi-line metadata should be supported +as well as inline markup.

      + read more diff --git a/tests/output/basic/tag/foobar.html b/tests/output/basic/tag/foobar.html index 0a5eeb3b..1817aa88 100644 --- a/tests/output/basic/tag/foobar.html +++ b/tests/output/basic/tag/foobar.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/tag/oh.html b/tests/output/basic/tag/oh.html index 563c0f2e..3ff36f49 100644 --- a/tests/output/basic/tag/oh.html +++ b/tests/output/basic/tag/oh.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/tag/yeah.html b/tests/output/basic/tag/yeah.html index 4b18b7e3..76ca35a3 100644 --- a/tests/output/basic/tag/yeah.html +++ b/tests/output/basic/tag/yeah.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/theme/css/main.css b/tests/output/basic/theme/css/main.css index 28c98b99..92905076 100644 --- a/tests/output/basic/theme/css/main.css +++ b/tests/output/basic/theme/css/main.css @@ -111,6 +111,13 @@ cite {} q {} +div.note { + float: right; + margin: 5px; + font-size: 85%; + max-width: 300px; +} + /* Tables */ table {margin: .5em auto 1.5em auto; width: 98%;} diff --git a/tests/output/basic/this-is-a-super-article.html b/tests/output/basic/this-is-a-super-article.html index cb12da2d..b2cf0392 100644 --- a/tests/output/basic/this-is-a-super-article.html +++ b/tests/output/basic/this-is-a-super-article.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • diff --git a/tests/output/basic/unbelievable.html b/tests/output/basic/unbelievable.html index 4c6e6b07..6380a2a3 100644 --- a/tests/output/basic/unbelievable.html +++ b/tests/output/basic/unbelievable.html @@ -31,11 +31,11 @@ -
    • content
    • +
    • bar
    • cat1
    • -
    • bar
    • +
    • content
    • yeah
    • From c430ab57ba1c2276f0a150cd8c6467fdb12a01b5 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 4 Apr 2012 22:48:11 +0200 Subject: [PATCH 006/359] mock getenv to always return the same value for $USER --- tests/test_pelican.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 49328ebe..1192dfe1 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -6,6 +6,8 @@ except ImportError: import os from filecmp import dircmp +from mock import patch + from .support import temporary_folder from pelican import Pelican @@ -28,12 +30,15 @@ class TestPelican(unittest.TestCase): # ones and generate the output without raising any exception / issuing # any warning. with temporary_folder() as temp_path: - pelican = Pelican(path=INPUT_PATH, output_path=temp_path) - pelican.run() - diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "basic"))) - self.assertEqual(diff.left_only, []) - self.assertEqual(diff.right_only, []) - self.assertEqual(diff.diff_files, []) + with patch("pelican.contents.getenv") as mock_getenv: + # force getenv('USER') to always return the same value + mock_getenv.return_value = "Dummy Author" + pelican = Pelican(path=INPUT_PATH, output_path=temp_path) + pelican.run() + diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "basic"))) + self.assertEqual(diff.left_only, []) + self.assertEqual(diff.right_only, []) + self.assertEqual(diff.diff_files, []) def test_custom_generation_works(self): # the same thing with a specified set of settings should work From 912ffe4a912a4e4760015c003dc7d0a6b2cc3c44 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 4 Apr 2012 22:49:12 +0200 Subject: [PATCH 007/359] update basic output with $USER="Dummy Author" USER="Dummy Author" pelican -o tests/output/basic/ samples/content/ --- tests/output/basic/a-markdown-powered-article.html | 2 +- tests/output/basic/article-1.html | 2 +- tests/output/basic/article-2.html | 2 +- tests/output/basic/article-3.html | 2 +- .../basic/author/{bruno.html => dummy-author.html} | 14 +++++++------- tests/output/basic/category/cat1.html | 8 ++++---- tests/output/basic/category/content.html | 4 ++-- tests/output/basic/drafts/a-draft-article.html | 2 +- tests/output/basic/feeds/all-en.atom.xml | 10 +++++----- tests/output/basic/feeds/all-fr.atom.xml | 4 ++-- tests/output/basic/feeds/all.atom.xml | 10 +++++----- tests/output/basic/feeds/cat1.atom.xml | 6 +++--- tests/output/basic/feeds/content.atom.xml | 4 ++-- tests/output/basic/index.html | 12 ++++++------ tests/output/basic/oh-yeah-fr.html | 2 +- tests/output/basic/second-article-fr.html | 2 +- tests/output/basic/second-article.html | 2 +- tests/output/basic/tag/bar.html | 4 ++-- tests/output/basic/tag/baz.html | 4 ++-- tests/output/basic/tag/foo.html | 4 ++-- tests/output/basic/unbelievable.html | 2 +- 21 files changed, 51 insertions(+), 51 deletions(-) rename tests/output/basic/author/{bruno.html => dummy-author.html} (92%) diff --git a/tests/output/basic/a-markdown-powered-article.html b/tests/output/basic/a-markdown-powered-article.html index d36ba32c..9cb92c4b 100644 --- a/tests/output/basic/a-markdown-powered-article.html +++ b/tests/output/basic/a-markdown-powered-article.html @@ -54,7 +54,7 @@
      - By bruno + By Dummy Author

      In cat1.

      diff --git a/tests/output/basic/article-1.html b/tests/output/basic/article-1.html index e681b991..5f1d7c1d 100644 --- a/tests/output/basic/article-1.html +++ b/tests/output/basic/article-1.html @@ -54,7 +54,7 @@
      - By bruno + By Dummy Author

      In cat1.

      diff --git a/tests/output/basic/article-2.html b/tests/output/basic/article-2.html index b56d18ba..d6dbf74b 100644 --- a/tests/output/basic/article-2.html +++ b/tests/output/basic/article-2.html @@ -54,7 +54,7 @@
      - By bruno + By Dummy Author

      In cat1.

      diff --git a/tests/output/basic/article-3.html b/tests/output/basic/article-3.html index 0d2525e7..8dc806c1 100644 --- a/tests/output/basic/article-3.html +++ b/tests/output/basic/article-3.html @@ -54,7 +54,7 @@
      - By bruno + By Dummy Author

      In cat1.

      diff --git a/tests/output/basic/author/bruno.html b/tests/output/basic/author/dummy-author.html similarity index 92% rename from tests/output/basic/author/bruno.html rename to tests/output/basic/author/dummy-author.html index f889c94e..cf23f899 100644 --- a/tests/output/basic/author/bruno.html +++ b/tests/output/basic/author/dummy-author.html @@ -1,7 +1,7 @@ - A Pelican Blog - bruno + A Pelican Blog - Dummy Author @@ -57,7 +57,7 @@
      - By bruno + By Dummy Author

      In cat1.

      @@ -96,7 +96,7 @@
      - By bruno + By Dummy Author

      In cat1.

      @@ -131,7 +131,7 @@
      - By bruno + By Dummy Author

      In cat1.

      @@ -166,7 +166,7 @@
      - By bruno + By Dummy Author

      In cat1.

      @@ -201,7 +201,7 @@
      - By bruno + By Dummy Author

      In content.

      @@ -241,7 +241,7 @@ Translations:
      - By bruno + By Dummy Author

      In content.

      diff --git a/tests/output/basic/category/cat1.html b/tests/output/basic/category/cat1.html index ba43f8f5..1d8d67e8 100644 --- a/tests/output/basic/category/cat1.html +++ b/tests/output/basic/category/cat1.html @@ -57,7 +57,7 @@
      - By bruno + By Dummy Author

      In cat1.

      @@ -96,7 +96,7 @@
      - By bruno + By Dummy Author

      In cat1.

      @@ -131,7 +131,7 @@
      - By bruno + By Dummy Author

      In cat1.

      @@ -166,7 +166,7 @@
      - By bruno + By Dummy Author

      In cat1.

      diff --git a/tests/output/basic/category/content.html b/tests/output/basic/category/content.html index 9f44fa9e..19ceef2c 100644 --- a/tests/output/basic/category/content.html +++ b/tests/output/basic/category/content.html @@ -57,7 +57,7 @@
      - By bruno + By Dummy Author

      In content.

      @@ -102,7 +102,7 @@ Translations:
      - By bruno + By Dummy Author

      In content.

      diff --git a/tests/output/basic/drafts/a-draft-article.html b/tests/output/basic/drafts/a-draft-article.html index 0b7f6899..32a11e69 100644 --- a/tests/output/basic/drafts/a-draft-article.html +++ b/tests/output/basic/drafts/a-draft-article.html @@ -54,7 +54,7 @@
      - By bruno + By Dummy Author

      In content.

      diff --git a/tests/output/basic/feeds/all-en.atom.xml b/tests/output/basic/feeds/all-en.atom.xml index 66c51fdf..e10386d5 100644 --- a/tests/output/basic/feeds/all-en.atom.xml +++ b/tests/output/basic/feeds/all-en.atom.xml @@ -1,8 +1,8 @@ -A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Zbrunotag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00Zbrunotag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-3.html<p>Article 3</p> +A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00ZDummy Authortag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-3.html<p>Article 3</p> This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:../.,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> @@ -21,5 +21,5 @@ YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00Zbrunotag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00ZDummy Authortag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/all-fr.atom.xml b/tests/output/basic/feeds/all-fr.atom.xml index 2de714bb..3243f840 100644 --- a/tests/output/basic/feeds/all-fr.atom.xml +++ b/tests/output/basic/feeds/all-fr.atom.xml @@ -1,4 +1,4 @@ -A Pelican Blog.././2012-03-02T14:01:01ZTrop bien !2012-03-02T14:01:01Zbrunotag:../.,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> -Deuxième article2012-02-29T00:00:00Zbrunotag:../.,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> +A Pelican Blog.././2012-03-02T14:01:01ZTrop bien !2012-03-02T14:01:01ZDummy Authortag:../.,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> +Deuxième article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/all.atom.xml b/tests/output/basic/feeds/all.atom.xml index c496adf7..7cdadf5d 100644 --- a/tests/output/basic/feeds/all.atom.xml +++ b/tests/output/basic/feeds/all.atom.xml @@ -1,8 +1,8 @@ -A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Zbrunotag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00Zbrunotag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-3.html<p>Article 3</p> +A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00ZDummy Authortag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-3.html<p>Article 3</p> This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:../.,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> @@ -21,5 +21,5 @@ YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00Zbrunotag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00ZDummy Authortag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/cat1.atom.xml b/tests/output/basic/feeds/cat1.atom.xml index 3a4af6a6..05b21f75 100644 --- a/tests/output/basic/feeds/cat1.atom.xml +++ b/tests/output/basic/feeds/cat1.atom.xml @@ -1,5 +1,5 @@ -A Pelican Blog.././2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00Zbrunotag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00Zbrunotag:../.,2011-02-17:article-3.html<p>Article 3</p> +A Pelican Blog.././2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00ZDummy Authortag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-3.html<p>Article 3</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/content.atom.xml b/tests/output/basic/feeds/content.atom.xml index e35b840f..d255cc8a 100644 --- a/tests/output/basic/feeds/content.atom.xml +++ b/tests/output/basic/feeds/content.atom.xml @@ -1,4 +1,4 @@ -A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Zbrunotag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> -Unbelievable !2010-10-15T20:30:00Zbrunotag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> +Unbelievable !2010-10-15T20:30:00ZDummy Authortag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/index.html b/tests/output/basic/index.html index 9bc1a2f9..1f247443 100644 --- a/tests/output/basic/index.html +++ b/tests/output/basic/index.html @@ -57,7 +57,7 @@
      - By bruno + By Dummy Author

      In content.

      @@ -102,7 +102,7 @@ Translations:
      - By bruno + By Dummy Author

      In cat1.

      @@ -136,7 +136,7 @@ Translations:
      - By bruno + By Dummy Author

      In cat1.

      @@ -171,7 +171,7 @@ Translations:
      - By bruno + By Dummy Author

      In cat1.

      @@ -206,7 +206,7 @@ Translations:
      - By bruno + By Dummy Author

      In cat1.

      @@ -322,7 +322,7 @@ YEAH !

      - By bruno + By Dummy Author

      In content.

      diff --git a/tests/output/basic/oh-yeah-fr.html b/tests/output/basic/oh-yeah-fr.html index b380252e..186791b5 100644 --- a/tests/output/basic/oh-yeah-fr.html +++ b/tests/output/basic/oh-yeah-fr.html @@ -54,7 +54,7 @@
      - By bruno + By Dummy Author

      In content.

      diff --git a/tests/output/basic/second-article-fr.html b/tests/output/basic/second-article-fr.html index e6244aa8..9f9838dc 100644 --- a/tests/output/basic/second-article-fr.html +++ b/tests/output/basic/second-article-fr.html @@ -54,7 +54,7 @@
      - By bruno + By Dummy Author

      In content.

      diff --git a/tests/output/basic/second-article.html b/tests/output/basic/second-article.html index 3dec8d70..13f56e4c 100644 --- a/tests/output/basic/second-article.html +++ b/tests/output/basic/second-article.html @@ -54,7 +54,7 @@
      - By bruno + By Dummy Author

      In content.

      diff --git a/tests/output/basic/tag/bar.html b/tests/output/basic/tag/bar.html index bc4ffc9c..8ffd84d8 100644 --- a/tests/output/basic/tag/bar.html +++ b/tests/output/basic/tag/bar.html @@ -57,7 +57,7 @@
      - By bruno + By Dummy Author

      In content.

      @@ -102,7 +102,7 @@ Translations:
      - By bruno + By Dummy Author

      In content.

      diff --git a/tests/output/basic/tag/baz.html b/tests/output/basic/tag/baz.html index 523e6f71..ea01a199 100644 --- a/tests/output/basic/tag/baz.html +++ b/tests/output/basic/tag/baz.html @@ -57,7 +57,7 @@
      - By bruno + By Dummy Author

      In content.

      @@ -102,7 +102,7 @@ Translations:
      - By bruno + By Dummy Author

      In content.

      diff --git a/tests/output/basic/tag/foo.html b/tests/output/basic/tag/foo.html index 49cc3fd8..ea674062 100644 --- a/tests/output/basic/tag/foo.html +++ b/tests/output/basic/tag/foo.html @@ -57,7 +57,7 @@
      - By bruno + By Dummy Author

      In content.

      @@ -102,7 +102,7 @@ Translations:
      - By bruno + By Dummy Author

      In content.

      diff --git a/tests/output/basic/unbelievable.html b/tests/output/basic/unbelievable.html index 6380a2a3..581e8318 100644 --- a/tests/output/basic/unbelievable.html +++ b/tests/output/basic/unbelievable.html @@ -54,7 +54,7 @@
      - By bruno + By Dummy Author

      In content.

      From 03fdefb158cd495c960c6637bf7f7deb99a9f1de Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 4 Apr 2012 23:18:11 +0200 Subject: [PATCH 008/359] add instructions to regenerate the output of functional tests --- docs/contribute.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/contribute.rst b/docs/contribute.rst index fcf8d5c0..e33f8ab4 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -39,6 +39,14 @@ The tests live in "pelican/tests" and you can run them using the $ unit2 discover +If you have made changes that affect the output of a pelican generated weblog, +then you should update the output used by functional tests. +To do so, you can use the 2 following commands:: + + $ pelican -o tests/output/custom/ -s samples/pelican.conf.py \ + samples/content/ + $ pelican -o tests/output/basic/ samples/content/ + Coding standards ================ From cfebb37c6464d42432da0694eb6665004b7efedb Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Apr 2012 06:47:15 +0200 Subject: [PATCH 009/359] fix command to regenerate the output of basic functional test the command needs to be prefixed by USER="Dummy Author" which is the author name value mocked in the corresponding functional test. --- docs/contribute.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contribute.rst b/docs/contribute.rst index e33f8ab4..3960b3f9 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -45,7 +45,7 @@ To do so, you can use the 2 following commands:: $ pelican -o tests/output/custom/ -s samples/pelican.conf.py \ samples/content/ - $ pelican -o tests/output/basic/ samples/content/ + $ USER="Dummy Author" pelican -o tests/output/basic/ samples/content/ Coding standards ================ From 1efda9eb74701ca2e56f082327f1970da154ce33 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Mon, 23 Apr 2012 23:29:00 +0200 Subject: [PATCH 010/359] test that categories are ordered as expected --- tests/test_generators.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_generators.py b/tests/test_generators.py index bc5c8b73..dd27d97f 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -46,3 +46,7 @@ class TestArticlesGenerator(unittest.TestCase): elif relfilepath == "article_without_category.rst": self.assertEquals(article.category.name, 'Default') + categories = [cat.name for cat, _ in generator.categories] + # assert that the categories are ordered as expected + self.assertEquals( + categories, ['Default', 'TestCategory', 'Yeah', 'yeah']) From b7e6d3d98d0a131e1cd93eb95a586fd1ec3d7da5 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 12 May 2012 01:07:17 +0200 Subject: [PATCH 011/359] update functional tests output --- .../basic/a-markdown-powered-article.html | 27 +++++---- tests/output/basic/archives.html | 16 +++--- tests/output/basic/article-1.html | 27 +++++---- tests/output/basic/article-2.html | 27 +++++---- tests/output/basic/article-3.html | 27 +++++---- tests/output/basic/categories.html | 8 +-- .../output/basic/drafts/a-draft-article.html | 27 +++++---- tests/output/basic/feeds/all-en.atom.xml | 14 ++--- tests/output/basic/feeds/all-fr.atom.xml | 4 +- tests/output/basic/feeds/all.atom.xml | 14 ++--- tests/output/basic/feeds/bar.atom.xml | 2 +- tests/output/basic/feeds/cat1.atom.xml | 6 +- tests/output/basic/feeds/content.atom.xml | 4 +- tests/output/basic/feeds/yeah.atom.xml | 2 +- tests/output/basic/oh-yeah-fr.html | 27 +++++---- tests/output/basic/oh-yeah.html | 27 +++++---- tests/output/basic/second-article-fr.html | 27 +++++---- tests/output/basic/second-article.html | 27 +++++---- tests/output/basic/theme/css/wide.css | 15 +++-- .../basic/theme/images/icons/facebook.png | Bin 0 -> 300 bytes .../output/basic/this-is-a-super-article.html | 27 +++++---- tests/output/basic/unbelievable.html | 27 +++++---- .../custom/a-markdown-powered-article.html | 53 ++++++++++-------- tests/output/custom/archives.html | 16 +++--- tests/output/custom/article-1.html | 53 ++++++++++-------- tests/output/custom/article-2.html | 53 ++++++++++-------- tests/output/custom/article-3.html | 53 ++++++++++-------- tests/output/custom/categories.html | 8 +-- .../output/custom/drafts/a-draft-article.html | 53 ++++++++++-------- tests/output/custom/feeds/all-en.atom.xml | 14 ++--- tests/output/custom/feeds/all-fr.atom.xml | 4 +- tests/output/custom/feeds/all.atom.xml | 14 ++--- tests/output/custom/feeds/all.rss.xml | 14 ++--- tests/output/custom/feeds/bar.atom.xml | 2 +- tests/output/custom/feeds/bar.rss.xml | 2 +- tests/output/custom/feeds/cat1.atom.xml | 6 +- tests/output/custom/feeds/cat1.rss.xml | 6 +- tests/output/custom/feeds/content.atom.xml | 4 +- tests/output/custom/feeds/content.rss.xml | 4 +- tests/output/custom/feeds/yeah.atom.xml | 2 +- tests/output/custom/feeds/yeah.rss.xml | 2 +- tests/output/custom/oh-yeah-fr.html | 53 ++++++++++-------- tests/output/custom/oh-yeah.html | 53 ++++++++++-------- tests/output/custom/second-article-fr.html | 53 ++++++++++-------- tests/output/custom/second-article.html | 53 ++++++++++-------- tests/output/custom/theme/css/wide.css | 15 +++-- .../custom/theme/images/icons/facebook.png | Bin 0 -> 300 bytes .../custom/this-is-a-super-article.html | 53 ++++++++++-------- tests/output/custom/unbelievable.html | 53 ++++++++++-------- 49 files changed, 599 insertions(+), 479 deletions(-) create mode 100644 tests/output/basic/theme/images/icons/facebook.png create mode 100644 tests/output/custom/theme/images/icons/facebook.png diff --git a/tests/output/basic/a-markdown-powered-article.html b/tests/output/basic/a-markdown-powered-article.html index 9cb92c4b..ceadf79a 100644 --- a/tests/output/basic/a-markdown-powered-article.html +++ b/tests/output/basic/a-markdown-powered-article.html @@ -41,13 +41,18 @@
    - -
    - +
    diff --git a/tests/output/basic/archives.html b/tests/output/basic/archives.html index 9aedb29d..52d00234 100644 --- a/tests/output/basic/archives.html +++ b/tests/output/basic/archives.html @@ -48,28 +48,28 @@
    Fri 15 October 2010
    -
    Unbelievable !
    +
    Unbelievable !
    Wed 20 October 2010
    -
    Oh yeah !
    +
    Oh yeah !
    Thu 02 December 2010
    -
    This is a super article !
    +
    This is a super article !
    Thu 17 February 2011
    -
    Article 1
    +
    Article 1
    Thu 17 February 2011
    -
    Article 2
    +
    Article 2
    Thu 17 February 2011
    -
    Article 3
    +
    Article 3
    Wed 20 April 2011
    -
    A markdown powered article
    +
    A markdown powered article
    Wed 29 February 2012
    -
    Second article
    +
    Second article
    diff --git a/tests/output/basic/article-1.html b/tests/output/basic/article-1.html index 5f1d7c1d..bd6f9716 100644 --- a/tests/output/basic/article-1.html +++ b/tests/output/basic/article-1.html @@ -41,13 +41,18 @@ - -
    -
    -

    Article 1

    -
    -
    + +
    +
    +
    +

    + Article 1

    + +
    + +
    +
    Thu 17 February 2011 @@ -62,12 +67,12 @@
    -

    Article 1

    +

    Article 1

    -
    - +
    + -
    +
    diff --git a/tests/output/basic/article-2.html b/tests/output/basic/article-2.html index d6dbf74b..7811204a 100644 --- a/tests/output/basic/article-2.html +++ b/tests/output/basic/article-2.html @@ -41,13 +41,18 @@ - -
    -
    -

    Article 2

    -
    -
    + +
    +
    +
    +

    + Article 2

    + +
    + +
    +
    Thu 17 February 2011 @@ -62,12 +67,12 @@
    -

    Article 2

    +

    Article 2

    -
    - +
    + -
    +
    diff --git a/tests/output/basic/article-3.html b/tests/output/basic/article-3.html index 8dc806c1..96acb190 100644 --- a/tests/output/basic/article-3.html +++ b/tests/output/basic/article-3.html @@ -41,13 +41,18 @@ - -
    -
    -

    Article 3

    -
    -
    + +
    +
    +
    +

    + Article 3

    + +
    + +
    +
    Thu 17 February 2011 @@ -62,12 +67,12 @@
    -

    Article 3

    +

    Article 3

    -
    - +
    + -
    +
    diff --git a/tests/output/basic/categories.html b/tests/output/basic/categories.html index 2430cc96..db25ed68 100644 --- a/tests/output/basic/categories.html +++ b/tests/output/basic/categories.html @@ -44,13 +44,13 @@ diff --git a/tests/output/basic/drafts/a-draft-article.html b/tests/output/basic/drafts/a-draft-article.html index 32a11e69..99b90c33 100644 --- a/tests/output/basic/drafts/a-draft-article.html +++ b/tests/output/basic/drafts/a-draft-article.html @@ -41,13 +41,18 @@ - -
    -
    -

    A draft article

    -
    -
    + +
    +
    +
    +

    + A draft article

    + +
    + +
    +
    Fri 02 March 2012 @@ -62,13 +67,13 @@
    -

    This is a draft article, it should live under the /drafts/ folder and not be +

    This is a draft article, it should live under the /drafts/ folder and not be listed anywhere else.

    -
    - +
    + -
    +
    diff --git a/tests/output/basic/feeds/all-en.atom.xml b/tests/output/basic/feeds/all-en.atom.xml index e10386d5..b532e454 100644 --- a/tests/output/basic/feeds/all-en.atom.xml +++ b/tests/output/basic/feeds/all-en.atom.xml @@ -1,9 +1,9 @@ -A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00ZDummy Authortag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-3.html<p>Article 3</p> -This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:../.,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> +A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00ZDummy Authortag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-3.html<p>Article 3</p> +This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:../.,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Oh yeah !2010-10-20T10:14:00ZAlexis Métaireautag:../.,2010-10-20:oh-yeah.html<div class="section" id="why-not"> +Oh yeah !2010-10-20T10:14:00ZAlexis Métaireautag:../.,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00ZDummy Authortag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00ZDummy Authortag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/all-fr.atom.xml b/tests/output/basic/feeds/all-fr.atom.xml index 3243f840..ce245dee 100644 --- a/tests/output/basic/feeds/all-fr.atom.xml +++ b/tests/output/basic/feeds/all-fr.atom.xml @@ -1,4 +1,4 @@ -A Pelican Blog.././2012-03-02T14:01:01ZTrop bien !2012-03-02T14:01:01ZDummy Authortag:../.,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> -Deuxième article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> +A Pelican Blog.././2012-03-02T14:01:01ZTrop bien !2012-03-02T14:01:01ZDummy Authortag:../.,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> +Deuxième article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/all.atom.xml b/tests/output/basic/feeds/all.atom.xml index 7cdadf5d..a0fb9144 100644 --- a/tests/output/basic/feeds/all.atom.xml +++ b/tests/output/basic/feeds/all.atom.xml @@ -1,9 +1,9 @@ -A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00ZDummy Authortag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-3.html<p>Article 3</p> -This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:../.,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> +A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00ZDummy Authortag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-3.html<p>Article 3</p> +This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:../.,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Oh yeah !2010-10-20T10:14:00ZAlexis Métaireautag:../.,2010-10-20:oh-yeah.html<div class="section" id="why-not"> +Oh yeah !2010-10-20T10:14:00ZAlexis Métaireautag:../.,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00ZDummy Authortag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00ZDummy Authortag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/bar.atom.xml b/tests/output/basic/feeds/bar.atom.xml index 066ae95f..15708734 100644 --- a/tests/output/basic/feeds/bar.atom.xml +++ b/tests/output/basic/feeds/bar.atom.xml @@ -1,5 +1,5 @@ -A Pelican Blog.././2010-10-20T10:14:00ZOh yeah !2010-10-20T10:14:00ZAlexis Métaireautag:../.,2010-10-20:oh-yeah.html<div class="section" id="why-not"> +A Pelican Blog.././2010-10-20T10:14:00ZOh yeah !2010-10-20T10:14:00ZAlexis Métaireautag:../.,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> diff --git a/tests/output/basic/feeds/cat1.atom.xml b/tests/output/basic/feeds/cat1.atom.xml index 05b21f75..383c8ab7 100644 --- a/tests/output/basic/feeds/cat1.atom.xml +++ b/tests/output/basic/feeds/cat1.atom.xml @@ -1,5 +1,5 @@ -A Pelican Blog.././2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00ZDummy Authortag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-3.html<p>Article 3</p> +A Pelican Blog.././2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00ZDummy Authortag:../.,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00ZDummy Authortag:../.,2011-02-17:article-3.html<p>Article 3</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/content.atom.xml b/tests/output/basic/feeds/content.atom.xml index d255cc8a..1fa740b4 100644 --- a/tests/output/basic/feeds/content.atom.xml +++ b/tests/output/basic/feeds/content.atom.xml @@ -1,4 +1,4 @@ -A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> -Unbelievable !2010-10-15T20:30:00ZDummy Authortag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> +Unbelievable !2010-10-15T20:30:00ZDummy Authortag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/yeah.atom.xml b/tests/output/basic/feeds/yeah.atom.xml index 5ae933f4..e9bb26d0 100644 --- a/tests/output/basic/feeds/yeah.atom.xml +++ b/tests/output/basic/feeds/yeah.atom.xml @@ -1,5 +1,5 @@ -A Pelican Blog.././2010-12-02T10:14:00ZThis is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:../.,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> +A Pelican Blog.././2010-12-02T10:14:00ZThis is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:../.,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> diff --git a/tests/output/basic/oh-yeah-fr.html b/tests/output/basic/oh-yeah-fr.html index 186791b5..666a961f 100644 --- a/tests/output/basic/oh-yeah-fr.html +++ b/tests/output/basic/oh-yeah-fr.html @@ -41,13 +41,18 @@ - -
    -
    -

    Trop bien !

    -
    -
    + +
    +
    +
    +

    + Trop bien !

    + +
    + +
    +
    Fri 02 March 2012 @@ -67,12 +72,12 @@ Translations:
    -

    Et voila du contenu en français

    +

    Et voila du contenu en français

    -
    - +
    + -
    +
    diff --git a/tests/output/basic/oh-yeah.html b/tests/output/basic/oh-yeah.html index dfa1d178..c8f1af74 100644 --- a/tests/output/basic/oh-yeah.html +++ b/tests/output/basic/oh-yeah.html @@ -41,13 +41,18 @@ - -
    -
    -

    Oh yeah !

    -
    -
    + +
    +
    +
    +

    + Oh yeah !

    + +
    + +
    +
    Wed 20 October 2010 @@ -67,17 +72,17 @@ Translations:
    -
    +

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    alternate text
    -
    - +
    + -
    +
    diff --git a/tests/output/basic/second-article-fr.html b/tests/output/basic/second-article-fr.html index 9f9838dc..11960efc 100644 --- a/tests/output/basic/second-article-fr.html +++ b/tests/output/basic/second-article-fr.html @@ -41,13 +41,18 @@ - -
    -
    -

    Deuxième article

    -
    -
    + +
    +
    +
    +

    + Deuxième article

    + +
    + +
    +
    Wed 29 February 2012 @@ -67,12 +72,12 @@ Translations:
    -

    Ceci est un article, en français.

    +

    Ceci est un article, en français.

    -
    - +
    + -
    +
    diff --git a/tests/output/basic/second-article.html b/tests/output/basic/second-article.html index 13f56e4c..171717ba 100644 --- a/tests/output/basic/second-article.html +++ b/tests/output/basic/second-article.html @@ -41,13 +41,18 @@ - -
    -
    -

    Second article

    -
    -
    + +
    +
    +
    +

    + Second article

    + +
    + +
    +
    Wed 29 February 2012 @@ -67,12 +72,12 @@ Translations:
    -

    This is some article, in english

    +

    This is some article, in english

    -
    - +
    + -
    +
    diff --git a/tests/output/basic/theme/css/wide.css b/tests/output/basic/theme/css/wide.css index 3376f4c7..88fd59ce 100644 --- a/tests/output/basic/theme/css/wide.css +++ b/tests/output/basic/theme/css/wide.css @@ -4,13 +4,17 @@ body { font:1.3em/1.3 "Hoefler Text","Georgia",Georgia,serif,sans-serif; } -.body, #banner nav, #banner nav ul, #about, #featured, #content{ - width: inherit; +.post-info{ + display: none; } #banner nav { + display: none; -moz-border-radius: 0px; - margin-bottom: 0px; + margin-bottom: 20px; + overflow: hidden; + font-size: 1em; + background: #F5F4EF; } #banner nav ul{ @@ -19,10 +23,11 @@ body { #banner nav li{ float: right; + color: #000; } -#banner nav li:first-child a { - -moz-border-radius: 0px; +#banner nav li a { + color: #000; } #banner h1 { diff --git a/tests/output/basic/theme/images/icons/facebook.png b/tests/output/basic/theme/images/icons/facebook.png new file mode 100644 index 0000000000000000000000000000000000000000..a7914b497369c55feba7defc9a3ea5bec424ecfc GIT binary patch literal 300 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa2=EDU{r~^Jb>s{nN~l=<`rQ{G z*EMNgZp)TeGt$L@YM4rb{DK+IJaKeh4CFB;dAqwXbg;^L06Clm9+AaB8pQTsa66f8 z2V~fKx;Tb#Tu)ADV02S85J*U9G7veylX_i&!&z12Q~+;~Q|gK~r==k=&T|S@G#cDE zb^5gT;nTtbJUf;eFfcqx6@I vWMyh@WooHyU}$AvU~RtQ2a1N={FKbJO57T}vIJa!8W=oX{an^LB{Ts5Vp3XV literal 0 HcmV?d00001 diff --git a/tests/output/basic/this-is-a-super-article.html b/tests/output/basic/this-is-a-super-article.html index b2cf0392..1e8c160f 100644 --- a/tests/output/basic/this-is-a-super-article.html +++ b/tests/output/basic/this-is-a-super-article.html @@ -41,13 +41,18 @@ - -
    -
    -

    This is a super article !

    -
    -
    + +
    +
    +
    +

    + This is a super article !

    + +
    + +
    +
    Thu 02 December 2010 @@ -62,7 +67,7 @@
    -

    Some content here !

    +

    Some content here !

    This is a simple title

    And here comes the cool stuff.

    @@ -75,10 +80,10 @@

    → And now try with some utf8 hell: ééé

    -
    - +
    + -
    +
    diff --git a/tests/output/basic/unbelievable.html b/tests/output/basic/unbelievable.html index 581e8318..db018d81 100644 --- a/tests/output/basic/unbelievable.html +++ b/tests/output/basic/unbelievable.html @@ -41,13 +41,18 @@ - -
    -
    -

    Unbelievable !

    -
    -
    + +
    +
    +
    +

    + Unbelievable !

    + +
    + +
    +
    Fri 15 October 2010 @@ -62,12 +67,12 @@
    -

    Or completely awesome. Depends the needs.

    +

    Or completely awesome. Depends the needs.

    -
    - +
    + -
    +
    diff --git a/tests/output/custom/a-markdown-powered-article.html b/tests/output/custom/a-markdown-powered-article.html index 74e53913..28486691 100644 --- a/tests/output/custom/a-markdown-powered-article.html +++ b/tests/output/custom/a-markdown-powered-article.html @@ -49,13 +49,18 @@ - -
    -
    -

    A markdown powered article

    -
    -
    + +
    +
    +
    +

    + A markdown powered article

    + +
    + +
    +
    Wed 20 April 2011 @@ -70,24 +75,24 @@
    -

    You're mutually oblivious.

    -
    - -
    -

    Comments !

    -
    - -
    - +

    You're mutually oblivious.

    +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    diff --git a/tests/output/custom/archives.html b/tests/output/custom/archives.html index 706c7464..083e6ada 100644 --- a/tests/output/custom/archives.html +++ b/tests/output/custom/archives.html @@ -56,28 +56,28 @@
    Fri 15 October 2010
    -
    Unbelievable !
    +
    Unbelievable !
    Wed 20 October 2010
    -
    Oh yeah !
    +
    Oh yeah !
    Thu 02 December 2010
    -
    This is a super article !
    +
    This is a super article !
    Thu 17 February 2011
    -
    Article 1
    +
    Article 1
    Thu 17 February 2011
    -
    Article 2
    +
    Article 2
    Thu 17 February 2011
    -
    Article 3
    +
    Article 3
    Wed 20 April 2011
    -
    A markdown powered article
    +
    A markdown powered article
    Wed 29 February 2012
    -
    Second article
    +
    Second article
    diff --git a/tests/output/custom/article-1.html b/tests/output/custom/article-1.html index 8c73b4ac..b7c0f46f 100644 --- a/tests/output/custom/article-1.html +++ b/tests/output/custom/article-1.html @@ -49,13 +49,18 @@ - -
    -
    -

    Article 1

    -
    -
    + +
    +
    +
    +

    + Article 1

    + +
    + +
    +
    Thu 17 February 2011 @@ -70,25 +75,25 @@
    -

    Article 1

    +

    Article 1

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    diff --git a/tests/output/custom/article-2.html b/tests/output/custom/article-2.html index e8758391..e60d8077 100644 --- a/tests/output/custom/article-2.html +++ b/tests/output/custom/article-2.html @@ -49,13 +49,18 @@ - -
    -
    -

    Article 2

    -
    -
    + +
    +
    +
    +

    + Article 2

    + +
    + +
    +
    Thu 17 February 2011 @@ -70,25 +75,25 @@
    -

    Article 2

    +

    Article 2

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    diff --git a/tests/output/custom/article-3.html b/tests/output/custom/article-3.html index ace9dfbf..b79c25f0 100644 --- a/tests/output/custom/article-3.html +++ b/tests/output/custom/article-3.html @@ -49,13 +49,18 @@ - -
    -
    -

    Article 3

    -
    -
    + +
    +
    +
    +

    + Article 3

    + +
    + +
    +
    Thu 17 February 2011 @@ -70,25 +75,25 @@
    -

    Article 3

    +

    Article 3

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    diff --git a/tests/output/custom/categories.html b/tests/output/custom/categories.html index 92830754..95e8c1f3 100644 --- a/tests/output/custom/categories.html +++ b/tests/output/custom/categories.html @@ -52,13 +52,13 @@ diff --git a/tests/output/custom/drafts/a-draft-article.html b/tests/output/custom/drafts/a-draft-article.html index e12e5bd7..659a61b9 100644 --- a/tests/output/custom/drafts/a-draft-article.html +++ b/tests/output/custom/drafts/a-draft-article.html @@ -49,13 +49,18 @@ - -
    -
    -

    A draft article

    -
    -
    + +
    +
    +
    +

    + A draft article

    + +
    + +
    +
    Fri 02 March 2012 @@ -70,26 +75,26 @@
    -

    This is a draft article, it should live under the /drafts/ folder and not be +

    This is a draft article, it should live under the /drafts/ folder and not be listed anywhere else.

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    diff --git a/tests/output/custom/feeds/all-en.atom.xml b/tests/output/custom/feeds/all-en.atom.xml index 1b18c1bd..db5fc2de 100644 --- a/tests/output/custom/feeds/all-en.atom.xml +++ b/tests/output/custom/feeds/all-en.atom.xml @@ -1,9 +1,9 @@ -Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> -This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> +This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> +Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/all-fr.atom.xml b/tests/output/custom/feeds/all-fr.atom.xml index 1d42bb6e..5d58742c 100644 --- a/tests/output/custom/feeds/all-fr.atom.xml +++ b/tests/output/custom/feeds/all-fr.atom.xml @@ -1,4 +1,4 @@ -Alexis' loghttp://blog.notmyidea.org/2012-03-02T14:01:01+01:00Trop bien !2012-03-02T14:01:01+01:00Alexis Métaireautag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> -Deuxième article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> +Alexis' loghttp://blog.notmyidea.org/2012-03-02T14:01:01+01:00Trop bien !2012-03-02T14:01:01+01:00Alexis Métaireautag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> +Deuxième article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/all.atom.xml b/tests/output/custom/feeds/all.atom.xml index 9090f431..8df5bbdb 100644 --- a/tests/output/custom/feeds/all.atom.xml +++ b/tests/output/custom/feeds/all.atom.xml @@ -1,9 +1,9 @@ -Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> -This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> +This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> +Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/all.rss.xml b/tests/output/custom/feeds/all.rss.xml index b726e2d1..a8be2152 100644 --- a/tests/output/custom/feeds/all.rss.xml +++ b/tests/output/custom/feeds/all.rss.xml @@ -1,9 +1,9 @@ -Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.orgsecond-article.html<p>This is some article, in english</p> -Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazA markdown powered articlehttp://blog.notmyidea.orga-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.orgarticle-1.html<p>Article 1</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-1.htmlArticle 2http://blog.notmyidea.orgarticle-2.html<p>Article 2</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-2.htmlArticle 3http://blog.notmyidea.orgarticle-3.html<p>Article 3</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-3.htmlThis is a super article !http://blog.notmyidea.orgthis-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> +Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazA markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.org/article-1.html<p>Article 1</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-1.htmlArticle 2http://blog.notmyidea.org/article-2.html<p>Article 2</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-2.htmlArticle 3http://blog.notmyidea.org/article-3.html<p>Article 3</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-3.htmlThis is a super article !http://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Alexis MétaireauThu, 02 Dec 2010 10:14:00 +0100tag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.htmlfoobarfoobarOh yeah !http://blog.notmyidea.orgoh-yeah.html<div class="section" id="why-not"> +Alexis MétaireauThu, 02 Dec 2010 10:14:00 +0100tag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.htmlfoobarfoobarOh yeah !http://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200tag:blog.notmyidea.org,2010-10-20:oh-yeah.htmlohbaryeahUnbelievable !http://blog.notmyidea.orgunbelievable.html<p>Or completely awesome. Depends the needs.</p> +Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200tag:blog.notmyidea.org,2010-10-20:oh-yeah.htmlohbaryeahUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.html \ No newline at end of file diff --git a/tests/output/custom/feeds/bar.atom.xml b/tests/output/custom/feeds/bar.atom.xml index 93961545..9b29f6c9 100644 --- a/tests/output/custom/feeds/bar.atom.xml +++ b/tests/output/custom/feeds/bar.atom.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org/2010-10-20T10:14:00+02:00Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> +Alexis' loghttp://blog.notmyidea.org/2010-10-20T10:14:00+02:00Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> diff --git a/tests/output/custom/feeds/bar.rss.xml b/tests/output/custom/feeds/bar.rss.xml index 0a9d0f9d..c958edbf 100644 --- a/tests/output/custom/feeds/bar.rss.xml +++ b/tests/output/custom/feeds/bar.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org/Wed, 20 Oct 2010 10:14:00 +0200Oh yeah !http://blog.notmyidea.orgoh-yeah.html<div class="section" id="why-not"> +Alexis' loghttp://blog.notmyidea.org/Wed, 20 Oct 2010 10:14:00 +0200Oh yeah !http://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> diff --git a/tests/output/custom/feeds/cat1.atom.xml b/tests/output/custom/feeds/cat1.atom.xml index 4fce560d..72703065 100644 --- a/tests/output/custom/feeds/cat1.atom.xml +++ b/tests/output/custom/feeds/cat1.atom.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org/2011-04-20T00:00:00+02:00A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> +Alexis' loghttp://blog.notmyidea.org/2011-04-20T00:00:00+02:00A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/cat1.rss.xml b/tests/output/custom/feeds/cat1.rss.xml index d322572b..f5871487 100644 --- a/tests/output/custom/feeds/cat1.rss.xml +++ b/tests/output/custom/feeds/cat1.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org/Wed, 20 Apr 2011 00:00:00 +0200A markdown powered articlehttp://blog.notmyidea.orga-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.orgarticle-1.html<p>Article 1</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-1.htmlArticle 2http://blog.notmyidea.orgarticle-2.html<p>Article 2</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-2.htmlArticle 3http://blog.notmyidea.orgarticle-3.html<p>Article 3</p> +Alexis' loghttp://blog.notmyidea.org/Wed, 20 Apr 2011 00:00:00 +0200A markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.org/article-1.html<p>Article 1</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-1.htmlArticle 2http://blog.notmyidea.org/article-2.html<p>Article 2</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-2.htmlArticle 3http://blog.notmyidea.org/article-3.html<p>Article 3</p> Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-3.html \ No newline at end of file diff --git a/tests/output/custom/feeds/content.atom.xml b/tests/output/custom/feeds/content.atom.xml index 6f93c8f4..52bbf194 100644 --- a/tests/output/custom/feeds/content.atom.xml +++ b/tests/output/custom/feeds/content.atom.xml @@ -1,4 +1,4 @@ -Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> -Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/content.rss.xml b/tests/output/custom/feeds/content.rss.xml index 74a322e7..dcacd17f 100644 --- a/tests/output/custom/feeds/content.rss.xml +++ b/tests/output/custom/feeds/content.rss.xml @@ -1,4 +1,4 @@ -Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.orgsecond-article.html<p>This is some article, in english</p> -Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.orgunbelievable.html<p>Or completely awesome. Depends the needs.</p> +Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> +Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.html \ No newline at end of file diff --git a/tests/output/custom/feeds/yeah.atom.xml b/tests/output/custom/feeds/yeah.atom.xml index 9a95fa03..802f6329 100644 --- a/tests/output/custom/feeds/yeah.atom.xml +++ b/tests/output/custom/feeds/yeah.atom.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org/2010-12-02T10:14:00+01:00This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/2010-12-02T10:14:00+01:00This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> diff --git a/tests/output/custom/feeds/yeah.rss.xml b/tests/output/custom/feeds/yeah.rss.xml index 1c5884a2..68e96cf9 100644 --- a/tests/output/custom/feeds/yeah.rss.xml +++ b/tests/output/custom/feeds/yeah.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org/Thu, 02 Dec 2010 10:14:00 +0100This is a super article !http://blog.notmyidea.orgthis-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/Thu, 02 Dec 2010 10:14:00 +0100This is a super article !http://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> diff --git a/tests/output/custom/oh-yeah-fr.html b/tests/output/custom/oh-yeah-fr.html index b699b41c..be931a60 100644 --- a/tests/output/custom/oh-yeah-fr.html +++ b/tests/output/custom/oh-yeah-fr.html @@ -49,13 +49,18 @@ - -
    -
    -

    Trop bien !

    -
    -
    + +
    +
    +
    +

    + Trop bien !

    + +
    + +
    +
    Fri 02 March 2012 @@ -75,25 +80,25 @@ Translations:
    -

    Et voila du contenu en français

    +

    Et voila du contenu en français

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    diff --git a/tests/output/custom/oh-yeah.html b/tests/output/custom/oh-yeah.html index b8263c1b..4f3f1020 100644 --- a/tests/output/custom/oh-yeah.html +++ b/tests/output/custom/oh-yeah.html @@ -49,13 +49,18 @@ - -
    -
    -

    Oh yeah !

    -
    -
    + +
    +
    +
    +

    + Oh yeah !

    + +
    + +
    +
    Wed 20 October 2010 @@ -75,30 +80,30 @@ Translations:
    -
    +

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    alternate text
    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    diff --git a/tests/output/custom/second-article-fr.html b/tests/output/custom/second-article-fr.html index 9e5b81ad..e386af38 100644 --- a/tests/output/custom/second-article-fr.html +++ b/tests/output/custom/second-article-fr.html @@ -49,13 +49,18 @@ - -
    -
    -

    Deuxième article

    -
    -
    + +
    +
    +
    +

    + Deuxième article

    + +
    + +
    +
    Wed 29 February 2012 @@ -75,25 +80,25 @@ Translations:
    -

    Ceci est un article, en français.

    +

    Ceci est un article, en français.

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    diff --git a/tests/output/custom/second-article.html b/tests/output/custom/second-article.html index a769cee4..003ebae0 100644 --- a/tests/output/custom/second-article.html +++ b/tests/output/custom/second-article.html @@ -49,13 +49,18 @@ - -
    -
    -

    Second article

    -
    -
    + +
    +
    +
    +

    + Second article

    + +
    + +
    +
    Wed 29 February 2012 @@ -75,25 +80,25 @@ Translations:
    -

    This is some article, in english

    +

    This is some article, in english

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    diff --git a/tests/output/custom/theme/css/wide.css b/tests/output/custom/theme/css/wide.css index 3376f4c7..88fd59ce 100644 --- a/tests/output/custom/theme/css/wide.css +++ b/tests/output/custom/theme/css/wide.css @@ -4,13 +4,17 @@ body { font:1.3em/1.3 "Hoefler Text","Georgia",Georgia,serif,sans-serif; } -.body, #banner nav, #banner nav ul, #about, #featured, #content{ - width: inherit; +.post-info{ + display: none; } #banner nav { + display: none; -moz-border-radius: 0px; - margin-bottom: 0px; + margin-bottom: 20px; + overflow: hidden; + font-size: 1em; + background: #F5F4EF; } #banner nav ul{ @@ -19,10 +23,11 @@ body { #banner nav li{ float: right; + color: #000; } -#banner nav li:first-child a { - -moz-border-radius: 0px; +#banner nav li a { + color: #000; } #banner h1 { diff --git a/tests/output/custom/theme/images/icons/facebook.png b/tests/output/custom/theme/images/icons/facebook.png new file mode 100644 index 0000000000000000000000000000000000000000..a7914b497369c55feba7defc9a3ea5bec424ecfc GIT binary patch literal 300 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa2=EDU{r~^Jb>s{nN~l=<`rQ{G z*EMNgZp)TeGt$L@YM4rb{DK+IJaKeh4CFB;dAqwXbg;^L06Clm9+AaB8pQTsa66f8 z2V~fKx;Tb#Tu)ADV02S85J*U9G7veylX_i&!&z12Q~+;~Q|gK~r==k=&T|S@G#cDE zb^5gT;nTtbJUf;eFfcqx6@I vWMyh@WooHyU}$AvU~RtQ2a1N={FKbJO57T}vIJa!8W=oX{an^LB{Ts5Vp3XV literal 0 HcmV?d00001 diff --git a/tests/output/custom/this-is-a-super-article.html b/tests/output/custom/this-is-a-super-article.html index 9ba6bb9b..2b41cdf3 100644 --- a/tests/output/custom/this-is-a-super-article.html +++ b/tests/output/custom/this-is-a-super-article.html @@ -49,13 +49,18 @@ - -
    -
    -

    This is a super article !

    -
    -
    + +
    +
    +
    +

    + This is a super article !

    + +
    + +
    +
    Thu 02 December 2010 @@ -70,7 +75,7 @@
    -

    Some content here !

    +

    Some content here !

    This is a simple title

    And here comes the cool stuff.

    @@ -83,23 +88,23 @@

    → And now try with some utf8 hell: ééé

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    diff --git a/tests/output/custom/unbelievable.html b/tests/output/custom/unbelievable.html index 1b611efe..4d18012a 100644 --- a/tests/output/custom/unbelievable.html +++ b/tests/output/custom/unbelievable.html @@ -49,13 +49,18 @@ - -
    -
    -

    Unbelievable !

    -
    -
    + +
    +
    +
    +

    + Unbelievable !

    + +
    + +
    +
    Fri 15 October 2010 @@ -70,25 +75,25 @@
    -

    Or completely awesome. Depends the needs.

    +

    Or completely awesome. Depends the needs.

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    From a8983b420f97379e306c1c5bd93b548b19b042cb Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 12 May 2012 01:30:09 +0200 Subject: [PATCH 012/359] be more verbose when functional tests fail --- tests/test_pelican.py | 48 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 1192dfe1..933c82fa 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -36,9 +36,27 @@ class TestPelican(unittest.TestCase): pelican = Pelican(path=INPUT_PATH, output_path=temp_path) pelican.run() diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "basic"))) - self.assertEqual(diff.left_only, []) - self.assertEqual(diff.right_only, []) - self.assertEqual(diff.diff_files, []) + self.assertEqual(diff.left_only, [], msg="some generated " \ + "files are absent from the expected functional " \ + "tests output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.right_only, [], msg="some files from " \ + "the expected functional tests output are absent " \ + "from the current output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.diff_files, [], msg="some generated " \ + "files differ from the expected functional tests " \ + "output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") def test_custom_generation_works(self): # the same thing with a specified set of settings should work @@ -47,6 +65,24 @@ class TestPelican(unittest.TestCase): settings=read_settings(SAMPLE_CONFIG)) pelican.run() diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "custom"))) - self.assertEqual(diff.left_only, []) - self.assertEqual(diff.right_only, []) - self.assertEqual(diff.diff_files, []) + self.assertEqual(diff.left_only, [], msg="some generated " \ + "files are absent from the expected functional " \ + "tests output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.right_only, [], msg="some files from " \ + "the expected functional tests output are absent " \ + "from the current output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.diff_files, [], msg="some generated " \ + "files differ from the expected functional tests " \ + "output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") From e82c6512b4703b19f5c142d0cd85b67a88e0040d Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 12 May 2012 02:03:18 +0200 Subject: [PATCH 013/359] clean up temporary dirs in tearDown to force cleanup even if tests fail --- tests/support.py | 18 --------- tests/test_generators.py | 47 ++++++++++++++---------- tests/test_pelican.py | 79 +++++++++++++++++++++------------------- 3 files changed, 69 insertions(+), 75 deletions(-) diff --git a/tests/support.py b/tests/support.py index f2b4a075..8b8cbab8 100644 --- a/tests/support.py +++ b/tests/support.py @@ -1,14 +1,10 @@ __all__ = [ - 'temporary_folder', 'get_article', 'unittest', ] import os import subprocess -from contextlib import contextmanager -from tempfile import mkdtemp -from shutil import rmtree from pelican.contents import Article @@ -18,20 +14,6 @@ except ImportError: import unittest -@contextmanager -def temporary_folder(): - """creates a temporary folder, return it and delete it afterwards. - - This allows to do something like this in tests: - - >>> with temporary_folder() as d: - # do whatever you want - """ - tempdir = mkdtemp() - yield tempdir - rmtree(tempdir) - - def get_article(title, slug, content, lang, extra_metadata=None): metadata = {'slug': slug, 'title': title, 'lang': lang} if extra_metadata is not None: diff --git a/tests/test_generators.py b/tests/test_generators.py index e62551fa..4e6b0acf 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -3,10 +3,12 @@ from mock import MagicMock import os import re +from tempfile import mkdtemp +from shutil import rmtree from pelican.generators import ArticlesGenerator, LessCSSGenerator from pelican.settings import _DEFAULT_CONFIG -from .support import unittest, temporary_folder, skipIfNoExecutable +from .support import unittest, skipIfNoExecutable CUR_DIR = os.path.dirname(__file__) @@ -107,6 +109,14 @@ class TestLessCSSGenerator(unittest.TestCase): } """ + def setUp(self): + self.temp_content = mkdtemp() + self.temp_output = mkdtemp() + + def tearDown(self): + rmtree(self.temp_content) + rmtree(self.temp_output) + @skipIfNoExecutable('lessc') def test_less_compiler(self): @@ -114,28 +124,25 @@ class TestLessCSSGenerator(unittest.TestCase): settings['STATIC_PATHS'] = ['static'] settings['LESS_GENERATOR'] = True - # we'll nest here for py < 2.7 compat - with temporary_folder() as temp_content: - with temporary_folder() as temp_output: - generator = LessCSSGenerator(None, settings, temp_content, - _DEFAULT_CONFIG['THEME'], temp_output, None) + generator = LessCSSGenerator(None, settings, self.temp_content, + _DEFAULT_CONFIG['THEME'], self.temp_output, None) - # create a dummy less file - less_dir = os.path.join(temp_content, 'static', 'css') - less_filename = os.path.join(less_dir, 'test.less') + # create a dummy less file + less_dir = os.path.join(self.temp_content, 'static', 'css') + less_filename = os.path.join(less_dir, 'test.less') - less_output = os.path.join(temp_output, 'static', 'css', - 'test.css') + less_output = os.path.join(self.temp_output, 'static', 'css', + 'test.css') - os.makedirs(less_dir) - with open(less_filename, 'w') as less_file: - less_file.write(self.LESS_CONTENT) + os.makedirs(less_dir) + with open(less_filename, 'w') as less_file: + less_file.write(self.LESS_CONTENT) - generator.generate_output() + generator.generate_output() - # we have the file ? - self.assertTrue(os.path.exists(less_output)) + # we have the file ? + self.assertTrue(os.path.exists(less_output)) - # was it compiled ? - self.assertIsNotNone(re.search(r'^\s+color:\s*#4D926F;$', - open(less_output).read(), re.MULTILINE | re.IGNORECASE)) + # was it compiled ? + self.assertIsNotNone(re.search(r'^\s+color:\s*#4D926F;$', + open(less_output).read(), re.MULTILINE | re.IGNORECASE)) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 933c82fa..a331690b 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -5,11 +5,11 @@ except ImportError: import os from filecmp import dircmp +from tempfile import mkdtemp +from shutil import rmtree from mock import patch -from .support import temporary_folder - from pelican import Pelican from pelican.settings import read_settings @@ -25,46 +25,23 @@ class TestPelican(unittest.TestCase): # general functional testing for pelican. Basically, this test case tries # to run pelican in different situations and see how it behaves + def setUp(self): + self.temp_path = mkdtemp() + + def tearDown(self): + rmtree(self.temp_path) + def test_basic_generation_works(self): # when running pelican without settings, it should pick up the default # ones and generate the output without raising any exception / issuing # any warning. - with temporary_folder() as temp_path: - with patch("pelican.contents.getenv") as mock_getenv: - # force getenv('USER') to always return the same value - mock_getenv.return_value = "Dummy Author" - pelican = Pelican(path=INPUT_PATH, output_path=temp_path) - pelican.run() - diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "basic"))) - self.assertEqual(diff.left_only, [], msg="some generated " \ - "files are absent from the expected functional " \ - "tests output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") - self.assertEqual(diff.right_only, [], msg="some files from " \ - "the expected functional tests output are absent " \ - "from the current output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") - self.assertEqual(diff.diff_files, [], msg="some generated " \ - "files differ from the expected functional tests " \ - "output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") - - def test_custom_generation_works(self): - # the same thing with a specified set of settings should work - with temporary_folder() as temp_path: - pelican = Pelican(path=INPUT_PATH, output_path=temp_path, - settings=read_settings(SAMPLE_CONFIG)) + with patch("pelican.contents.getenv") as mock_getenv: + # force getenv('USER') to always return the same value + mock_getenv.return_value = "Dummy Author" + pelican = Pelican(path=INPUT_PATH, output_path=self.temp_path) pelican.run() - diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "custom"))) + diff = dircmp( + self.temp_path, os.sep.join((OUTPUT_PATH, "basic"))) self.assertEqual(diff.left_only, [], msg="some generated " \ "files are absent from the expected functional " \ "tests output.\n" \ @@ -86,3 +63,31 @@ class TestPelican(unittest.TestCase): "changed. If these changes are normal, please refer " \ "to docs/contribute.rst to update the expected " \ "output of the functional tests.") + + def test_custom_generation_works(self): + # the same thing with a specified set of settings should work + pelican = Pelican(path=INPUT_PATH, output_path=self.temp_path, + settings=read_settings(SAMPLE_CONFIG)) + pelican.run() + diff = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "custom"))) + self.assertEqual(diff.left_only, [], msg="some generated " \ + "files are absent from the expected functional " \ + "tests output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.right_only, [], msg="some files from " \ + "the expected functional tests output are absent " \ + "from the current output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.diff_files, [], msg="some generated " \ + "files differ from the expected functional tests " \ + "output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") From ef77847762111d165cba14c65dfe5dfb11425530 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 19 May 2012 23:44:37 +0200 Subject: [PATCH 014/359] force locale to ascii in functional tests --- samples/pelican.conf.py | 2 +- tests/test_pelican.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py index bffe57f6..fffbf1a8 100755 --- a/samples/pelican.conf.py +++ b/samples/pelican.conf.py @@ -8,7 +8,7 @@ GITHUB_URL = 'http://github.com/ametaireau/' DISQUS_SITENAME = "blog-notmyidea" PDF_GENERATOR = False REVERSE_CATEGORY_ORDER = True -LOCALE = "" +LOCALE = "C" DEFAULT_PAGINATION = 4 FEED_RSS = 'feeds/all.rss.xml' diff --git a/tests/test_pelican.py b/tests/test_pelican.py index a331690b..0458d58c 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -7,6 +7,7 @@ import os from filecmp import dircmp from tempfile import mkdtemp from shutil import rmtree +import locale from mock import patch @@ -27,9 +28,12 @@ class TestPelican(unittest.TestCase): def setUp(self): self.temp_path = mkdtemp() + self.old_locale = locale.setlocale(locale.LC_ALL) + locale.setlocale(locale.LC_ALL, 'C') def tearDown(self): rmtree(self.temp_path) + locale.setlocale(locale.LC_ALL, self.old_locale) def test_basic_generation_works(self): # when running pelican without settings, it should pick up the default From b44ea53741f7baab89371718c9a7eba07010bb91 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 00:04:32 +0200 Subject: [PATCH 015/359] update command to generate functional tests output we need to force LC_ALL="C" to avoid generating articles/pages in other languages --- docs/contribute.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contribute.rst b/docs/contribute.rst index 3960b3f9..0090dd07 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -43,9 +43,9 @@ If you have made changes that affect the output of a pelican generated weblog, then you should update the output used by functional tests. To do so, you can use the 2 following commands:: - $ pelican -o tests/output/custom/ -s samples/pelican.conf.py \ + $ LC_ALL="C" pelican -o tests/output/custom/ -s samples/pelican.conf.py \ samples/content/ - $ USER="Dummy Author" pelican -o tests/output/basic/ samples/content/ + $ LC_ALL="C" USER="Dummy Author" pelican -o tests/output/basic/ samples/content/ Coding standards ================ From 36be150f200c009d334d525a9fbeba59c3aa2d11 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 00:07:01 +0200 Subject: [PATCH 016/359] replace FALLBACK_ON_FS_DATE by DEFAULT_DATE DEFAULT_DATE allows to specify any default date as a tuple in addition to the fallback on filesystem mtime check --- pelican/generators.py | 8 ++++++-- pelican/settings.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index ede948a4..dd5eb89e 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -268,9 +268,13 @@ class ArticlesGenerator(Generator): if category != '': metadata['category'] = Category(category, self.settings) - if 'date' not in metadata and self.settings['FALLBACK_ON_FS_DATE']: + if 'date' not in metadata and self.settings['DEFAULT_DATE']: + if self.settings['DEFAULT_DATE'] == 'fs': metadata['date'] = datetime.datetime.fromtimestamp( - os.stat(f).st_ctime) + os.stat(f).st_ctime) + else: + metadata['date'] = datetime.datetime( + *self.settings['DEFAULT_DATE']) article = Article(content, metadata, settings=self.settings, filename=f) diff --git a/pelican/settings.py b/pelican/settings.py index 4da66989..08b01133 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -29,7 +29,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'DISPLAY_PAGES_ON_MENU': True, 'PDF_GENERATOR': False, 'DEFAULT_CATEGORY': 'misc', - 'FALLBACK_ON_FS_DATE': True, + 'DEFAULT_DATE': 'fs', 'WITH_FUTURE_DATES': True, 'CSS_FILE': 'main.css', 'REVERSE_ARCHIVE_ORDER': False, From 775b236c934afab3df47b16c51806d1061c91a54 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 00:08:54 +0200 Subject: [PATCH 017/359] update doc for replacing FALLBACK_ON_FS_DATE by DEFAULT_DATE --- docs/fr/configuration.rst | 8 ++++++-- docs/settings.rst | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/fr/configuration.rst b/docs/fr/configuration.rst index 695a0b0e..7dffd8ab 100644 --- a/docs/fr/configuration.rst +++ b/docs/fr/configuration.rst @@ -130,8 +130,12 @@ Pelican est fournit avec :doc:`pelican-themes`, un script permettant de gérer l Paramètres divers ================= -FALLBACK_ON_FS_DATE : - Si *True*, Pelican se basera sur le *mtime* du fichier s'il n'y a pas de date spécifiée dans le fichier de l'article ; +DEFAULT_DATE: + Date par défaut à utiliser si l'information de date n'est pas spécifiée + dans les metadonnées de l'article. + Si 'fs', Pelican se basera sur le *mtime* du fichier. + Si c'est un tuple, il sera passé au constructeur datetime.datetime pour + générer l'objet datetime utilisé par défaut. KEEP_OUTPUT DIRECTORY : Ne génère que les fichiers modifiés et n'efface pas le repertoire de sortie ; diff --git a/docs/settings.rst b/docs/settings.rst index 85e9f0c3..199faefe 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -33,9 +33,13 @@ Setting name (default value) What doe `DISPLAY_PAGES_ON_MENU` (``True``) Whether to display pages on the menu of the template. Templates may or not honor this setting. -`FALLBACK_ON_FS_DATE` (``True``) If True, Pelican will use the file system +`DEFAULT_DATE` (``fs``) The default date you want to use. + If 'fs', Pelican will use the file system timestamp information (mtime) if it can't get date information from the metadata. + If tuple object, it will instead generate the + default datetime object by passing the tuple to + the datetime.datetime constructor. `JINJA_EXTENSIONS` (``[]``) A list of any Jinja2 extensions you want to use. `DELETE_OUTPUT_DIRECTORY` (``False``) Delete the output directory as well as the generated files. From 3a2df479da5890716e3730716565eeb54a34df02 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 00:10:08 +0200 Subject: [PATCH 018/359] fix test_custom_generation_works functional test --- samples/pelican.conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py index fffbf1a8..e55e0c0b 100755 --- a/samples/pelican.conf.py +++ b/samples/pelican.conf.py @@ -10,6 +10,7 @@ PDF_GENERATOR = False REVERSE_CATEGORY_ORDER = True LOCALE = "C" DEFAULT_PAGINATION = 4 +DEFAULT_DATE = (2012, 03, 02, 14, 01, 01) FEED_RSS = 'feeds/all.rss.xml' CATEGORY_FEED_RSS = 'feeds/%s.rss.xml' From 7abb2a7a7ce519b4d7e9865aa9e130ad287073f0 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 00:11:06 +0200 Subject: [PATCH 019/359] temporary skip failing test_basic_generation_works functional test --- tests/test_pelican.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 0458d58c..15088ed0 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -35,6 +35,7 @@ class TestPelican(unittest.TestCase): rmtree(self.temp_path) locale.setlocale(locale.LC_ALL, self.old_locale) + @unittest.skip("Test failing") def test_basic_generation_works(self): # when running pelican without settings, it should pick up the default # ones and generate the output without raising any exception / issuing From 2b47429c4a6c1a6cc42421b27a237dbf1dd07cd8 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 01:51:58 +0200 Subject: [PATCH 020/359] update generated output for 'custom' functional test LC_ALL="C" pelican -o tests/output/custom/ -s samples/pelican.conf.py samples/content/ --- .../custom/a-markdown-powered-article.html | 2 +- tests/output/custom/archives.html | 2 +- tests/output/custom/article-1.html | 2 +- tests/output/custom/article-2.html | 2 +- tests/output/custom/article-3.html | 2 +- .../custom/author/alexis-metaireau.html | 20 +-- .../custom/author/alexis-metaireau2.html | 27 ++-- tests/output/custom/categories.html | 4 +- tests/output/custom/category/bar.html | 4 +- tests/output/custom/category/cat1.html | 20 +-- .../category/{content.html => misc.html} | 18 +-- tests/output/custom/category/yeah.html | 4 +- .../output/custom/drafts/a-draft-article.html | 4 +- .../feeds/{content.atom.xml => misc.atom.xml} | 2 +- .../feeds/{content.rss.xml => misc.rss.xml} | 2 +- tests/output/custom/index.html | 22 +-- tests/output/custom/index2.html | 25 ++-- tests/output/custom/oh-yeah-fr.html | 4 +- tests/output/custom/oh-yeah.html | 2 +- .../pages/this-is-a-test-hidden-page.html | 125 ++++++++++++++++++ .../custom/pages/this-is-a-test-page.html | 2 +- tests/output/custom/second-article-fr.html | 4 +- tests/output/custom/second-article.html | 4 +- tests/output/custom/tag/bar.html | 24 ++-- tests/output/custom/tag/baz.html | 16 +-- tests/output/custom/tag/foo.html | 20 +-- tests/output/custom/tag/foobar.html | 4 +- tests/output/custom/tag/oh.html | 4 +- tests/output/custom/tag/yeah.html | 4 +- tests/output/custom/theme/css/main.css | 1 + .../custom/theme/images/icons/gitorious.png | Bin 0 -> 3675 bytes .../custom/this-is-a-super-article.html | 2 +- tests/output/custom/unbelievable.html | 4 +- 33 files changed, 255 insertions(+), 127 deletions(-) rename tests/output/custom/category/{content.html => misc.html} (94%) rename tests/output/custom/feeds/{content.atom.xml => misc.atom.xml} (56%) rename tests/output/custom/feeds/{content.rss.xml => misc.rss.xml} (76%) create mode 100644 tests/output/custom/pages/this-is-a-test-hidden-page.html create mode 100644 tests/output/custom/theme/images/icons/gitorious.png diff --git a/tests/output/custom/a-markdown-powered-article.html b/tests/output/custom/a-markdown-powered-article.html index 28486691..d3d0f53c 100644 --- a/tests/output/custom/a-markdown-powered-article.html +++ b/tests/output/custom/a-markdown-powered-article.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/archives.html b/tests/output/custom/archives.html index 083e6ada..3be563df 100644 --- a/tests/output/custom/archives.html +++ b/tests/output/custom/archives.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/article-1.html b/tests/output/custom/article-1.html index b7c0f46f..4402d227 100644 --- a/tests/output/custom/article-1.html +++ b/tests/output/custom/article-1.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/article-2.html b/tests/output/custom/article-2.html index e60d8077..ec6a86c8 100644 --- a/tests/output/custom/article-2.html +++ b/tests/output/custom/article-2.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/article-3.html b/tests/output/custom/article-3.html index b79c25f0..0d39654c 100644 --- a/tests/output/custom/article-3.html +++ b/tests/output/custom/article-3.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index 85f550b4..b60a01ef 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -85,7 +85,6 @@ - @@ -93,7 +92,8 @@
  • - @@ -128,7 +127,8 @@
  • - @@ -163,7 +162,8 @@
  • + +

    Page 1 / 2 @@ -199,9 +201,7 @@

    - - - +
    diff --git a/tests/output/custom/author/alexis-metaireau2.html b/tests/output/custom/author/alexis-metaireau2.html index 53fec2e5..cbf4387b 100644 --- a/tests/output/custom/author/alexis-metaireau2.html +++ b/tests/output/custom/author/alexis-metaireau2.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -61,7 +61,8 @@
  • - @@ -106,7 +106,8 @@ YEAH !

  • - @@ -146,7 +146,8 @@ Translations:
  • - @@ -182,7 +182,8 @@ as well as inline markup.

  • + +

    @@ -220,9 +223,7 @@ as well as inline markup.

    - - - +
    diff --git a/tests/output/custom/categories.html b/tests/output/custom/categories.html index 95e8c1f3..74f1c16b 100644 --- a/tests/output/custom/categories.html +++ b/tests/output/custom/categories.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -54,7 +54,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/category/bar.html b/tests/output/custom/category/bar.html index 53af38da..7860bd15 100644 --- a/tests/output/custom/category/bar.html +++ b/tests/output/custom/category/bar.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -99,8 +99,8 @@ YEAH !

    - +
    diff --git a/tests/output/custom/category/cat1.html b/tests/output/custom/category/cat1.html index 94bb74a7..b01c1ad6 100644 --- a/tests/output/custom/category/cat1.html +++ b/tests/output/custom/category/cat1.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -85,7 +85,6 @@ - @@ -93,7 +92,8 @@
  • - @@ -128,7 +127,8 @@
  • - @@ -163,7 +162,8 @@
  • + +

    Page 1 / 1

    - - - +
    diff --git a/tests/output/custom/category/content.html b/tests/output/custom/category/misc.html similarity index 94% rename from tests/output/custom/category/content.html rename to tests/output/custom/category/misc.html index 7645d430..0161b441 100644 --- a/tests/output/custom/category/content.html +++ b/tests/output/custom/category/misc.html @@ -1,7 +1,7 @@ - Alexis' log - content + Alexis' log - misc @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -68,7 +68,7 @@ By Alexis Métaireau -

    In content.

    +

    In misc.

    tags: foobarbaz

    @@ -91,7 +91,6 @@ Translations: - @@ -99,7 +98,8 @@ Translations:
  • + +

    Page 1 / 1

    - - - +
    diff --git a/tests/output/custom/category/yeah.html b/tests/output/custom/category/yeah.html index dc20affb..27e929c4 100644 --- a/tests/output/custom/category/yeah.html +++ b/tests/output/custom/category/yeah.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -100,8 +100,8 @@ - +
    diff --git a/tests/output/custom/drafts/a-draft-article.html b/tests/output/custom/drafts/a-draft-article.html index 659a61b9..35264ed6 100644 --- a/tests/output/custom/drafts/a-draft-article.html +++ b/tests/output/custom/drafts/a-draft-article.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -70,7 +70,7 @@ By Alexis Métaireau -

    In content.

    +

    In misc.

    diff --git a/tests/output/custom/feeds/content.atom.xml b/tests/output/custom/feeds/misc.atom.xml similarity index 56% rename from tests/output/custom/feeds/content.atom.xml rename to tests/output/custom/feeds/misc.atom.xml index 52bbf194..cce84da9 100644 --- a/tests/output/custom/feeds/content.atom.xml +++ b/tests/output/custom/feeds/misc.atom.xml @@ -1,4 +1,4 @@ -Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/content.rss.xml b/tests/output/custom/feeds/misc.rss.xml similarity index 76% rename from tests/output/custom/feeds/content.rss.xml rename to tests/output/custom/feeds/misc.rss.xml index dcacd17f..938bce29 100644 --- a/tests/output/custom/feeds/content.rss.xml +++ b/tests/output/custom/feeds/misc.rss.xml @@ -1,4 +1,4 @@ -Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> +Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.html \ No newline at end of file diff --git a/tests/output/custom/index.html b/tests/output/custom/index.html index ae77c625..79882019 100644 --- a/tests/output/custom/index.html +++ b/tests/output/custom/index.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -68,7 +68,7 @@ By Alexis Métaireau -

    In content.

    +

    In misc.

    tags: foobarbaz

    @@ -91,7 +91,6 @@ Translations: - @@ -99,7 +98,8 @@ Translations:
  • - @@ -133,7 +132,8 @@ Translations:
  • - @@ -168,7 +167,8 @@ Translations:
  • + +

    Page 1 / 2 @@ -204,9 +206,7 @@ Translations:

    - - - +
    diff --git a/tests/output/custom/index2.html b/tests/output/custom/index2.html index 797217ad..d6079fd9 100644 --- a/tests/output/custom/index2.html +++ b/tests/output/custom/index2.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -61,7 +61,8 @@
  • - @@ -96,7 +96,8 @@
  • - @@ -132,7 +132,8 @@ as well as inline markup.

  • - @@ -177,7 +177,8 @@ YEAH !

  • + +

    @@ -215,9 +218,7 @@ YEAH !

    - - - +
    diff --git a/tests/output/custom/oh-yeah-fr.html b/tests/output/custom/oh-yeah-fr.html index be931a60..25f67032 100644 --- a/tests/output/custom/oh-yeah-fr.html +++ b/tests/output/custom/oh-yeah-fr.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -70,7 +70,7 @@ By Alexis Métaireau -

    In content.

    +

    In misc.

    diff --git a/tests/output/custom/oh-yeah.html b/tests/output/custom/oh-yeah.html index 4f3f1020..fc635dc7 100644 --- a/tests/output/custom/oh-yeah.html +++ b/tests/output/custom/oh-yeah.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/pages/this-is-a-test-hidden-page.html b/tests/output/custom/pages/this-is-a-test-hidden-page.html new file mode 100644 index 00000000..b5eca671 --- /dev/null +++ b/tests/output/custom/pages/this-is-a-test-hidden-page.html @@ -0,0 +1,125 @@ + + + + This is a test hidden page + + + + + + + + + + + + + + + + + + + +Fork me on GitHub + + + + + +
    +

    This is a test hidden page

    + +

    This is great for things like error(404) pages +Anyone can see this page but it's not linked to anywhere!

    + +
    + +
    + +
    +

    blogroll

    + +
    + + + + +
    + + + + + + + + + + \ No newline at end of file diff --git a/tests/output/custom/pages/this-is-a-test-page.html b/tests/output/custom/pages/this-is-a-test-page.html index f176e761..85161430 100644 --- a/tests/output/custom/pages/this-is-a-test-page.html +++ b/tests/output/custom/pages/this-is-a-test-page.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/second-article-fr.html b/tests/output/custom/second-article-fr.html index e386af38..9ed39cec 100644 --- a/tests/output/custom/second-article-fr.html +++ b/tests/output/custom/second-article-fr.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -70,7 +70,7 @@ By Alexis Métaireau -

    In content.

    +

    In misc.

    tags: foobarbaz

    diff --git a/tests/output/custom/second-article.html b/tests/output/custom/second-article.html index 003ebae0..93e421fb 100644 --- a/tests/output/custom/second-article.html +++ b/tests/output/custom/second-article.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -70,7 +70,7 @@ By Alexis Métaireau -

    In content.

    +

    In misc.

    tags: foobarbaz

    diff --git a/tests/output/custom/tag/bar.html b/tests/output/custom/tag/bar.html index 5d6237cd..74cdb11d 100644 --- a/tests/output/custom/tag/bar.html +++ b/tests/output/custom/tag/bar.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -68,7 +68,7 @@ By Alexis Métaireau -

    In content.

    +

    In misc.

    tags: foobarbaz

    @@ -91,7 +91,6 @@ Translations: - @@ -99,7 +98,8 @@ Translations:
  • - @@ -139,7 +138,8 @@ Translations:
  • - @@ -175,7 +174,8 @@ as well as inline markup.

  • + +

    Page 1 / 1

    - - - +
    diff --git a/tests/output/custom/tag/baz.html b/tests/output/custom/tag/baz.html index e1be3d77..ee0a0728 100644 --- a/tests/output/custom/tag/baz.html +++ b/tests/output/custom/tag/baz.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -68,7 +68,7 @@ By Alexis Métaireau -

    In content.

    +

    In misc.

    tags: foobarbaz

    @@ -91,7 +91,6 @@ Translations: - @@ -99,7 +98,8 @@ Translations:
  • + +

    Page 1 / 1

    - - - +
    diff --git a/tests/output/custom/tag/foo.html b/tests/output/custom/tag/foo.html index 3beabbb1..dfbcb68b 100644 --- a/tests/output/custom/tag/foo.html +++ b/tests/output/custom/tag/foo.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -68,7 +68,7 @@ By Alexis Métaireau -

    In content.

    +

    In misc.

    tags: foobarbaz

    @@ -91,7 +91,6 @@ Translations: - @@ -99,7 +98,8 @@ Translations:
  • - @@ -139,7 +138,8 @@ Translations:
  • + +

    Page 1 / 1

    - - - +
    diff --git a/tests/output/custom/tag/foobar.html b/tests/output/custom/tag/foobar.html index 2da611ed..d14a9c71 100644 --- a/tests/output/custom/tag/foobar.html +++ b/tests/output/custom/tag/foobar.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -100,8 +100,8 @@ - +
    diff --git a/tests/output/custom/tag/oh.html b/tests/output/custom/tag/oh.html index 73db4505..abc98868 100644 --- a/tests/output/custom/tag/oh.html +++ b/tests/output/custom/tag/oh.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -99,8 +99,8 @@ YEAH !

    - +
    diff --git a/tests/output/custom/tag/yeah.html b/tests/output/custom/tag/yeah.html index f72400a6..199adbe0 100644 --- a/tests/output/custom/tag/yeah.html +++ b/tests/output/custom/tag/yeah.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -99,8 +99,8 @@ YEAH !

    - +
    diff --git a/tests/output/custom/theme/css/main.css b/tests/output/custom/theme/css/main.css index 92905076..dce9e247 100644 --- a/tests/output/custom/theme/css/main.css +++ b/tests/output/custom/theme/css/main.css @@ -312,6 +312,7 @@ img.left, figure.left {float: right; margin: 0 0 2em 2em;} .social a[type$='atom+xml'], .social a[type$='rss+xml'] {background-image: url('../images/icons/rss.png');} .social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');} .social a[href*='linkedin.com'] {background-image: url('../images/icons/linkedin.png');} + .social a[href*='gitorious.org'] {background-image: url('../images/icons/gitorious.org');} /* About diff --git a/tests/output/custom/theme/images/icons/gitorious.png b/tests/output/custom/theme/images/icons/gitorious.png new file mode 100644 index 0000000000000000000000000000000000000000..6485f5ecc5f6047a052d9adfb686ee154e7233af GIT binary patch literal 3675 zcmeH}_cs;(AIIM!du1jmd)(}q&As*>mwP2~txFP0S<$suA0ydaQQ0fx>V~qnD`Z|H zDsM1YRfBtf8PhSR$Jg1$Z#Z(m^oWl9R>38%Fr zV-o!|&8oo5l;~FpNdreqVXu59TS#ArPaCJS)~oig4I?ydw2WCs3f4*(#&YPD3tysp zyLy&ZrFA0dh5gU|Zg3a4e&2NdXtJ$6v<*278zrMgbh332;&r zrUQOx5VdKotgD z`hA5QR(*4vZDlM6DVAhkU}Z6+_|xb0_{drY{|m>{Rte_f~M(8MshYu zaDF=@zFp0G=Tzfw8oWz^vUSY}hTV7;tYWO}x%9@qin2NJ zz-^>1h>9&zzl~0rDhSGtx}s}@G(%cU8$HTuwl1u5UTNv!XK>?b2$mG^VXBOK5UJE9S~ooN=pm#z z=Y+30S+kBG1X@TR1#Igi$iJ}=^&f}&} zMOJneveKy1y3%l~Rk>!n6kF1&-|TP{$*kLJB6d^E5S>amk6pK&v7IlaFXb}VR6D4V zuJ9@5Eo#;a`gpf=C#T@UElh!#U+F?f>-wL|;W8)i6W>3j2ZoGD>IOz(Y9b@yqDHq; zfS(4ROfT`LHO#3~2Ud*AL}f31fDf#vM_57*)#U_^`9#`UW=N*s1@ zEq7yYs5%rQ?QS?V7*u1cMJAi8n@ca0;w>^PDhnpjoo{~P`f=q=Ja5*fsfjf>UtBl} z?aGaA>aOYB$!N_8e;@wOi6#wG{0ws?-wnQq`)}`YsM)J6(+pxFMPwjlUngmyn!j8Z{`LttFk$+cV$Sx@r=55a6^FI(C4~Z^-Z1 zE+f|NDDQah#LvALQhXs%;Gl5-Q)eISi}l*5Hp7cdS)awK2uqk{B)V~3NXAVj9Z@~? zrl~lnf`t0Pt@TUm-isBj6%CaI`2`2(A(ghKzNSITPQL=@*hSc5A+kF;lspPbF(MRb z%EUZV3jN3FG23wZT?PpcLnt>+NZ3Es@H zRuSJOKhdDRqLMo!7{y}aV-a!MDgFt_OQUkxN|4l`e}Mv0JK8DJOhW`M1S>s zI9TNoTYuVpH@QjXN+wOePeWSOc?T(a9JJ&c{D$}xgr*+tf$;n|oH(GGRatOtczdW} zfS9K8{KpIOHd_bV(ob7dVMnDLWeueY=wK#j~DvftZIEe3rW#u*^ zyC$MlG}PQD@>csmRC^k8}B#pF?a6S+w#gTy!(jfnCHgV1*rl@=B$eBui4CZnPz6+GA-J_-9GrGPn5|X z7AH1G<6!t#A2r^!c$D@NhSjyS)ZyLH9p12(Uy9!+h>k6!6RrLa zL^}#Q^9j!hk0axw29kD7V#UT`){(DMwS{lMb}!`^iFJrNNaR*b0PHDka(5lxuS+ch{+zj-+Oi=YCHqIJMsjZi4BjC{ypbHe2EKN zcOxv`X7T&+o;7f3OrM;*uHK?fxVif-aJQbg#*TQ0$g5Rz_T3EJ)Hux;x9n|x-kev1 zzv+YD32ki*^CWHX7N`*B_gh1La*-z|3RE@cTlYf!NZq7^MXvdXdtxVq!RDDDv7PD` z%NFN-oo(G2*nIqiw&UsC^pCm6x7&gW_eSRoNz}2?Bd6&HsVuPbsky0xaZGVr1=qDy zRhPBzoopPJ!baRjL<_i2U!D%uaC6B-98PRa5k_-Hi?VmKGd}u0Dn8k4+v2Gu_H^`I z`OqJ%Aa`ru{%E^BXfBBF$E!sa%hgBxkHyJezv~WcKb0P3@ML6=sVH;yj@=Zbh-ZD1 z-_6Lz9Dq;}05H)2{3f6I1^^Fa0oZf_KrIIVZoj9_-39ZfDh7YjeuipAOblqHnRd;pX1guKpVP^?KjrDZl!Lxy>?erb8ta^(jygszj+vLaYB8AoV>@2=0&gbIyeah -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/unbelievable.html b/tests/output/custom/unbelievable.html index 4d18012a..83eed167 100644 --- a/tests/output/custom/unbelievable.html +++ b/tests/output/custom/unbelievable.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -70,7 +70,7 @@ By Alexis Métaireau -

    In content.

    +

    In misc.

    From dff5b3589bf4d437cc6c250423066049f3ec1adc Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Sat, 7 Jul 2012 12:15:35 -0700 Subject: [PATCH 021/359] Add per page templates. Closes #376 Also set up helper classes in test_generators.py for cleaner tests --- docs/faq.rst | 11 ++++ pelican/contents.py | 11 ++++ pelican/generators.py | 15 +++--- tests/TestPages/hidden_page_with_template.rst | 11 ++++ tests/TestPages/page_with_template.rst | 8 +++ tests/content/article_with_template.rst | 8 +++ tests/test_contents.py | 25 ++++++++- tests/test_generators.py | 54 +++++++++++++++++-- 8 files changed, 128 insertions(+), 15 deletions(-) create mode 100644 tests/TestPages/hidden_page_with_template.rst create mode 100644 tests/TestPages/page_with_template.rst create mode 100644 tests/content/article_with_template.rst diff --git a/docs/faq.rst b/docs/faq.rst index a3829d65..3eec6e84 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -49,3 +49,14 @@ install it. You can do so by typing:: In case you don't have pip installed, consider installing it via:: $ (sudo) easy_install pip + +How do I assign custom templates on a per page basis? +===================================================== + +It's as simple as adding an extra line of metadata to any pages or articles you +want to have it's own template. + + :template: template_name + +Then just make sure to have the template installed in to your theme as +``template_name.html``. \ No newline at end of file diff --git a/pelican/contents.py b/pelican/contents.py index b8bb0993..a5e3be8f 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -21,6 +21,7 @@ class Page(object): :param content: the string to parse, containing the original content. """ mandatory_properties = ('title',) + default_template = 'page' def __init__(self, content, metadata=None, settings=None, filename=None): @@ -44,6 +45,9 @@ class Page(object): # also keep track of the metadata attributes available self.metadata = local_metadata + #default template if it's not defined in page + self.template = self._get_template() + # default author to the one in settings if not defined if not hasattr(self, 'author'): if 'AUTHOR' in settings: @@ -153,9 +157,16 @@ class Page(object): url = property(functools.partial(get_url_setting, key='url')) save_as = property(functools.partial(get_url_setting, key='save_as')) + def _get_template(self): + if hasattr(self, 'template') and self.template is not None: + return self.template + else: + return self.default_template + class Article(Page): mandatory_properties = ('title', 'date', 'category') + default_template = 'article' class Quote(Page): diff --git a/pelican/generators.py b/pelican/generators.py index 4e9312cc..8526a56d 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -167,11 +167,9 @@ class ArticlesGenerator(Generator): def generate_articles(self, write): """Generate the articles.""" - article_template = self.get_template('article') for article in chain(self.translations, self.articles): - write(article.save_as, - article_template, self.context, article=article, - category=article.category) + write(article.save_as, self.get_template(article.template), + self.context, article=article, category=article.category) def generate_direct_templates(self, write): """Generate direct templates pages""" @@ -222,10 +220,10 @@ class ArticlesGenerator(Generator): def generate_drafts(self, write): """Generate drafts pages.""" - article_template = self.get_template('article') for article in self.drafts: - write('drafts/%s.html' % article.slug, article_template, - self.context, article=article, category=article.category) + write('drafts/%s.html' % article.slug, + self.get_template(article.template), self.context, + article=article, category=article.category) def generate_pages(self, writer): """Generate the pages on the disk""" @@ -385,7 +383,6 @@ class PagesGenerator(Generator): (repr(unicode.encode(page.status, 'utf-8')), repr(f))) - self.pages, self.translations = process_translations(all_pages) self.hidden_pages, self.hidden_translations = process_translations(hidden_pages) @@ -395,7 +392,7 @@ class PagesGenerator(Generator): def generate_output(self, writer): for page in chain(self.translations, self.pages, self.hidden_translations, self.hidden_pages): - writer.write_file(page.save_as, self.get_template('page'), + writer.write_file(page.save_as, self.get_template(page.template), self.context, page=page, relative_urls=self.settings.get('RELATIVE_URLS')) diff --git a/tests/TestPages/hidden_page_with_template.rst b/tests/TestPages/hidden_page_with_template.rst new file mode 100644 index 00000000..36104a09 --- /dev/null +++ b/tests/TestPages/hidden_page_with_template.rst @@ -0,0 +1,11 @@ +This is a test hidden page with a custom template +################################################# + +:status: hidden +:template: custom + +The quick brown fox jumped over the lazy dog's back. + +This page is hidden + +This page has a custom template to be called when rendered diff --git a/tests/TestPages/page_with_template.rst b/tests/TestPages/page_with_template.rst new file mode 100644 index 00000000..9388dc2f --- /dev/null +++ b/tests/TestPages/page_with_template.rst @@ -0,0 +1,8 @@ +This is a test page with a preset template +########################################## + +:template: custom + +The quick brown fox jumped over the lazy dog's back. + +This article has a custom template to be called when rendered diff --git a/tests/content/article_with_template.rst b/tests/content/article_with_template.rst new file mode 100644 index 00000000..eb55738c --- /dev/null +++ b/tests/content/article_with_template.rst @@ -0,0 +1,8 @@ +Article with template +##################### + +:template: custom + +This article has a custom template to be called when rendered + +This is some content. With some stuff to "typogrify". diff --git a/tests/test_contents.py b/tests/test_contents.py index e7c9ad01..bc028ea8 100644 --- a/tests/test_contents.py +++ b/tests/test_contents.py @@ -2,7 +2,7 @@ from .support import unittest -from pelican.contents import Page +from pelican.contents import Page, Article from pelican.settings import _DEFAULT_CONFIG from pelican.utils import truncate_html_words @@ -135,6 +135,17 @@ class TestPage(unittest.TestCase): # will simply skip this test. unittest.skip("There is no locale %s in this system." % locale) + def test_template(self): + """ + Pages default to page, metadata overwrites + """ + default_page = Page(**self.page_kwargs) + self.assertEqual('page', default_page.template) + page_kwargs = self._copy_page_kwargs() + page_kwargs['metadata']['template'] = 'custom' + custom_page = Page(**page_kwargs) + self.assertEqual('custom', custom_page.template) + def _copy_page_kwargs(self): # make a deep copy of page_kwargs page_kwargs = dict([(key, self.page_kwargs[key]) for key in @@ -146,3 +157,15 @@ class TestPage(unittest.TestCase): for subkey in page_kwargs[key]]) return page_kwargs + +class TestArticle(TestPage): + def test_template(self): + """ + Articles default to article, metadata overwrites + """ + default_article = Article(**self.page_kwargs) + self.assertEqual('article', default_article.template) + article_kwargs = self._copy_page_kwargs() + article_kwargs['metadata']['template'] = 'custom' + custom_article = Article(**article_kwargs) + self.assertEqual('custom', custom_article.template) diff --git a/tests/test_generators.py b/tests/test_generators.py index 61f31696..3b0a4b46 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -13,6 +13,37 @@ CUR_DIR = os.path.dirname(__file__) class TestArticlesGenerator(unittest.TestCase): + def setUp(self): + super(TestArticlesGenerator, self).setUp() + self.generator = None + + def get_populated_generator(self): + """ + We only need to pull all the test articles once, but read from it + for each test. + """ + if self.generator is None: + settings = _DEFAULT_CONFIG.copy() + settings['ARTICLE_DIR'] = 'content' + settings['DEFAULT_CATEGORY'] = 'Default' + self.generator = ArticlesGenerator(settings.copy(), settings, + CUR_DIR, _DEFAULT_CONFIG['THEME'], None, + _DEFAULT_CONFIG['MARKUP']) + self.generator.generate_context() + return self.generator + + def distill_articles(self, articles): + distilled = [] + for page in articles: + distilled.append([ + page.title, + page.status, + page.category.name, + page.template + ] + ) + return distilled + def test_generate_feeds(self): generator = ArticlesGenerator(None, {'FEED': _DEFAULT_CONFIG['FEED']}, @@ -93,6 +124,16 @@ class TestArticlesGenerator(unittest.TestCase): generator.generate_direct_templates(write) write.assert_called_count == 0 + def test_per_article_template(self): + """ + Custom template articles get the field but standard/unset are None + """ + generator = self.get_populated_generator() + articles = self.distill_articles(generator.articles) + custom_template = ['Article with template', 'published', 'Default', 'custom'] + standard_template = ['This is a super article !', 'published', 'Yeah', 'article'] + self.assertIn(custom_template, articles) + self.assertIn(standard_template, articles) class TestPageGenerator(unittest.TestCase): """ @@ -107,7 +148,8 @@ class TestPageGenerator(unittest.TestCase): for page in pages: distilled.append([ page.title, - page.status + page.status, + page.template ] ) return distilled @@ -124,12 +166,14 @@ class TestPageGenerator(unittest.TestCase): hidden_pages = self.distill_pages(generator.hidden_pages) pages_expected = [ - [u'This is a test page', 'published'], - [u'This is a markdown test page', 'published'] + [u'This is a test page', 'published', 'page'], + [u'This is a markdown test page', 'published', 'page'], + [u'This is a test page with a preset template', 'published', 'custom'] ] hidden_pages_expected = [ - [u'This is a test hidden page', 'hidden'], - [u'This is a markdown test hidden page', 'hidden'] + [u'This is a test hidden page', 'hidden', 'page'], + [u'This is a markdown test hidden page', 'hidden', 'page'], + [u'This is a test hidden page with a custom template', 'hidden', 'custom'] ] self.assertItemsEqual(pages_expected,pages) From a1f27d9189461da533a8cc4334e7701e33ab8ff3 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Sat, 7 Jul 2012 16:59:58 -0700 Subject: [PATCH 022/359] Small change to fix #406 --- pelican/tools/templates/publishconf.py.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pelican/tools/templates/publishconf.py.in b/pelican/tools/templates/publishconf.py.in index 113a7318..a4516332 100644 --- a/pelican/tools/templates/publishconf.py.in +++ b/pelican/tools/templates/publishconf.py.in @@ -1,6 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # +import sys +sys.path.append('.') from pelicanconf import * SITEURL = '$siteurl' From 38ffcfd4c40b5d054cfc99772d84a05cf8bd3e2e Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Sun, 8 Jul 2012 17:50:18 -0700 Subject: [PATCH 023/359] Added the delevop_server script This script and the small changes to quick start's makefile make for easily launching and killing of pelican --debug --autoreload and SimpleHTTPServer. This is extra useful for working on templates. --- pelican/tools/pelican_quickstart.py | 11 ++- pelican/tools/templates/Makefile.in | 3 +- pelican/tools/templates/develop_server.sh.in | 83 ++++++++++++++++++++ 3 files changed, 95 insertions(+), 2 deletions(-) create mode 100755 pelican/tools/templates/develop_server.sh.in diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index f747d048..577a435d 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -160,7 +160,7 @@ Please answer the following questions so this script can generate the files need else: CONF['default_pagination'] = False - mkfile = ask('Do you want to generate a Makefile to easily manage your website?', bool, True) + mkfile = ask('Do you want to generate a Makefile and develop server script to easily manage your website?', bool, True) if mkfile: if ask('Do you want to upload your website using FTP?', answer=bool, default=False): @@ -214,4 +214,13 @@ Please answer the following questions so this script can generate the files need except OSError, e: print('Error: {0}'.format(e)) + try: + with open(os.path.join(CONF['basedir'], 'develop_server.sh'), 'w') as fd: + for line in get_template('develop_server.sh'): + template = string.Template(line) + fd.write(template.safe_substitute(CONF)) + fd.close() + except OSError, e: + print('Error: {0}'.format(e)) + print('Done. Your new project is available at %s' % CONF['basedir']) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 3a3fe74c..df00ffbf 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -25,6 +25,7 @@ help: @echo ' make html (re)generate the web site ' @echo ' make clean remove the generated files ' @echo ' make publish generate using production settings ' + @echo ' make serve run develop_server.sh restart ' @echo ' ftp_upload upload the web site via FTP ' @echo ' ssh_upload upload the web site via SSH ' @echo ' dropbox_upload upload the web site via Dropbox ' @@ -45,7 +46,7 @@ regenerate: clean $$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS) serve: - cd $$(OUTPUTDIR) && python -m SimpleHTTPServer + $$(BASEDIR)/develop_server.sh restart publish: $$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(PUBLISHCONF) $$(PELICANOPTS) diff --git a/pelican/tools/templates/develop_server.sh.in b/pelican/tools/templates/develop_server.sh.in new file mode 100755 index 00000000..2f8c07dd --- /dev/null +++ b/pelican/tools/templates/develop_server.sh.in @@ -0,0 +1,83 @@ +#!/bin/bash +## +# This section should match your Makefile +## +PELICAN=$pelican +PELICANOPTS=$pelicanopts + +BASEDIR=$$(PWD) +INPUTDIR=$$BASEDIR/content +OUTPUTDIR=$$BASEDIR/output +CONFFILE=$$BASEDIR/pelicanconf.py + +### +# Don't change stuff below here unless you are sure +### + +SRV_PID=$$BASEDIR/srv.pid +PELICAN_PID=$$BASEDIR/pelican.pid + +function usage(){ + echo "usage: $$0 (stop) (start) (restart)" + echo "This starts pelican in debug and reload mode and then launches" + echo "A SimpleHTTP server to help site development. It doesn't read" + echo "your pelican options so you edit any paths in your Makefile" + echo "you will need to edit it as well" + exit 3 +} + +function shut_down(){ + if [[ -f $$SRV_PID ]]; then + PID=$$(cat $$SRV_PID) + PROCESS=$$(ps -p $$PID | tail -n 1 | awk '{print $$4}') + if [[ $$PROCESS == python ]]; then + echo "Killing SimpleHTTPServer" + kill $$PID + else + echo "Stale PID, deleting" + fi + rm $$SRV_PID + else + echo "SimpleHTTPServer PIDFile not found" + fi + + if [[ -f $$PELICAN_PID ]]; then + PID=$$(cat $$PELICAN_PID) + PROCESS=$$(ps -p $$PID | tail -n 1 | awk '{print $$4}') + if [[ $$PROCESS != "" ]]; then + echo "Killing Pelican" + kill $$PID + else + echo "Stale PID, deleting" + fi + rm $$PELICAN_PID + else + echo "Pelican PIDFile not found" + fi +} + +function start_up(){ + echo "Starting up Pelican and SimpleHTTPServer" + shift + $$PELICAN --debug --autoreload -r $$INPUTDIR -o $$OUTPUTDIR -s $$CONFFILE $$PELICANOPTS & + echo $$! > $$PELICAN_PID + cd $$OUTPUTDIR + python -m SimpleHTTPServer & + echo $$! > $$SRV_PID + cd $$BASEDIR +} + +### +# MAIN +### +[[ $$# -ne 1 ]] && usage +if [[ $$1 == "stop" ]]; then + shut_down +elif [[ $$1 == "restart" ]]; then + shut_down + start_up +elif [[ $$1 == "start" ]]; then + start_up +else + usage +fi From 10e668a87cd0e1fba125d04bcf93465600c81ba6 Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 9 Jul 2012 15:25:13 +0200 Subject: [PATCH 024/359] Fix issue #175 Force world-readable permission on files and directory of the themes installed by pelican-themes. Only on posix system i.e. mostly non Windows Rationale: If the theme's files have only -rw------- permissions, once installed system wide and owned by root, they will not be accessible to any user but only root. --- pelican/tools/pelican_themes.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index 6a021ecc..0083dd50 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -180,8 +180,19 @@ def install(path, v=False, u=False): print("Copying `{p}' to `{t}' ...".format(p=path, t=theme_path)) try: shutil.copytree(path, theme_path) - except Exception, e: + + if os.name == 'posix': + for root, dirs, files in os.walk(theme_path): + for d in dirs: + dname = os.path.join(root, d) + os.chmod(dname, 0755) + for f in files: + fname = os.path.join(root, f) + os.chmod(fname, 0644) + except shutil.Error, e: err("Cannot copy `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e))) + except OSError, e: + err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) def symlink(path, v=False): From 4acbbb8d0fa157fbb0cb10e2b0c6abc428f8ffab Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 9 Jul 2012 19:48:53 +0200 Subject: [PATCH 025/359] Use logging module instead of err function --- pelican/tools/pelican_themes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index 0083dd50..2fe4f459 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -192,7 +192,9 @@ def install(path, v=False, u=False): except shutil.Error, e: err("Cannot copy `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e))) except OSError, e: - err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) + import logging + logger = logging.getLogger(__name__) + logger.warning("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e))) def symlink(path, v=False): From 842817f110481c280b7a121e96a9a818c8354f6a Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 9 Jul 2012 20:05:21 +0200 Subject: [PATCH 026/359] Revert "Use logging module instead of err function" This reverts commit 4acbbb8d0fa157fbb0cb10e2b0c6abc428f8ffab. I don't know how to use logging/logger This throws: No handlers could be found for logger "pelican.tools.pelican_themes" --- pelican/tools/pelican_themes.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index 2fe4f459..0083dd50 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -192,9 +192,7 @@ def install(path, v=False, u=False): except shutil.Error, e: err("Cannot copy `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e))) except OSError, e: - import logging - logger = logging.getLogger(__name__) - logger.warning("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e))) + err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) def symlink(path, v=False): From a0d2d3446649066e7f03560953b5962d9fdcadf5 Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 9 Jul 2012 20:07:31 +0200 Subject: [PATCH 027/359] shutil.copytree seems to throw OSError exception too So revert to previous Exception handling --- pelican/tools/pelican_themes.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index 0083dd50..d13e60e9 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -181,18 +181,19 @@ def install(path, v=False, u=False): try: shutil.copytree(path, theme_path) - if os.name == 'posix': - for root, dirs, files in os.walk(theme_path): - for d in dirs: - dname = os.path.join(root, d) - os.chmod(dname, 0755) - for f in files: - fname = os.path.join(root, f) - os.chmod(fname, 0644) - except shutil.Error, e: + try: + if os.name == 'posix': + for root, dirs, files in os.walk(theme_path): + for d in dirs: + dname = os.path.join(root, d) + os.chmod(dname, 0755) + for f in files: + fname = os.path.join(root, f) + os.chmod(fname, 0644) + except OSError, e: + err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) + except Exception, e: err("Cannot copy `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e))) - except OSError, e: - err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) def symlink(path, v=False): From ddc0aa0e8260f5ab61eb16369632a18c1ee21648 Mon Sep 17 00:00:00 2001 From: Samrat Man Singh Date: Tue, 10 Jul 2012 11:06:07 +0545 Subject: [PATCH 028/359] Related posts is now working, but needs some actual logic. --- pelican/generators.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pelican/generators.py b/pelican/generators.py index 4e9312cc..a7180e98 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -116,6 +116,7 @@ class ArticlesGenerator(Generator): self.dates = {} self.tags = defaultdict(list) self.categories = defaultdict(list) + self.related_posts = [] self.authors = defaultdict(list) super(ArticlesGenerator, self).__init__(*args, **kwargs) self.drafts = [] @@ -344,8 +345,14 @@ class ArticlesGenerator(Generator): self.authors = list(self.authors.items()) self.authors.sort(key=lambda item: item[0].name) + for article in self.articles: + article.related_posts = [] + print article + potential_related = all_articles.remove(article) + article.related_posts = potential_related[:5] + self._update_context(('articles', 'dates', 'tags', 'categories', - 'tag_cloud', 'authors')) + 'tag_cloud', 'authors', 'related_posts')) def generate_output(self, writer): self.generate_feeds(writer) From 4d23ffc1121b553f9b2da6bb9f035fe63437456a Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Tue, 10 Jul 2012 13:40:38 +0200 Subject: [PATCH 029/359] Updated the functional tests to match latest changes. --- .../basic/a-markdown-powered-article.html | 2 +- tests/output/basic/archives.html | 2 +- tests/output/basic/article-1.html | 2 +- tests/output/basic/article-2.html | 2 +- tests/output/basic/article-3.html | 2 +- .../output/basic/author/alexis-metaireau.html | 12 +- tests/output/basic/author/dummy-author.html | 32 ++-- tests/output/basic/categories.html | 4 +- tests/output/basic/category/bar.html | 4 +- tests/output/basic/category/cat1.html | 20 +-- tests/output/basic/category/misc.html | 147 ++++++++++++++++++ tests/output/basic/category/yeah.html | 4 +- .../output/basic/drafts/a-draft-article.html | 8 +- tests/output/basic/feeds/all-fr.atom.xml | 2 +- tests/output/basic/feeds/misc.atom.xml | 4 + tests/output/basic/index.html | 40 ++--- tests/output/basic/oh-yeah-fr.html | 8 +- tests/output/basic/oh-yeah.html | 2 +- .../pages/this-is-a-test-hidden-page.html | 70 +++++++++ .../basic/pages/this-is-a-test-page.html | 2 +- tests/output/basic/second-article-fr.html | 4 +- tests/output/basic/second-article.html | 4 +- tests/output/basic/tag/bar.html | 36 ++--- tests/output/basic/tag/baz.html | 28 ++-- tests/output/basic/tag/foo.html | 32 ++-- tests/output/basic/tag/foobar.html | 4 +- tests/output/basic/tag/oh.html | 4 +- tests/output/basic/tag/yeah.html | 4 +- tests/output/basic/theme/css/main.css | 1 + .../basic/theme/images/icons/gitorious.png | Bin 0 -> 3675 bytes .../output/basic/this-is-a-super-article.html | 2 +- tests/output/basic/unbelievable.html | 4 +- tests/output/custom/tag/bar.html | 20 +-- tests/output/custom/tag/baz.html | 20 +-- tests/output/custom/tag/foo.html | 20 +-- 35 files changed, 387 insertions(+), 165 deletions(-) create mode 100644 tests/output/basic/category/misc.html create mode 100644 tests/output/basic/feeds/misc.atom.xml create mode 100644 tests/output/basic/pages/this-is-a-test-hidden-page.html create mode 100644 tests/output/basic/theme/images/icons/gitorious.png diff --git a/tests/output/basic/a-markdown-powered-article.html b/tests/output/basic/a-markdown-powered-article.html index ceadf79a..bfa09fdf 100644 --- a/tests/output/basic/a-markdown-powered-article.html +++ b/tests/output/basic/a-markdown-powered-article.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/archives.html b/tests/output/basic/archives.html index 52d00234..dac96a47 100644 --- a/tests/output/basic/archives.html +++ b/tests/output/basic/archives.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/article-1.html b/tests/output/basic/article-1.html index bd6f9716..ab1d71d7 100644 --- a/tests/output/basic/article-1.html +++ b/tests/output/basic/article-1.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/article-2.html b/tests/output/basic/article-2.html index 7811204a..52cfff0d 100644 --- a/tests/output/basic/article-2.html +++ b/tests/output/basic/article-2.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/article-3.html b/tests/output/basic/article-3.html index 96acb190..ef97a56d 100644 --- a/tests/output/basic/article-3.html +++ b/tests/output/basic/article-3.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/author/alexis-metaireau.html b/tests/output/basic/author/alexis-metaireau.html index 6bf631eb..ad7b8bee 100644 --- a/tests/output/basic/author/alexis-metaireau.html +++ b/tests/output/basic/author/alexis-metaireau.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -88,7 +88,6 @@ YEAH !

    - @@ -96,7 +95,8 @@ YEAH !

  • - - - + + +
    diff --git a/tests/output/basic/author/dummy-author.html b/tests/output/basic/author/dummy-author.html index cf23f899..54c81100 100644 --- a/tests/output/basic/author/dummy-author.html +++ b/tests/output/basic/author/dummy-author.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -77,7 +77,6 @@ - @@ -85,7 +84,8 @@
  • - @@ -120,7 +119,8 @@
  • - @@ -155,7 +154,8 @@
  • - @@ -190,7 +189,8 @@
  • - @@ -230,7 +229,8 @@ Translations:
  • - - - + + +
    diff --git a/tests/output/basic/categories.html b/tests/output/basic/categories.html index db25ed68..d13d0b92 100644 --- a/tests/output/basic/categories.html +++ b/tests/output/basic/categories.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -48,7 +48,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/category/bar.html b/tests/output/basic/category/bar.html index 77d0187b..a80656a5 100644 --- a/tests/output/basic/category/bar.html +++ b/tests/output/basic/category/bar.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -85,8 +85,8 @@ YEAH !

    - +
    diff --git a/tests/output/basic/category/cat1.html b/tests/output/basic/category/cat1.html index 1d8d67e8..3d062ac7 100644 --- a/tests/output/basic/category/cat1.html +++ b/tests/output/basic/category/cat1.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -77,7 +77,6 @@ - @@ -85,7 +84,8 @@
  • - @@ -120,7 +119,8 @@
  • - @@ -155,7 +154,8 @@
  • - - - + + +
    diff --git a/tests/output/basic/category/misc.html b/tests/output/basic/category/misc.html new file mode 100644 index 00000000..ff344111 --- /dev/null +++ b/tests/output/basic/category/misc.html @@ -0,0 +1,147 @@ + + + + A Pelican Blog - misc + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    Other articles

    +
    +
      + + + + + + + + + +
    1. + + +
    + + + +
    + + + + +
    + + +
    + + + + + + + + \ No newline at end of file diff --git a/tests/output/basic/category/yeah.html b/tests/output/basic/category/yeah.html index 747cad37..1d4d7f04 100644 --- a/tests/output/basic/category/yeah.html +++ b/tests/output/basic/category/yeah.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -86,8 +86,8 @@ - +
    diff --git a/tests/output/basic/drafts/a-draft-article.html b/tests/output/basic/drafts/a-draft-article.html index 99b90c33..af0f2476 100644 --- a/tests/output/basic/drafts/a-draft-article.html +++ b/tests/output/basic/drafts/a-draft-article.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -53,8 +53,8 @@
    - - Fri 02 March 2012 + + Sat 19 May 2012 @@ -62,7 +62,7 @@ By Dummy Author -

    In content.

    +

    In misc.

    diff --git a/tests/output/basic/feeds/all-fr.atom.xml b/tests/output/basic/feeds/all-fr.atom.xml index ce245dee..274bd548 100644 --- a/tests/output/basic/feeds/all-fr.atom.xml +++ b/tests/output/basic/feeds/all-fr.atom.xml @@ -1,4 +1,4 @@ -A Pelican Blog.././2012-03-02T14:01:01ZTrop bien !2012-03-02T14:01:01ZDummy Authortag:../.,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> +A Pelican Blog.././2012-05-19T23:55:50ZTrop bien !2012-05-19T23:55:50ZDummy Authortag:../.,2012-05-19:oh-yeah-fr.html<p>Et voila du contenu en français</p> Deuxième article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/misc.atom.xml b/tests/output/basic/feeds/misc.atom.xml new file mode 100644 index 00000000..db33d39b --- /dev/null +++ b/tests/output/basic/feeds/misc.atom.xml @@ -0,0 +1,4 @@ + +A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> +Unbelievable !2010-10-15T20:30:00ZDummy Authortag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> + \ No newline at end of file diff --git a/tests/output/basic/index.html b/tests/output/basic/index.html index 1f247443..fe6c2279 100644 --- a/tests/output/basic/index.html +++ b/tests/output/basic/index.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -60,7 +60,7 @@ By Dummy Author -

    In content.

    +

    In misc.

    tags: foobarbaz

    @@ -83,7 +83,6 @@ Translations: - @@ -91,7 +90,8 @@ Translations:
  • - @@ -125,7 +124,8 @@ Translations:
  • - @@ -160,7 +159,8 @@ Translations:
  • - @@ -195,7 +194,8 @@ Translations:
  • - @@ -230,7 +229,8 @@ Translations:
  • - @@ -266,7 +265,8 @@ as well as inline markup.

  • - @@ -311,7 +310,8 @@ YEAH !

  • - - - + + +
    diff --git a/tests/output/basic/oh-yeah-fr.html b/tests/output/basic/oh-yeah-fr.html index 666a961f..4856347f 100644 --- a/tests/output/basic/oh-yeah-fr.html +++ b/tests/output/basic/oh-yeah-fr.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -53,8 +53,8 @@
    - - Fri 02 March 2012 + + Sat 19 May 2012 @@ -62,7 +62,7 @@ By Dummy Author -

    In content.

    +

    In misc.

    diff --git a/tests/output/basic/oh-yeah.html b/tests/output/basic/oh-yeah.html index c8f1af74..bd0c75ee 100644 --- a/tests/output/basic/oh-yeah.html +++ b/tests/output/basic/oh-yeah.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/pages/this-is-a-test-hidden-page.html b/tests/output/basic/pages/this-is-a-test-hidden-page.html new file mode 100644 index 00000000..4412d600 --- /dev/null +++ b/tests/output/basic/pages/this-is-a-test-hidden-page.html @@ -0,0 +1,70 @@ + + + + This is a test hidden page + + + + + + + + + + + + + + + + + +
    +

    This is a test hidden page

    + +

    This is great for things like error(404) pages +Anyone can see this page but it's not linked to anywhere!

    + +
    + +
    + + +
    + + + + + + + + \ No newline at end of file diff --git a/tests/output/basic/pages/this-is-a-test-page.html b/tests/output/basic/pages/this-is-a-test-page.html index cc282243..14a78a29 100644 --- a/tests/output/basic/pages/this-is-a-test-page.html +++ b/tests/output/basic/pages/this-is-a-test-page.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/second-article-fr.html b/tests/output/basic/second-article-fr.html index 11960efc..a3701245 100644 --- a/tests/output/basic/second-article-fr.html +++ b/tests/output/basic/second-article-fr.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -62,7 +62,7 @@ By Dummy Author -

    In content.

    +

    In misc.

    tags: foobarbaz

    diff --git a/tests/output/basic/second-article.html b/tests/output/basic/second-article.html index 171717ba..cbae942b 100644 --- a/tests/output/basic/second-article.html +++ b/tests/output/basic/second-article.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -62,7 +62,7 @@ By Dummy Author -

    In content.

    +

    In misc.

    tags: foobarbaz

    diff --git a/tests/output/basic/tag/bar.html b/tests/output/basic/tag/bar.html index 8ffd84d8..47a427cb 100644 --- a/tests/output/basic/tag/bar.html +++ b/tests/output/basic/tag/bar.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -49,7 +49,7 @@

    This is some article, in english

    @@ -83,7 +83,6 @@ Translations: - @@ -91,7 +90,8 @@ Translations:
  • - @@ -131,7 +130,8 @@ Translations:
  • - @@ -167,7 +166,8 @@ as well as inline markup.

  • - - - + + +
    diff --git a/tests/output/basic/tag/baz.html b/tests/output/basic/tag/baz.html index ea01a199..d5c2904f 100644 --- a/tests/output/basic/tag/baz.html +++ b/tests/output/basic/tag/baz.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -49,7 +49,7 @@

    Other articles

    diff --git a/tests/output/basic/category/misc.html b/tests/output/basic/category/misc.html index 6a088793..86cf5470 100644 --- a/tests/output/basic/category/misc.html +++ b/tests/output/basic/category/misc.html @@ -69,8 +69,8 @@

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more diff --git a/tests/output/basic/feeds/all-en.atom.xml b/tests/output/basic/feeds/all-en.atom.xml index bc5418a7..fc05c4b3 100644 --- a/tests/output/basic/feeds/all-en.atom.xml +++ b/tests/output/basic/feeds/all-en.atom.xml @@ -1,8 +1,8 @@ A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> A markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> -<p><a href="unbelievable.html">a root-relative link to unbelievable</a> -<a href="unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> +<p><a href="/unbelievable.html">a root-relative link to unbelievable</a> +<a href="/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> Article 22011-02-17T00:00:00Ztag:,2011-02-17:article-2.html<p>Article 2</p> Article 32011-02-17T00:00:00Ztag:,2011-02-17:article-3.html<p>Article 3</p> This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> @@ -24,6 +24,6 @@ YEAH !</p> <img alt="alternate text" src="|filename|/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> -<p><a class="reference external" href="a-markdown-powered-article.html">a root-relative link to markdown-article</a> -<a class="reference external" href="a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +<p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a> +<a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> \ No newline at end of file diff --git a/tests/output/basic/feeds/all.atom.xml b/tests/output/basic/feeds/all.atom.xml index 645c5890..f3a1a6f4 100644 --- a/tests/output/basic/feeds/all.atom.xml +++ b/tests/output/basic/feeds/all.atom.xml @@ -2,8 +2,8 @@ A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> Deuxième article2012-02-29T00:00:00Ztag:,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> A markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> -<p><a href="unbelievable.html">a root-relative link to unbelievable</a> -<a href="unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> +<p><a href="/unbelievable.html">a root-relative link to unbelievable</a> +<a href="/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> Article 22011-02-17T00:00:00Ztag:,2011-02-17:article-2.html<p>Article 2</p> Article 32011-02-17T00:00:00Ztag:,2011-02-17:article-3.html<p>Article 3</p> This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> @@ -25,6 +25,6 @@ YEAH !</p> <img alt="alternate text" src="|filename|/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> -<p><a class="reference external" href="a-markdown-powered-article.html">a root-relative link to markdown-article</a> -<a class="reference external" href="a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +<p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a> +<a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> \ No newline at end of file diff --git a/tests/output/basic/feeds/cat1.atom.xml b/tests/output/basic/feeds/cat1.atom.xml index 3d8100fd..2fa534aa 100644 --- a/tests/output/basic/feeds/cat1.atom.xml +++ b/tests/output/basic/feeds/cat1.atom.xml @@ -1,7 +1,7 @@ A Pelican Blog/2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> -<p><a href="unbelievable.html">a root-relative link to unbelievable</a> -<a href="unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> +<p><a href="/unbelievable.html">a root-relative link to unbelievable</a> +<a href="/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> Article 22011-02-17T00:00:00Ztag:,2011-02-17:article-2.html<p>Article 2</p> Article 32011-02-17T00:00:00Ztag:,2011-02-17:article-3.html<p>Article 3</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/misc.atom.xml b/tests/output/basic/feeds/misc.atom.xml index 8e5477ba..40ad44c5 100644 --- a/tests/output/basic/feeds/misc.atom.xml +++ b/tests/output/basic/feeds/misc.atom.xml @@ -1,6 +1,6 @@ A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> -<p><a class="reference external" href="a-markdown-powered-article.html">a root-relative link to markdown-article</a> -<a class="reference external" href="a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +<p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a> +<a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> \ No newline at end of file diff --git a/tests/output/basic/index.html b/tests/output/basic/index.html index 9c00402e..97bb5256 100644 --- a/tests/output/basic/index.html +++ b/tests/output/basic/index.html @@ -69,8 +69,8 @@

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    read more @@ -214,8 +214,8 @@ YEAH !

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more diff --git a/tests/output/basic/unbelievable.html b/tests/output/basic/unbelievable.html index 95bc7b85..36a1703c 100644 --- a/tests/output/basic/unbelievable.html +++ b/tests/output/basic/unbelievable.html @@ -46,8 +46,8 @@

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    diff --git a/tests/output/custom/a-markdown-powered-article.html b/tests/output/custom/a-markdown-powered-article.html index 52d0e5f9..49c0d422 100644 --- a/tests/output/custom/a-markdown-powered-article.html +++ b/tests/output/custom/a-markdown-powered-article.html @@ -53,8 +53,8 @@

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    Comments !

    diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index 5a36c27e..eb39ae57 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -50,8 +50,8 @@

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    There are comments.

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    There are comments.

    Other articles

    diff --git a/tests/output/custom/author/alexis-metaireau2.html b/tests/output/custom/author/alexis-metaireau2.html index e456805b..a87c85af 100644 --- a/tests/output/custom/author/alexis-metaireau2.html +++ b/tests/output/custom/author/alexis-metaireau2.html @@ -62,7 +62,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text
    read more @@ -142,8 +142,8 @@ as well as inline markup.

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more

    There are comments.

    diff --git a/tests/output/custom/category/bar.html b/tests/output/custom/category/bar.html index d291b9df..253d64ea 100644 --- a/tests/output/custom/category/bar.html +++ b/tests/output/custom/category/bar.html @@ -55,7 +55,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text

    There are comments.

    diff --git a/tests/output/custom/category/cat1.html b/tests/output/custom/category/cat1.html index 9316faf0..8c265d41 100644 --- a/tests/output/custom/category/cat1.html +++ b/tests/output/custom/category/cat1.html @@ -50,8 +50,8 @@

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    There are comments.

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    There are comments.

    Other articles

    diff --git a/tests/output/custom/category/misc.html b/tests/output/custom/category/misc.html index 6609ce25..24a53791 100644 --- a/tests/output/custom/category/misc.html +++ b/tests/output/custom/category/misc.html @@ -79,8 +79,8 @@

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more

    There are comments.

    diff --git a/tests/output/custom/category/yeah.html b/tests/output/custom/category/yeah.html index 587e2f97..c39e1a86 100644 --- a/tests/output/custom/category/yeah.html +++ b/tests/output/custom/category/yeah.html @@ -53,8 +53,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/tests/output/custom/index.html b/tests/output/custom/index.html
    index 7b7cb84b..eab96fa1 100644
    --- a/tests/output/custom/index.html
    +++ b/tests/output/custom/index.html
    @@ -79,8 +79,8 @@
             

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    read more

    There are comments.

    diff --git a/tests/output/custom/index2.html b/tests/output/custom/index2.html index 8e308821..5269ed70 100644 --- a/tests/output/custom/index2.html +++ b/tests/output/custom/index2.html @@ -113,7 +113,7 @@ as well as inline markup.

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text read more @@ -140,8 +140,8 @@ YEAH !

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more

    There are comments.

    diff --git a/tests/output/custom/oh-yeah.html b/tests/output/custom/oh-yeah.html index aafcc69d..cb30a7d6 100644 --- a/tests/output/custom/oh-yeah.html +++ b/tests/output/custom/oh-yeah.html @@ -58,7 +58,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text diff --git a/tests/output/custom/pages/this-is-a-test-page.html b/tests/output/custom/pages/this-is-a-test-page.html index 6cb1c582..5df98726 100644 --- a/tests/output/custom/pages/this-is-a-test-page.html +++ b/tests/output/custom/pages/this-is-a-test-page.html @@ -38,7 +38,7 @@

    This is a test page

    Just an image.

    -alternate text +alternate text
    diff --git a/tests/output/custom/tag/bar.html b/tests/output/custom/tag/bar.html index 319f9595..85bc5a07 100644 --- a/tests/output/custom/tag/bar.html +++ b/tests/output/custom/tag/bar.html @@ -137,7 +137,7 @@ as well as inline markup.

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text read more diff --git a/tests/output/custom/tag/foobar.html b/tests/output/custom/tag/foobar.html index c8653686..b7a257e4 100644 --- a/tests/output/custom/tag/foobar.html +++ b/tests/output/custom/tag/foobar.html @@ -53,8 +53,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/tests/output/custom/tag/oh.html b/tests/output/custom/tag/oh.html
    index ddec0f41..451b1031 100644
    --- a/tests/output/custom/tag/oh.html
    +++ b/tests/output/custom/tag/oh.html
    @@ -55,7 +55,7 @@
     

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text

    There are comments.

    diff --git a/tests/output/custom/tag/yeah.html b/tests/output/custom/tag/yeah.html index a000affd..151eb64c 100644 --- a/tests/output/custom/tag/yeah.html +++ b/tests/output/custom/tag/yeah.html @@ -55,7 +55,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text

    There are comments.

    diff --git a/tests/output/custom/this-is-a-super-article.html b/tests/output/custom/this-is-a-super-article.html index 0f1e198b..98d22351 100644 --- a/tests/output/custom/this-is-a-super-article.html +++ b/tests/output/custom/this-is-a-super-article.html @@ -56,8 +56,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/tests/output/custom/unbelievable.html b/tests/output/custom/unbelievable.html
    index f22a05a2..691f28f6 100644
    --- a/tests/output/custom/unbelievable.html
    +++ b/tests/output/custom/unbelievable.html
    @@ -53,8 +53,8 @@
             

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    From 81cb774a8e807453a82921aa31f2f1325b6a3d23 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 1 Dec 2012 21:35:15 +0100 Subject: [PATCH 289/359] add docs for cross-site linking --- docs/getting_started.rst | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 467363de..bc3d2bbe 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -226,6 +226,50 @@ If you want to exclude any pages from being linked to or listed in the menu then add a ``status: hidden`` attribute to its metadata. This is useful for things like making error pages that fit the generated theme of your site. +Linking to internal content +--------------------------- + +Since Pelican 3.1, you now have the ability to do cross-site linking. + +To link to an internal content, you will have to use the following syntax: +``|filename|path/to/file``. + +For example, you may want to add links between "article1" and "article2" given +the structure:: + + website/ + ├── content + │   ├── article1.rst + │   └── cat/ + │      └── article2.md + └── pelican.conf.py + +In this example, ``article1.rst`` could look like:: + + Title: The first article + Date: 2012-12-01 + + See below cross-site links examples in restructured text. + + `a root-relative link <|filename|/cat/article2.md>`_ + `a file-relative link <|filename|cat/article2.md>`_ + +and ``article2.md``:: + + Title: The second article + Date: 2012-12-01 + + See below cross-site links examples in markdown. + + [a root-relative link](|filename|/article1.rst) + [a file-relative link](|filename|../article1.rst) + +.. note:: + + You can use the same syntax to link to internal pages or even static + content (like images) which would be available in a directory listed in + ``settings["STATIC_PATHS"]``. + Importing an existing blog -------------------------- From 891a66ad8bd0913c064f176db3dba405f83b7aaa Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Sun, 2 Dec 2012 13:11:47 -0500 Subject: [PATCH 290/359] Updated documentation to reflect addition of new markdown types. --- docs/getting_started.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index bc3d2bbe..7b44034c 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -162,10 +162,10 @@ Pelican implements an extension of reStructuredText to enable support for the This will be turned into :abbr:`HTML (HyperText Markup Language)`. -You can also use Markdown syntax (with a file ending in ``.md``). -Markdown generation will not work until you explicitly install the ``Markdown`` -package, which can be done via ``pip install Markdown``. Metadata syntax for -Markdown posts should follow this pattern:: +You can also use Markdown syntax (with a file ending in ``.md``, ``.markdown``, +or ``.mkd``). Markdown generation will not work until you explicitly install the +``Markdown`` package, which can be done via ``pip install Markdown``. Metadata +syntax for Markdown posts should follow this pattern:: Title: My super title Date: 2010-12-03 10:20 From 49f481e399af45bf12f53afd129bd6a873dc2f27 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Sun, 28 Oct 2012 07:37:53 -0700 Subject: [PATCH 291/359] Add asciidoc reader support http://www.methods.co.nz/asciidoc/index.html Processes files ending in .asc with asciidoc. Extra arguments can be passed by using the ASCIIDOC_OPTIONS config setting --- docs/changelog.rst | 1 + docs/getting_started.rst | 4 ++ docs/index.rst | 3 +- docs/internals.rst | 10 ++--- docs/settings.rst | 2 + pelican/readers.py | 36 ++++++++++++++++ tests/content/article_with_asc_extension.asc | 12 ++++++ tests/content/article_with_asc_options.asc | 9 ++++ tests/test_readers.py | 43 ++++++++++++++++++++ 9 files changed, 114 insertions(+), 6 deletions(-) create mode 100644 tests/content/article_with_asc_extension.asc create mode 100644 tests/content/article_with_asc_options.asc diff --git a/docs/changelog.rst b/docs/changelog.rst index f60c6e47..f25ee3d9 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -24,6 +24,7 @@ Release history * Add the gzip_cache plugin which compresses common text files into a ``.gz`` file within the same directory as the original file to prevent the server (e.g. Nginx) from compressing files during an HTTP call. +* Add AsciiDoc support 3.0 (2012-08-08) ================== diff --git a/docs/getting_started.rst b/docs/getting_started.rst index bc3d2bbe..8959f536 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -42,6 +42,10 @@ Markdown library as well:: $ pip install Markdown +If you want to use AsciiDoc you need to install it from `source +`_ or use your operating +system's package manager. + Upgrading --------- diff --git a/docs/index.rst b/docs/index.rst index fd99b449..8206727c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,7 +4,7 @@ Pelican Pelican is a static site generator, written in Python_. * Write your weblog entries directly with your editor of choice (vim!) - in reStructuredText_ or Markdown_ + in reStructuredText_, Markdown_ or AsciiDoc_ * Includes a simple CLI tool to (re)generate the weblog * Easy to interface with DVCSes and web hooks * Completely static output is easy to host anywhere @@ -74,6 +74,7 @@ A French version of the documentation is available at :doc:`fr/index`. .. _Python: http://www.python.org/ .. _reStructuredText: http://docutils.sourceforge.net/rst.html .. _Markdown: http://daringfireball.net/projects/markdown/ +.. _AsciiDoc: http://www.methods.co.nz/asciidoc/index.html .. _Jinja2: http://jinja.pocoo.org/ .. _`Pelican documentation`: http://docs.getpelican.com/latest/ .. _`Pelican's internals`: http://docs.getpelican.com/en/latest/internals.html diff --git a/docs/internals.rst b/docs/internals.rst index a6264476..280e14d7 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -12,8 +12,8 @@ original author wrote with some software design information. Overall structure ================= -What Pelican does is take a list of files and process them into some -sort of output. Usually, the input files are reStructuredText and Markdown +What Pelican does is take a list of files and process them into some sort of +output. Usually, the input files are reStructuredText, Markdown and AsciiDoc files, and the output is a blog, but both input and output can be anything you want. @@ -23,9 +23,9 @@ The logic is separated into different classes and concepts: on. Since those operations are commonly used, the object is created once and then passed to the generators. -* **Readers** are used to read from various formats (Markdown and - reStructuredText for now, but the system is extensible). Given a file, they return - metadata (author, tags, category, etc.) and content (HTML-formatted). +* **Readers** are used to read from various formats (AsciiDoc, Markdown and + reStructuredText for now, but the system is extensible). Given a file, they + return metadata (author, tags, category, etc.) and content (HTML-formatted). * **Generators** generate the different outputs. For instance, Pelican comes with ``ArticlesGenerator`` and ``PageGenerator``. Given a configuration, they can do diff --git a/docs/settings.rst b/docs/settings.rst index a7cf107b..7d73afe0 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -121,6 +121,8 @@ Setting name (default value) What doe This templates need to use ``DIRECT_TEMPLATES`` setting `MARKDOWN_EXTENSIONS` (``['toc',]``) A list of any Markdown extensions you want to use. +`ASCIIDOC_OPTIONS` (``[]``) A list of options to pass to asciidoc, see the `manpage + `_ ===================================================================== ===================================================================== .. [#] Default is the system locale. diff --git a/pelican/readers.py b/pelican/readers.py index 42995688..f04b4a03 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -13,6 +13,11 @@ try: from markdown import Markdown except ImportError: Markdown = False # NOQA +try: + from asciidocapi import AsciiDocAPI + asciidoc = True +except ImportError: + asciidoc = False import re from pelican.contents import Category, Tag, Author @@ -162,6 +167,37 @@ class HtmlReader(Reader): return content, metadata +class AsciiDocReader(Reader): + enabled = bool(asciidoc) + file_extensions = ['asc'] + default_options = ["--no-header-footer", "-a newline=\\n"] + + def read(self, filename): + """Parse content and metadata of asciidoc files""" + from cStringIO import StringIO + text = StringIO(pelican_open(filename)) + content = StringIO() + ad = AsciiDocAPI() + + options = self.settings.get('ASCIIDOC_OPTIONS', []) + if isinstance(options, (str, unicode)): + options = [m.strip() for m in options.split(',')] + options = self.default_options + options + for o in options: + ad.options(*o.split()) + + ad.execute(text, content, backend="html4") + content = content.getvalue() + + metadata = {} + for name, value in ad.asciidoc.document.attributes.items(): + name = name.lower() + metadata[name] = self.process_metadata(name, value) + if 'doctitle' in metadata: + metadata['title'] = metadata['doctitle'] + return content, metadata + + _EXTENSIONS = {} for cls in Reader.__subclasses__(): diff --git a/tests/content/article_with_asc_extension.asc b/tests/content/article_with_asc_extension.asc new file mode 100644 index 00000000..9ce2166c --- /dev/null +++ b/tests/content/article_with_asc_extension.asc @@ -0,0 +1,12 @@ +Test AsciiDoc File Header +========================= +:Author: Author O. Article +:Email: +:Date: 2011-09-15 09:05 +:Category: Blog +:Tags: Linux, Python, Pelican + +Used for pelican test +--------------------- + +The quick brown fox jumped over the lazy dog's back. diff --git a/tests/content/article_with_asc_options.asc b/tests/content/article_with_asc_options.asc new file mode 100644 index 00000000..bafb3a4a --- /dev/null +++ b/tests/content/article_with_asc_options.asc @@ -0,0 +1,9 @@ +Test AsciiDoc File Header +========================= + +Used for pelican test +--------------------- + +version {revision} + +The quick brown fox jumped over the lazy dog's back. diff --git a/tests/test_readers.py b/tests/test_readers.py index 406027c1..c9d22c18 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -109,3 +109,46 @@ class MdReaderTest(unittest.TestCase): '

    Level2

    ' self.assertEqual(content, expected) + +class AdReaderTest(unittest.TestCase): + + @unittest.skipUnless(readers.asciidoc, "asciidoc isn't installed") + def test_article_with_asc_extension(self): + # test to ensure the asc extension is being processed by the correct reader + reader = readers.AsciiDocReader({}) + content, metadata = reader.read(_filename('article_with_asc_extension.asc')) + expected = '
    \n

    Used for pelican test

    \n'\ + '

    The quick brown fox jumped over the lazy dog’s back.

    \n' + self.assertEqual(content, expected) + expected = { + 'category': 'Blog', + 'author': 'Author O. Article', + 'title': 'Test AsciiDoc File Header', + 'date': datetime.datetime(2011, 9, 15, 9, 5), + 'tags': ['Linux', 'Python', 'Pelican'], + } + + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + + + expected = { + 'category': 'Blog', + 'author': 'Author O. Article', + 'title': 'Test AsciiDoc File Header', + 'date': datetime.datetime(2011, 9, 15, 9, 5), + 'tags': ['Linux', 'Python', 'Pelican'], + } + + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + + @unittest.skipUnless(readers.asciidoc, "asciidoc isn't installed") + def test_article_with_asc_options(self): + # test to ensure the ASCIIDOC_OPTIONS is being used + reader = readers.AsciiDocReader(dict(ASCIIDOC_OPTIONS=["-a revision=1.0.42"])) + content, metadata = reader.read(_filename('article_with_asc_options.asc')) + expected = '
    \n

    Used for pelican test

    \n'\ + '

    version 1.0.42

    \n'\ + '

    The quick brown fox jumped over the lazy dog’s back.

    \n' + self.assertEqual(content, expected) From a0049f9fcddf967d036a88fcf17169982f3fc993 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sun, 2 Dec 2012 16:10:11 -0800 Subject: [PATCH 292/359] Strip tags from title in simple index. Fixes #612 This fix was applied previously to the relevant places in both the "simple" and "notmyidea" themes, but the simple theme's index.html file was apparently neglected. --- pelican/themes/simple/templates/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pelican/themes/simple/templates/index.html b/pelican/themes/simple/templates/index.html index dfdb0b45..5bb94dfc 100644 --- a/pelican/themes/simple/templates/index.html +++ b/pelican/themes/simple/templates/index.html @@ -1,14 +1,14 @@ {% extends "base.html" %} -{% block content %} +{% block content %}
    {% block content_title %}

    All articles

    {% endblock %}
      -{% for article in articles_page.object_list %} -
    1. -

      {{ article.title }}

      +{% for article in articles_page.object_list %} +
    2. +

      {{ article.title }}

      {{ article.locale_date }} {% if article.author %}
      By {{ article.author }}
      {% endif %} From debd6fb3b4a472c80a8fc7924eddf6e79856e725 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 28 Nov 2012 00:29:30 +0100 Subject: [PATCH 293/359] add FILENAME_METADATA setting to extract metadata from filename FILENAME_METADATA default to '(?P\d{4}-\d{2}-\d{2}).*' which will allow to extract date metadata from the filename. --- pelican/readers.py | 14 +++++++++++++- pelican/settings.py | 12 +++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index f04b4a03..ad2b0f74 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +import os +import re try: import docutils import docutils.core @@ -207,8 +209,9 @@ for cls in Reader.__subclasses__(): def read_file(filename, fmt=None, settings=None): """Return a reader object using the given format.""" + base, ext = os.path.splitext(os.path.basename(filename)) if not fmt: - fmt = filename.split('.')[-1] + fmt = ext[1:] if fmt not in _EXTENSIONS: raise TypeError('Pelican does not know how to parse %s' % filename) @@ -230,4 +233,13 @@ def read_file(filename, fmt=None, settings=None): content = typogrify(content) metadata['title'] = typogrify(metadata['title']) + filename_metadata = settings and settings.get('FILENAME_METADATA') + if filename_metadata: + match = re.match(filename_metadata, base) + if match: + for k, v in match.groupdict().iteritems(): + if k not in metadata: + k = k.lower() # metadata must be lowercase + metadata[k] = reader.process_metadata(k, v) + return content, metadata diff --git a/pelican/settings.py b/pelican/settings.py index d2c0cef5..a98f3538 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -5,6 +5,7 @@ import inspect import os import locale import logging +import re from os.path import isabs @@ -60,7 +61,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'TAG_CLOUD_STEPS': 4, 'TAG_CLOUD_MAX_ITEMS': 100, 'DIRECT_TEMPLATES': ('index', 'tags', 'categories', 'archives'), - 'EXTRA_TEMPLATES_PATHS' : [], + 'EXTRA_TEMPLATES_PATHS': [], 'PAGINATED_DIRECT_TEMPLATES': ('index', ), 'PELICAN_CLASS': 'pelican.Pelican', 'DEFAULT_DATE_FORMAT': '%a %d %B %Y', @@ -70,6 +71,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'DEFAULT_PAGINATION': False, 'DEFAULT_ORPHANS': 0, 'DEFAULT_METADATA': (), + 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2}).*', 'FILES_TO_COPY': (), 'DEFAULT_STATUS': 'published', 'ARTICLE_PERMALINK_STRUCTURE': '', @@ -205,4 +207,12 @@ def configure_settings(settings): " falling back to the default extension " + _DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION']) + filename_metadata = settings.get('FILENAME_METADATA') + if filename_metadata and not isinstance(filename_metadata, basestring): + logger.error("Detected misconfiguration with FILENAME_METADATA" + " setting (must be string or compiled pattern), falling" + "back to the default") + settings['FILENAME_METADATA'] = \ + _DEFAULT_CONFIG['FILENAME_METADATA'] + return settings From 3a25f82c4fc95c4654a7d85eb0fdd85e39cfb904 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 28 Nov 2012 01:01:15 +0100 Subject: [PATCH 294/359] update docs/settings.rst for both DEFAULT_METADATA and FILENAME_METADATA --- docs/settings.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/settings.rst b/docs/settings.rst index 7d73afe0..2ce44dfb 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -50,6 +50,16 @@ Setting name (default value) What doe If tuple object, it will instead generate the default datetime object by passing the tuple to the datetime.datetime constructor. +`DEFAULT_METADATA` (``()``) The default metadata you want to use for all articles + and pages. +`FILENAME_METADATA` (``'(?P\d{4}-\d{2}-\d{2}).*'``) The regexp that will be used to extract any metadata + from the filename. All named groups that are matched + will be set in the metadata object. + The default value will only extract the date from + the filename. + For example, if you would like to extract both the + date and the slug, you could set something like: + ``'(?P\d{4}-\d{2}-\d{2})_(?.*)'``. `DELETE_OUTPUT_DIRECTORY` (``False``) Delete the content of the output directory before generating new files. `FILES_TO_COPY` (``()``) A list of files (or directories) to copy from the source (inside the From dfab8ed5b96a03ac35394acc3123ca0b79eb552e Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 01:12:59 +0100 Subject: [PATCH 295/359] test the "metadata from filename" feature --- pelican/readers.py | 2 +- ...2012-11-29_rst_w_filename_meta#foo-bar.rst | 6 ++ .../2012-11-30_md_w_filename_meta#foo-bar.md | 6 ++ tests/test_readers.py | 93 +++++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 tests/content/2012-11-29_rst_w_filename_meta#foo-bar.rst create mode 100644 tests/content/2012-11-30_md_w_filename_meta#foo-bar.md diff --git a/pelican/readers.py b/pelican/readers.py index ad2b0f74..74cec02f 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -228,7 +228,7 @@ def read_file(filename, fmt=None, settings=None): content, metadata = reader.read(filename) # eventually filter the content with typogrify if asked so - if settings and settings['TYPOGRIFY']: + if settings and settings.get('TYPOGRIFY'): from typogrify.filters import typogrify content = typogrify(content) metadata['title'] = typogrify(metadata['title']) diff --git a/tests/content/2012-11-29_rst_w_filename_meta#foo-bar.rst b/tests/content/2012-11-29_rst_w_filename_meta#foo-bar.rst new file mode 100644 index 00000000..43f05a15 --- /dev/null +++ b/tests/content/2012-11-29_rst_w_filename_meta#foo-bar.rst @@ -0,0 +1,6 @@ + +Rst with filename metadata +########################## + +:category: yeah +:author: Alexis Métaireau diff --git a/tests/content/2012-11-30_md_w_filename_meta#foo-bar.md b/tests/content/2012-11-30_md_w_filename_meta#foo-bar.md new file mode 100644 index 00000000..cdccfc8a --- /dev/null +++ b/tests/content/2012-11-30_md_w_filename_meta#foo-bar.md @@ -0,0 +1,6 @@ +category: yeah +author: Alexis Métaireau + +Markdown with filename metadata +=============================== + diff --git a/tests/test_readers.py b/tests/test_readers.py index c9d22c18..dcfee809 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -34,6 +34,50 @@ class RstReaderTest(unittest.TestCase): for key, value in expected.items(): self.assertEquals(value, metadata[key], key) + def test_article_with_filename_metadata(self): + content, metadata = readers.read_file( + _filename('2012-11-29_rst_w_filename_meta#foo-bar.rst'), + settings={}) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'title': 'Rst with filename metadata', + } + for key, value in metadata.items(): + self.assertEquals(value, expected[key], key) + + content, metadata = readers.read_file( + _filename('2012-11-29_rst_w_filename_meta#foo-bar.rst'), + settings={ + 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2}).*' + }) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'title': 'Rst with filename metadata', + 'date': datetime.datetime(2012, 11, 29), + } + for key, value in metadata.items(): + self.assertEquals(value, expected[key], key) + + content, metadata = readers.read_file( + _filename('2012-11-29_rst_w_filename_meta#foo-bar.rst'), + settings={ + 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2})_' \ + '_(?P.*)' \ + '#(?P.*)-(?P.*)' + }) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'title': 'Rst with filename metadata', + 'date': datetime.datetime(2012, 11, 29), + 'slug': 'article_with_filename_metadata', + 'mymeta': 'foo', + } + for key, value in metadata.items(): + self.assertEquals(value, expected[key], key) + def test_article_metadata_key_lowercase(self): """Keys of metadata should be lowercase.""" reader = readers.RstReader({}) @@ -80,6 +124,13 @@ class MdReaderTest(unittest.TestCase): self.assertEqual(content, expected) + expected = { + 'category': 'test', + 'title': 'Test md File', + } + for key, value in metadata.items(): + self.assertEquals(value, expected[key], key) + @unittest.skipUnless(readers.Markdown, "markdown isn't installed") def test_article_with_mkd_extension(self): # test to ensure the mkd extension is being processed by the correct reader @@ -110,6 +161,48 @@ class MdReaderTest(unittest.TestCase): self.assertEqual(content, expected) + @unittest.skipUnless(readers.Markdown, "markdown isn't installed") + def test_article_with_filename_metadata(self): + content, metadata = readers.read_file( + _filename('2012-11-30_md_w_filename_meta#foo-bar.md'), + settings={}) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + } + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + + content, metadata = readers.read_file( + _filename('2012-11-30_md_w_filename_meta#foo-bar.md'), + settings={ + 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2}).*' + }) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'date': datetime.datetime(2012, 11, 30), + } + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + + content, metadata = readers.read_file( + _filename('2012-11-30_md_w_filename_meta#foo-bar.md'), + settings={ + 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2})' + '_(?P.*)' + '#(?P.*)-(?P.*)' + }) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'date': datetime.datetime(2012, 11, 30), + 'slug': 'md_w_filename_meta', + 'mymeta': 'foo', + } + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + class AdReaderTest(unittest.TestCase): @unittest.skipUnless(readers.asciidoc, "asciidoc isn't installed") From 92b9ccb08a077675984986c4f36fedf73c0e803b Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 01:29:11 +0100 Subject: [PATCH 296/359] fix failing TestArticlesGenerator.test_generate_context test new file have been added to the content directory so articles_expected needs to be updated --- tests/test_generators.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_generators.py b/tests/test_generators.py index 7abaf687..90b19227 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -73,6 +73,7 @@ class TestArticlesGenerator(unittest.TestCase): [u'Article title', 'published', 'Default', 'article'], [u'Article with template', 'published', 'Default', 'custom'], [u'Test md File', 'published', 'test', 'article'], + [u'Rst with filename metadata', 'published', u'yeah', 'article'], [u'Test Markdown extensions', 'published', u'Default', 'article'], [u'This is a super article !', 'published', 'Yeah', 'article'], [u'This is an article with category !', 'published', 'yeah', 'article'], From fc13ae8e7605db6cac1f3e7dfac5aa9777d088b0 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 01:48:28 +0100 Subject: [PATCH 297/359] add new file to functional test content to showcase FILENAME_METADATA and update functional tests output --- .../content/2012-11-30_filename-metadata.rst | 4 + tests/output/basic/archives.html | 2 + tests/output/basic/category/misc.html | 40 ++++-- tests/output/basic/feeds/all-en.atom.xml | 3 +- tests/output/basic/feeds/all.atom.xml | 3 +- tests/output/basic/feeds/misc.atom.xml | 3 +- .../basic/filename_metadata-example.html | 66 ++++++++++ tests/output/basic/index.html | 40 ++++-- tests/output/custom/archives.html | 2 + .../custom/author/alexis-metaireau.html | 2 +- .../custom/author/alexis-metaireau2.html | 55 ++++----- .../custom/author/alexis-metaireau3.html | 115 +++++++++++++++++ tests/output/custom/category/misc.html | 43 +++++-- tests/output/custom/feeds/all-en.atom.xml | 3 +- tests/output/custom/feeds/all.atom.xml | 3 +- tests/output/custom/feeds/all.rss.xml | 3 +- tests/output/custom/feeds/misc.atom.xml | 3 +- tests/output/custom/feeds/misc.rss.xml | 3 +- .../custom/filename_metadata-example.html | 116 ++++++++++++++++++ tests/output/custom/index.html | 70 +++++------ tests/output/custom/index2.html | 55 ++++----- tests/output/custom/index3.html | 115 +++++++++++++++++ 22 files changed, 622 insertions(+), 127 deletions(-) create mode 100644 samples/content/2012-11-30_filename-metadata.rst create mode 100644 tests/output/basic/filename_metadata-example.html create mode 100644 tests/output/custom/author/alexis-metaireau3.html create mode 100644 tests/output/custom/filename_metadata-example.html create mode 100644 tests/output/custom/index3.html diff --git a/samples/content/2012-11-30_filename-metadata.rst b/samples/content/2012-11-30_filename-metadata.rst new file mode 100644 index 00000000..b048103d --- /dev/null +++ b/samples/content/2012-11-30_filename-metadata.rst @@ -0,0 +1,4 @@ +FILENAME_METADATA example +######################### + +Some cool stuff! diff --git a/tests/output/basic/archives.html b/tests/output/basic/archives.html index 0bccff9b..cb06dfa1 100644 --- a/tests/output/basic/archives.html +++ b/tests/output/basic/archives.html @@ -33,6 +33,8 @@

      Archives for A Pelican Blog

      +
      Fri 30 November 2012
      +
      FILENAME_METADATA example
      Wed 29 February 2012
      Second article
      Wed 20 April 2011
      diff --git a/tests/output/basic/category/misc.html b/tests/output/basic/category/misc.html index 86cf5470..2d62b852 100644 --- a/tests/output/basic/category/misc.html +++ b/tests/output/basic/category/misc.html @@ -34,8 +34,32 @@ +
      +

      Other articles

      +
      +
        + + + +
      1. +
        +

        Second article

        +
        + +
        +
        Wed 29 February 2012 @@ -44,14 +68,12 @@

        tags: foobarbaz

        Translations: fr -

        This is some article, in english

        -
        - -
        -

        Other articles

        -
        -
          - +

      This is some article, in english

      + + read more +
    + +
  • diff --git a/tests/output/basic/feeds/all-en.atom.xml b/tests/output/basic/feeds/all-en.atom.xml index fc05c4b3..54c87905 100644 --- a/tests/output/basic/feeds/all-en.atom.xml +++ b/tests/output/basic/feeds/all-en.atom.xml @@ -1,5 +1,6 @@ -A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> +A Pelican Blog/2012-11-30T00:00:00ZFILENAME_METADATA example2012-11-30T00:00:00Ztag:,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Second article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> A markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> <p><a href="/unbelievable.html">a root-relative link to unbelievable</a> <a href="/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> diff --git a/tests/output/basic/feeds/all.atom.xml b/tests/output/basic/feeds/all.atom.xml index f3a1a6f4..3081adc6 100644 --- a/tests/output/basic/feeds/all.atom.xml +++ b/tests/output/basic/feeds/all.atom.xml @@ -1,5 +1,6 @@ -A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> +A Pelican Blog/2012-11-30T00:00:00ZFILENAME_METADATA example2012-11-30T00:00:00Ztag:,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Second article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> Deuxième article2012-02-29T00:00:00Ztag:,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> A markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> <p><a href="/unbelievable.html">a root-relative link to unbelievable</a> diff --git a/tests/output/basic/feeds/misc.atom.xml b/tests/output/basic/feeds/misc.atom.xml index 40ad44c5..e71bd151 100644 --- a/tests/output/basic/feeds/misc.atom.xml +++ b/tests/output/basic/feeds/misc.atom.xml @@ -1,5 +1,6 @@ -A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> +A Pelican Blog/2012-11-30T00:00:00ZFILENAME_METADATA example2012-11-30T00:00:00Ztag:,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Second article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> diff --git a/tests/output/basic/filename_metadata-example.html b/tests/output/basic/filename_metadata-example.html new file mode 100644 index 00000000..b7ae95a7 --- /dev/null +++ b/tests/output/basic/filename_metadata-example.html @@ -0,0 +1,66 @@ + + + + FILENAME_METADATA example + + + + + + + + + + + + + + +
    + +
    +
    +
    + + + + + \ No newline at end of file diff --git a/tests/output/basic/index.html b/tests/output/basic/index.html index 97bb5256..488d1b08 100644 --- a/tests/output/basic/index.html +++ b/tests/output/basic/index.html @@ -34,8 +34,32 @@ +
    +

    Other articles

    +
    +
      + + + +
    1. +
      +

      Second article

      +
      + +
      +
      Wed 29 February 2012 @@ -44,14 +68,12 @@

      tags: foobarbaz

      Translations: fr -

      This is some article, in english

      -
      - -
      -

      Other articles

      -
      -
        - +

        This is some article, in english

        + + read more + +
  • +
  • diff --git a/tests/output/custom/archives.html b/tests/output/custom/archives.html index 44bc876e..632387a4 100644 --- a/tests/output/custom/archives.html +++ b/tests/output/custom/archives.html @@ -37,6 +37,8 @@

    Archives for Alexis' log

    +
    Fri 30 November 2012
    +
    FILENAME_METADATA example
    Wed 29 February 2012
    Second article
    Wed 20 April 2011
    diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index eb39ae57..8bb0dd1c 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -134,7 +134,7 @@
  • - Page 1 / 2 + Page 1 / 3 »

    diff --git a/tests/output/custom/author/alexis-metaireau2.html b/tests/output/custom/author/alexis-metaireau2.html index a87c85af..59926d8c 100644 --- a/tests/output/custom/author/alexis-metaireau2.html +++ b/tests/output/custom/author/alexis-metaireau2.html @@ -39,6 +39,31 @@
      +
    1. + + +
    2. - - - -

    « - Page 2 / 2 + Page 2 / 3 + »

    diff --git a/tests/output/custom/author/alexis-metaireau3.html b/tests/output/custom/author/alexis-metaireau3.html new file mode 100644 index 00000000..5f2ecbb1 --- /dev/null +++ b/tests/output/custom/author/alexis-metaireau3.html @@ -0,0 +1,115 @@ + + + + Alexis' log - Alexis Métaireau + + + + + + + + + + + + + + + +Fork me on GitHub + + + + + + +
    +
      +
    1. +
    +

    + « + Page 3 / 3 +

    +
    +
    +
    +

    blogroll

    + +
    + +
    + + + + + + \ No newline at end of file diff --git a/tests/output/custom/category/misc.html b/tests/output/custom/category/misc.html index 24a53791..33acbd70 100644 --- a/tests/output/custom/category/misc.html +++ b/tests/output/custom/category/misc.html @@ -38,8 +38,35 @@ +
    +

    Other articles

    +
    +
      + + + +
    1. - -
      -

      Other articles

      -
      -
        - +

        This is some article, in english

        + + read more +

        There are comments.

        + +
      1. diff --git a/tests/output/custom/feeds/all-en.atom.xml b/tests/output/custom/feeds/all-en.atom.xml index f8eb3219..5c8f9241 100644 --- a/tests/output/custom/feeds/all-en.atom.xml +++ b/tests/output/custom/feeds/all-en.atom.xml @@ -1,5 +1,6 @@ -Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +Alexis' loghttp://blog.notmyidea.org/2012-11-30T00:00:00+01:00FILENAME_METADATA example2012-11-30T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> <p><a href="http://blog.notmyidea.org/unbelievable.html">a root-relative link to unbelievable</a> <a href="http://blog.notmyidea.org/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> diff --git a/tests/output/custom/feeds/all.atom.xml b/tests/output/custom/feeds/all.atom.xml index b009d135..ae5fe30c 100644 --- a/tests/output/custom/feeds/all.atom.xml +++ b/tests/output/custom/feeds/all.atom.xml @@ -1,5 +1,6 @@ -Alexis' loghttp://blog.notmyidea.org/2012-03-02T14:01:01+01:00Trop bien !2012-03-02T14:01:01+01:00Alexis Métaireautag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> +Alexis' loghttp://blog.notmyidea.org/2012-11-30T00:00:00+01:00FILENAME_METADATA example2012-11-30T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Trop bien !2012-03-02T14:01:01+01:00Alexis Métaireautag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> Deuxième article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> diff --git a/tests/output/custom/feeds/all.rss.xml b/tests/output/custom/feeds/all.rss.xml index 786cb097..0ce2c837 100644 --- a/tests/output/custom/feeds/all.rss.xml +++ b/tests/output/custom/feeds/all.rss.xml @@ -1,5 +1,6 @@ -Alexis' loghttp://blog.notmyidea.org/Fri, 02 Mar 2012 14:01:01 +0100Trop bien !http://blog.notmyidea.org/oh-yeah-fr.html<p>Et voila du contenu en français</p> +Alexis' loghttp://blog.notmyidea.org/Fri, 30 Nov 2012 00:00:00 +0100FILENAME_METADATA examplehttp://blog.notmyidea.org/filename_metadata-example.html<p>Some cool stuff!</p> +Alexis MétaireauFri, 30 Nov 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-11-30:filename_metadata-example.htmlTrop bien !http://blog.notmyidea.org/oh-yeah-fr.html<p>Et voila du contenu en français</p> Alexis MétaireauFri, 02 Mar 2012 14:01:01 +0100tag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.htmlSecond articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazDeuxième articlehttp://blog.notmyidea.org/second-article-fr.html<p>Ceci est un article, en français.</p> Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article-fr.htmlfoobarbazA markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p> diff --git a/tests/output/custom/feeds/misc.atom.xml b/tests/output/custom/feeds/misc.atom.xml index dbf8bbfd..45c996f3 100644 --- a/tests/output/custom/feeds/misc.atom.xml +++ b/tests/output/custom/feeds/misc.atom.xml @@ -1,5 +1,6 @@ -Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +Alexis' loghttp://blog.notmyidea.org/2012-11-30T00:00:00+01:00FILENAME_METADATA example2012-11-30T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> diff --git a/tests/output/custom/feeds/misc.rss.xml b/tests/output/custom/feeds/misc.rss.xml index bbc5a48e..a0fa290d 100644 --- a/tests/output/custom/feeds/misc.rss.xml +++ b/tests/output/custom/feeds/misc.rss.xml @@ -1,5 +1,6 @@ -Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> +Alexis' loghttp://blog.notmyidea.org/Fri, 30 Nov 2012 00:00:00 +0100FILENAME_METADATA examplehttp://blog.notmyidea.org/filename_metadata-example.html<p>Some cool stuff!</p> +Alexis MétaireauFri, 30 Nov 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-11-30:filename_metadata-example.htmlSecond articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> diff --git a/tests/output/custom/filename_metadata-example.html b/tests/output/custom/filename_metadata-example.html new file mode 100644 index 00000000..8f6353cb --- /dev/null +++ b/tests/output/custom/filename_metadata-example.html @@ -0,0 +1,116 @@ + + + + FILENAME_METADATA example + + + + + + + + + + + + + + + +Fork me on GitHub + + +
        +
        +
        +

        + FILENAME_METADATA example

        +
        + +
        +

        Some cool stuff!

        + +
        +
        +

        Comments !

        +
        + +
        + +
        +
        +
        +
        +

        blogroll

        + +
        + +
        + + + + + + \ No newline at end of file diff --git a/tests/output/custom/index.html b/tests/output/custom/index.html index eab96fa1..cc905735 100644 --- a/tests/output/custom/index.html +++ b/tests/output/custom/index.html @@ -38,8 +38,35 @@ +
        +

        Other articles

        +
        +
          + + + +
        1. - -
          -

          Other articles

          -
          -
            - +

            This is some article, in english

            + + read more +

            There are comments.

            +
      2. +
      3. - - - -

      - Page 1 / 2 + Page 1 / 3 »

      diff --git a/tests/output/custom/index2.html b/tests/output/custom/index2.html index 5269ed70..f0d2f948 100644 --- a/tests/output/custom/index2.html +++ b/tests/output/custom/index2.html @@ -39,6 +39,31 @@
        +
      1. + + +
      2. - - - -

      « - Page 2 / 2 + Page 2 / 3 + »

      diff --git a/tests/output/custom/index3.html b/tests/output/custom/index3.html new file mode 100644 index 00000000..60f8633d --- /dev/null +++ b/tests/output/custom/index3.html @@ -0,0 +1,115 @@ + + + + Alexis' log + + + + + + + + + + + + + + + +Fork me on GitHub + + + + + + +
      +
        +
      1. +
      +

      + « + Page 3 / 3 +

      +
      +
      +
      +

      blogroll

      + +
      + +
      + + + + + + \ No newline at end of file From 070fa1ff9dcb7603e0c555168f27bb057694a6b2 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 02:19:38 +0100 Subject: [PATCH 298/359] add more docs about FILENAME_METADATA --- docs/changelog.rst | 2 ++ docs/getting_started.rst | 29 ++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index f25ee3d9..ab3a4233 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -25,6 +25,8 @@ Release history file within the same directory as the original file to prevent the server (e.g. Nginx) from compressing files during an HTTP call. * Add AsciiDoc support +* Add ``FILENAME_METADATA`` new setting which adds support for metadata + extraction from the filename. 3.0 (2012-08-08) ================== diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 73378fc4..6be7fbb2 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -181,15 +181,26 @@ syntax for Markdown posts should follow this pattern:: This is the content of my super blog post. -Note that, aside from the title, none of this metadata is mandatory: if the date -is not specified, Pelican will rely on the file's "mtime" timestamp, and the -category can be determined by the directory in which the file resides. For -example, a file located at ``python/foobar/myfoobar.rst`` will have a category of -``foobar``. If you would like to organize your files in other ways where the -name of the subfolder would not be a good category name, you can set the -setting ``USE_FOLDER_AS_CATEGORY`` to ``False``. If summary isn't given, setting -``SUMMARY_MAX_LENGTH`` determines how many words from the beginning of an article -are used as the summary. +Note that, aside from the title, none of this metadata is mandatory: if the +date is not specified, Pelican can rely on the file's "mtime" timestamp through +the ``DEFAULT_DATE`` setting, and the category can be determined by the +directory in which the file resides. For example, a file located at +``python/foobar/myfoobar.rst`` will have a category of ``foobar``. If you would +like to organize your files in other ways where the name of the subfolder would +not be a good category name, you can set the setting ``USE_FOLDER_AS_CATEGORY`` +to ``False``. If summary isn't given, setting ``SUMMARY_MAX_LENGTH`` determines +how many words from the beginning of an article are used as the summary. + +You can also extract any metadata from the filename through a regexp to be set +in the ``FILENAME_METADATA`` setting. +All named groups that are matched will be set in the metadata object. The +default value for the ``FILENAME_METADATA`` setting will only extract the date +from the filename. For example, if you would like to extract both the date and +the slug, you could set something like: +``'(?P\d{4}-\d{2}-\d{2})_(?.*)'``. + +Please note that the metadata available inside your files takes precedence over +the metadata extracted from the filename. Generate your blog ------------------ From f86e1128f0b535efc8e20f1da2d1c045991051b7 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 09:48:30 +0100 Subject: [PATCH 299/359] docfix: fix example of FILENAME_METADATA regexp --- docs/getting_started.rst | 2 +- docs/settings.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 6be7fbb2..b0b5bf92 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -197,7 +197,7 @@ All named groups that are matched will be set in the metadata object. The default value for the ``FILENAME_METADATA`` setting will only extract the date from the filename. For example, if you would like to extract both the date and the slug, you could set something like: -``'(?P\d{4}-\d{2}-\d{2})_(?.*)'``. +``'(?P\d{4}-\d{2}-\d{2})_(?P.*)'``. Please note that the metadata available inside your files takes precedence over the metadata extracted from the filename. diff --git a/docs/settings.rst b/docs/settings.rst index 2ce44dfb..fc019757 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -59,7 +59,7 @@ Setting name (default value) What doe the filename. For example, if you would like to extract both the date and the slug, you could set something like: - ``'(?P\d{4}-\d{2}-\d{2})_(?.*)'``. + ``'(?P\d{4}-\d{2}-\d{2})_(?P.*)'``. `DELETE_OUTPUT_DIRECTORY` (``False``) Delete the content of the output directory before generating new files. `FILES_TO_COPY` (``()``) A list of files (or directories) to copy from the source (inside the From 6236e8f66ba262731563599ecfdc5be0a2d7addf Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 3 Dec 2012 12:59:31 -0800 Subject: [PATCH 300/359] Updated changelog to include recent changes --- docs/changelog.rst | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index ab3a4233..a68ed53d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,28 +5,31 @@ Release history ================ * Improve handling of links to intra-site resources -* Ensure WordPress import adds paragraphs in for all types of line endings - in post content. +* Ensure WordPress import adds paragraphs for all types of line endings + in post content * Decode HTML entities within WordPress post titles on import -* Improved appearance of LinkedIn icon in default theme +* Improve appearance of LinkedIn icon in default theme * Add GitHub and Google+ social icons support in default theme * Optimize social icons * Add ``FEED_ALL_ATOM`` and ``FEED_ALL_RSS`` to generate feeds containing all posts regardless of their language * Split ``TRANSLATION_FEED`` into ``TRANSLATION_FEED_ATOM`` and ``TRANSLATION_FEED_RSS`` -* The different feeds can now be enabled/disabled individually +* Different feeds can now be enabled/disabled individually * Allow for blank author: if ``AUTHOR`` setting is not set, author won't - default to ``${USER}`` anymore and a post won't contain any author - information if the post author is empty. -* LESS and Webassets support removed from Pelican core in favor of a Webassets - plugin. -* The ``DEFAULT_DATE`` setting now defaults to None, which means that articles - won't be generated anymore unless a date metadata is specified. -* Add the gzip_cache plugin which compresses common text files into a ``.gz`` - file within the same directory as the original file to prevent the server - (e.g. Nginx) from compressing files during an HTTP call. -* Add AsciiDoc support -* Add ``FILENAME_METADATA`` new setting which adds support for metadata - extraction from the filename. + default to ``${USER}`` anymore, and a post won't contain any author + information if the post author is empty +* Move LESS and Webassets support from Pelican core to plugin +* The ``DEFAULT_DATE`` setting now defaults to ``None``, which means that + articles won't be generated unless date metadata is specified +* Add ``FILENAME_METADATA`` setting to support metadata extraction from filename +* Add ``gzip_cache`` plugin to compress common text files into a ``.gz`` + file within the same directory as the original file, preventing the server + (e.g. Nginx) from having to compress files during an HTTP call +* Add support for AsciiDoc-formatted content +* Add ``USE_FOLDER_AS_CATEGORY`` setting so that feature can be toggled on/off +* Support arbitrary Jinja template files +* Restore basic functional tests +* New signals: ``generator_init``, ``get_generators``, and + ``article_generate_preread`` 3.0 (2012-08-08) ================== From 8bb86d3e5d5e7fa6b95e6143c35a37c559c460f8 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Mon, 3 Dec 2012 22:35:08 +0100 Subject: [PATCH 301/359] revert #523 we don't need a new MARKDOWN_EXTENSIONS setting because the equivalent setting MD_EXTENSIONS already exists. --- docs/fr/configuration.rst | 3 --- docs/settings.rst | 2 -- pelican/readers.py | 7 +------ pelican/settings.py | 1 - tests/test_readers.py | 6 +++--- 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/docs/fr/configuration.rst b/docs/fr/configuration.rst index e3fb8542..5388dae3 100644 --- a/docs/fr/configuration.rst +++ b/docs/fr/configuration.rst @@ -163,6 +163,3 @@ SITEURL : STATIC_PATHS : Les chemins statiques que vous voulez avoir accès sur le chemin de sortie "statique" ; - -MARKDOWN_EXTENSIONS : - Liste des extentions Markdown que vous souhaitez utiliser ; diff --git a/docs/settings.rst b/docs/settings.rst index fc019757..f629a4d6 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -129,8 +129,6 @@ Setting name (default value) What doe Can be used to separate templates from the theme. Example: projects, resume, profile ... This templates need to use ``DIRECT_TEMPLATES`` setting - -`MARKDOWN_EXTENSIONS` (``['toc',]``) A list of any Markdown extensions you want to use. `ASCIIDOC_OPTIONS` (``[]``) A list of options to pass to asciidoc, see the `manpage `_ ===================================================================== ===================================================================== diff --git a/pelican/readers.py b/pelican/readers.py index 74cec02f..4dc041ae 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -136,13 +136,8 @@ class MarkdownReader(Reader): def read(self, filename): """Parse content and metadata of markdown files""" - markdown_extensions = self.settings.get('MARKDOWN_EXTENSIONS', []) - if isinstance(markdown_extensions, (str, unicode)): - markdown_extensions = [m.strip() for m in - markdown_extensions.split(',')] text = pelican_open(filename) - md = Markdown(extensions=set( - self.extensions + markdown_extensions + ['meta'])) + md = Markdown(extensions=set(self.extensions + ['meta'])) content = md.convert(text) metadata = {} diff --git a/pelican/settings.py b/pelican/settings.py index a98f3538..692fc983 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -78,7 +78,6 @@ _DEFAULT_CONFIG = {'PATH': '.', 'TYPOGRIFY': False, 'SUMMARY_MAX_LENGTH': 50, 'PLUGINS': [], - 'MARKDOWN_EXTENSIONS': ['toc', ], 'TEMPLATE_PAGES': {} } diff --git a/tests/test_readers.py b/tests/test_readers.py index dcfee809..937a98e3 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -145,9 +145,9 @@ class MdReaderTest(unittest.TestCase): @unittest.skipUnless(readers.Markdown, "markdown isn't installed") def test_article_with_markdown_markup_extension(self): # test to ensure the markdown markup extension is being processed as expected - reader = readers.MarkdownReader({}) - reader.settings.update(dict(MARKDOWN_EXTENSIONS=['toc', ])) - content, metadata = reader.read(_filename('article_with_markdown_markup_extensions.md')) + content, metadata = readers.read_file( + _filename('article_with_markdown_markup_extensions.md'), + settings={'MD_EXTENSIONS': ['toc', 'codehilite', 'extra']}) expected = '
      \n'\ '
        \n'\ '
      • Level1
          \n'\ From f604cc4df88e0c3e1e1ddb91aa1df2b0b6f21af5 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Mon, 3 Dec 2012 22:56:05 +0100 Subject: [PATCH 302/359] update functional tests to test TEMPLATE_PAGES feature closes #614: cannot reproduce this issue. --- samples/content/pages/jinja2_template.html | 6 ++ samples/pelican.conf.py | 3 + tests/output/custom/jinja2_template.html | 82 ++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 samples/content/pages/jinja2_template.html create mode 100644 tests/output/custom/jinja2_template.html diff --git a/samples/content/pages/jinja2_template.html b/samples/content/pages/jinja2_template.html new file mode 100644 index 00000000..1b0dc4e4 --- /dev/null +++ b/samples/content/pages/jinja2_template.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} +{% block content %} + +Some text + +{% endblock %} diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py index ce51c0fd..0ac4cd2c 100755 --- a/samples/pelican.conf.py +++ b/samples/pelican.conf.py @@ -35,6 +35,9 @@ STATIC_PATHS = ["pictures", ] # A list of files to copy from the source to the destination FILES_TO_COPY = (('extra/robots.txt', 'robots.txt'),) +# custom page generated with a jinja2 template +TEMPLATE_PAGES = {'pages/jinja2_template.html': 'jinja2_template.html'} + # foobar will not be used, because it's not in caps. All configuration keys # have to be in caps foobar = "barbaz" diff --git a/tests/output/custom/jinja2_template.html b/tests/output/custom/jinja2_template.html new file mode 100644 index 00000000..2def2d4e --- /dev/null +++ b/tests/output/custom/jinja2_template.html @@ -0,0 +1,82 @@ + + + + Alexis' log + + + + + + + + + + + + + + + +Fork me on GitHub + + + +Some text + +
          +
          +

          blogroll

          + +
          + +
          + + + + + + \ No newline at end of file From 21e808782268cdfafe4f05a3d10152b86778d4eb Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Tue, 4 Dec 2012 00:48:29 +0100 Subject: [PATCH 303/359] fix weird implementation for extension removal this leads to raising exception when slug was not used to generate the url --- pelican/contents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/contents.py b/pelican/contents.py index 522892ba..d675a2ad 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -277,7 +277,7 @@ class URLWrapper(object): return value else: if get_page_name: - return unicode(value[:value.find('{slug}') + len('{slug}')]).format(**self.as_dict()) + return unicode(os.path.splitext(value)[0]).format(**self.as_dict()) else: return unicode(value).format(**self.as_dict()) From 89fd11d5829de860f78a836ff57e9104093115f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 4 Dec 2012 01:21:57 +0100 Subject: [PATCH 304/359] tagging 3.1 --- docs/changelog.rst | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index a68ed53d..7c0675f9 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,7 +1,7 @@ Release history ############### -3.1 (XXXX-XX-XX) +3.1 (2012-12-04) ================ * Improve handling of links to intra-site resources @@ -32,7 +32,7 @@ Release history ``article_generate_preread`` 3.0 (2012-08-08) -================== +================ * Refactored the way URLs are handled * Improved the English documentation diff --git a/setup.py b/setup.py index 97c8ca64..26121423 100755 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ setup( version="3.1", url='http://getpelican.com/', author='Alexis Metaireau', - author_email='alexis@notmyidea.org', + author_email='authors@getpelican.com', description="A tool to generate a static blog from reStructuredText or "\ "Markdown input files.", long_description=open('README.rst').read(), From be2a3f4030e9f5f1f4b2f6d657c9f18347d6af9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 4 Dec 2012 01:27:16 +0100 Subject: [PATCH 305/359] bump version number --- docs/changelog.rst | 5 +++++ pelican/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 7c0675f9..05454e17 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,11 @@ Release history ############### +3.2 (XXXX-XX-XX) +================ + +* ??? + 3.1 (2012-12-04) ================ diff --git a/pelican/__init__.py b/pelican/__init__.py index a175e2a8..6a7ee708 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -17,7 +17,7 @@ from pelican.utils import (clean_output_dir, files_changed, file_changed, from pelican.writers import Writer __major__ = 3 -__minor__ = 0 +__minor__ = 2 __version__ = "{0}.{1}".format(__major__, __minor__) diff --git a/setup.py b/setup.py index 26121423..326a3195 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ entry_points = { setup( name="pelican", - version="3.1", + version="3.2", url='http://getpelican.com/', author='Alexis Metaireau', author_email='authors@getpelican.com', From a07b56c02bfa5ddac8de359e215d9571ee2ba96c Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 3 Dec 2012 16:31:55 -0800 Subject: [PATCH 306/359] Doc fixes and improvements --- docs/faq.rst | 36 ++++++++-------- docs/getting_started.rst | 50 ++++++++++++----------- docs/index.rst | 2 +- docs/plugins.rst | 88 ++++++++++++++++++++-------------------- docs/settings.rst | 75 ++++++++++++++++------------------ 5 files changed, 127 insertions(+), 124 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index 735fe9d0..a8617b30 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -1,7 +1,7 @@ Frequently Asked Questions (FAQ) ################################ -Here is a summary of the frequently asked questions for Pelican. +Here are some frequently asked questions about Pelican. What's the best way to communicate a problem, question, or suggestion? ====================================================================== @@ -21,7 +21,8 @@ How can I help? ================ There are several ways to help out. First, you can use Pelican and report any -suggestions or problems you might have via IRC or the `issue tracker `_. +suggestions or problems you might have via IRC or the `issue tracker +`_. If you want to contribute, please fork `the git repository `_, create a new feature branch, make @@ -57,13 +58,14 @@ I want to use Markdown, but I got an error. =========================================== Markdown is not a hard dependency for Pelican, so you will need to explicitly -install it. You can do so by typing:: +install it. You can do so by typing the following, including ``sudo`` if +required:: - $ (sudo) pip install markdown + (sudo) pip install markdown -In case you don't have pip installed, consider installing it via:: +If you don't have pip installed, consider installing the pip installer via:: - $ (sudo) easy_install pip + (sudo) easy_install pip Can I use arbitrary meta-data in my templates? ============================================== @@ -87,15 +89,15 @@ want to have its own template. :template: template_name -Then just make sure to have the template installed in to your theme as -``template_name.html``. +Then just make sure your theme contains the relevant template file (e.g. +``template_name.html``). What if I want to disable feed generation? ========================================== To disable all feed generation, all feed settings should be set to ``None``. -Since other feed settings already defaults to ``None``, you only need to set -the following settings:: +All but two feed settings already default to ``None``, so if you want to disable +all feed generation, you only need to specify the following settings:: FEED_ALL_ATOM = None CATEGORY_FEED_ATOM = None @@ -129,13 +131,13 @@ setting names). Here is an exact list of the renamed setting names:: CATEGORY_FEED -> CATEGORY_FEED_ATOM Starting in 3.1, the new feed ``FEED_ALL_ATOM`` has been introduced: this -feed will aggregate all posts regardless of their language. It is generated to -``'feeds/all.atom.xml'`` by default and ``FEED_ATOM`` now defaults to ``None``. -The following FEED setting has also been renamed:: +feed will aggregate all posts regardless of their language. This setting +generates ``'feeds/all.atom.xml'`` by default and ``FEED_ATOM`` now defaults to +``None``. The following feed setting has also been renamed:: TRANSLATION_FEED -> TRANSLATION_FEED_ATOM -Older 2.x themes that referenced the old setting names may not link properly. -In order to rectify this, please update your theme for compatibility with 3.0+ -by changing the relevant values in your template files. For an example of -complete feed headers and usage please check out the ``simple`` theme. +Older themes that referenced the old setting names may not link properly. +In order to rectify this, please update your theme for compatibility by changing +the relevant values in your template files. For an example of complete feed +headers and usage please check out the ``simple`` theme. diff --git a/docs/getting_started.rst b/docs/getting_started.rst index b0b5bf92..3e527611 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -161,7 +161,7 @@ following syntax (give your file the ``.rst`` extension):: :author: Alexis Metaireau :summary: Short version for index and feeds -Pelican implements an extension of reStructuredText to enable support for the +Pelican implements an extension to reStructuredText to enable support for the ``abbr`` HTML tag. To use it, write something like this in your post:: This will be turned into :abbr:`HTML (HyperText Markup Language)`. @@ -188,16 +188,17 @@ directory in which the file resides. For example, a file located at ``python/foobar/myfoobar.rst`` will have a category of ``foobar``. If you would like to organize your files in other ways where the name of the subfolder would not be a good category name, you can set the setting ``USE_FOLDER_AS_CATEGORY`` -to ``False``. If summary isn't given, setting ``SUMMARY_MAX_LENGTH`` determines -how many words from the beginning of an article are used as the summary. +to ``False``. If there is no summary metadata for a given post, the +``SUMMARY_MAX_LENGTH`` setting can be used to specify how many words from the +beginning of an article are used as the summary. -You can also extract any metadata from the filename through a regexp to be set -in the ``FILENAME_METADATA`` setting. +You can also extract any metadata from the filename through a regular +expression to be set in the ``FILENAME_METADATA`` setting. All named groups that are matched will be set in the metadata object. The default value for the ``FILENAME_METADATA`` setting will only extract the date from the filename. For example, if you would like to extract both the date and the slug, you could set something like: -``'(?P\d{4}-\d{2}-\d{2})_(?P.*)'``. +``'(?P\d{4}-\d{2}-\d{2})_(?P.*)'`` Please note that the metadata available inside your files takes precedence over the metadata extracted from the filename. @@ -205,7 +206,7 @@ the metadata extracted from the filename. Generate your blog ------------------ -The ``make`` shortcut commands mentioned in the ``Kickstart a blog`` section +The ``make`` shortcut commands mentioned in the *Kickstart a blog* section are mostly wrappers around the ``pelican`` command that generates the HTML from the content. The ``pelican`` command can also be run directly:: @@ -231,11 +232,11 @@ run the ``pelican`` command with the ``-r`` or ``--autoreload`` option. Pages ----- -If you create a folder named ``pages``, itself in the content folder, all the +If you create a folder named ``pages`` inside the content folder, all the files in it will be used to generate static pages. -Then, use the ``DISPLAY_PAGES_ON_MENU`` setting, which will add all the pages to -the menu. +Then, use the ``DISPLAY_PAGES_ON_MENU`` setting to add all those pages to +the primary navigation menu. If you want to exclude any pages from being linked to or listed in the menu then add a ``status: hidden`` attribute to its metadata. This is useful for @@ -244,9 +245,13 @@ things like making error pages that fit the generated theme of your site. Linking to internal content --------------------------- -Since Pelican 3.1, you now have the ability to do cross-site linking. +From Pelican 3.1 onwards, it is now possible to specify intra-site links to +files in the *source content* hierarchy instead of files in the *generated* +hierarchy. This makes it easier to link from the current post to other posts +and images that may be sitting alongside the current post (instead of having +to determine where those resources will be placed after site generation). -To link to an internal content, you will have to use the following syntax: +To link to internal content, use the following syntax: ``|filename|path/to/file``. For example, you may want to add links between "article1" and "article2" given @@ -264,20 +269,20 @@ In this example, ``article1.rst`` could look like:: Title: The first article Date: 2012-12-01 - See below cross-site links examples in restructured text. + See below intra-site link examples in reStructuredText format. - `a root-relative link <|filename|/cat/article2.md>`_ - `a file-relative link <|filename|cat/article2.md>`_ + `a link relative to content root <|filename|/cat/article2.md>`_ + `a link relative to current file <|filename|cat/article2.md>`_ and ``article2.md``:: Title: The second article Date: 2012-12-01 - See below cross-site links examples in markdown. + See below intra-site link examples in Markdown format. - [a root-relative link](|filename|/article1.rst) - [a file-relative link](|filename|../article1.rst) + [a link relative to content root](|filename|/article1.rst) + [a link relative to current file](|filename|../article1.rst) .. note:: @@ -334,13 +339,12 @@ then instead ensure that the translated article titles are identical, since the slug will be auto-generated from the article title. Syntax highlighting ---------------------- +------------------- Pelican is able to provide colorized syntax highlighting for your code blocks. -To do so, you have to use the following conventions (you need to put this in -your content files). +To do so, you have to use the following conventions inside your content files. -For RestructuredText, use the code-block directive:: +For reStructuredText, use the code-block directive:: .. code-block:: identifier @@ -373,7 +377,7 @@ anything special to see what's happening with the generated files. You can either use your browser to open the files on your disk:: - $ firefox output/index.html + firefox output/index.html Or run a simple web server using Python:: diff --git a/docs/index.rst b/docs/index.rst index 8206727c..ebe1ace6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,7 +4,7 @@ Pelican Pelican is a static site generator, written in Python_. * Write your weblog entries directly with your editor of choice (vim!) - in reStructuredText_, Markdown_ or AsciiDoc_ + in reStructuredText_, Markdown_, or AsciiDoc_ * Includes a simple CLI tool to (re)generate the weblog * Easy to interface with DVCSes and web hooks * Completely static output is easy to host anywhere diff --git a/docs/plugins.rst b/docs/plugins.rst index c6b18200..6555e647 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -3,25 +3,25 @@ Plugins ####### -Since version 3.0, Pelican manages plugins. Plugins are a way to add features -to Pelican without having to directly hack Pelican code. +Beginning with version 3.0, Pelican supports plugins. Plugins are a way to add +features to Pelican without having to directly modify the Pelican core. -Pelican is shipped with a set of core plugins, but you can easily implement -your own (and this page describes how). +Pelican is shipped with a set of bundled plugins, but you can easily implement +your own. This page describes how to use and create plugins. How to use plugins ================== -To load plugins, you have to specify them in your settings file. You have two -ways to do so. -Either by specifying strings with the path to the callables:: +To load plugins, you have to specify them in your settings file. There are two +ways to do so. The first method is to specify strings with the path to the +callables:: PLUGINS = ['pelican.plugins.gravatar',] -Or by importing them and adding them to the list:: +Alternatively, another method is to import them and add them to the list:: from pelican.plugins import gravatar - PLUGINS = [gravatar, ] + PLUGINS = [gravatar,] If your plugins are not in an importable path, you can specify a ``PLUGIN_PATH`` in the settings:: @@ -33,7 +33,7 @@ How to create plugins ===================== Plugins are based on the concept of signals. Pelican sends signals, and plugins -subscribe to those signals. The list of signals are defined in a following +subscribe to those signals. The list of signals are defined in a subsequent section. The only rule to follow for plugins is to define a ``register`` callable, in @@ -75,13 +75,13 @@ pages_generate_context pages_generator, metadata pages_generator_init pages_generator invoked in the PagesGenerator.__init__ ============================= ============================ =========================================================================== -The list is currently small, don't hesitate to add signals and make a pull +The list is currently small, so don't hesitate to add signals and make a pull request if you need them! .. note:: - The signal ``content_object_init`` can send different type of object as - argument. If you want to register only one type of object then you will + The signal ``content_object_init`` can send a different type of object as + the argument. If you want to register only one type of object then you will need to specify the sender when you are connecting to the signal. :: @@ -122,30 +122,30 @@ Plugin descriptions Asset management ---------------- -This plugin allows you to use the `webassets`_ module to manage assets such as +This plugin allows you to use the `Webassets`_ module to manage assets such as CSS and JS files. The module must first be installed:: pip install webassets -The `webassets` module allows you to perform a number of useful asset management +The Webassets module allows you to perform a number of useful asset management functions, including: -* CSS minifier (`cssmin`, `yuicompressor`, ...) -* CSS compiler (`less`, `sass`, ...) -* JS minifier (`uglifyjs`, `yuicompressor`, `closure`, ...) +* CSS minifier (``cssmin``, ``yuicompressor``, ...) +* CSS compiler (``less``, ``sass``, ...) +* JS minifier (``uglifyjs``, ``yuicompressor``, ``closure``, ...) Others filters include gzip compression, integration of images in CSS via data -URIs, and more. `webassets` can also append a version identifier to your asset +URIs, and more. Webassets can also append a version identifier to your asset URL to convince browsers to download new versions of your assets when you use -far-future expires headers. Please refer to the `webassets documentation`_ for +far-future expires headers. Please refer to the `Webassets documentation`_ for more information. -When using with Pelican, `webassets` is configured to process assets in the -``OUTPUT_PATH/theme`` directory. You can use `webassets` in your templates by -including one or more template tags. The jinja variable ``{{ ASSET_URL }}`` to -use in the templates is configured to be relative to the ``theme/`` url. -Hence, it must be used with the ``{{ SITEURL }}`` variable which allows to -have relative urls. For example... +When used with Pelican, Webassets is configured to process assets in the +``OUTPUT_PATH/theme`` directory. You can use Webassets in your templates by +including one or more template tags. The Jinja variable ``{{ ASSET_URL }}`` can +be used in templates and is relative to the ``theme/`` url. The +``{{ ASSET_URL }}`` variable should be used in conjunction with the +``{{ SITEURL }}`` variable in order to generate URLs properly. For example: .. code-block:: jinja @@ -153,7 +153,7 @@ have relative urls. For example... {% endassets %} -... will produce a minified css file with a version identifier: +... will produce a minified css file with a version identifier that looks like: .. code-block:: html @@ -182,29 +182,29 @@ The above will produce a minified and gzipped JS file: -Pelican's debug mode is propagated to `webassets` to disable asset packaging +Pelican's debug mode is propagated to Webassets to disable asset packaging and instead work with the uncompressed assets. However, this also means that the LESS and SASS files are not compiled. This should be fixed in a future -version of `webassets` (cf. the related `bug report +version of Webassets (cf. the related `bug report `_). -.. _webassets: https://github.com/miracle2k/webassets -.. _webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html +.. _Webassets: https://github.com/miracle2k/webassets +.. _Webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html GitHub activity --------------- -This plugin makes use of the ``feedparser`` library that you'll need to +This plugin makes use of the `feedparser`_ library that you'll need to install. Set the ``GITHUB_ACTIVITY_FEED`` parameter to your GitHub activity feed. -For example, my setting would look like:: +For example, to track Pelican project activity, the setting would be:: - GITHUB_ACTIVITY_FEED = 'https://github.com/kpanic.atom' + GITHUB_ACTIVITY_FEED = 'https://github.com/getpelican.atom' -On the templates side, you just have to iterate over the ``github_activity`` -variable, as in the example:: +On the template side, you just have to iterate over the ``github_activity`` +variable, as in this example:: {% if GITHUB_ACTIVITY_FEED %} {% endif %} - - -``github_activity`` is a list of lists. The first element is the title +``github_activity`` is a list of lists. The first element is the title, and the second element is the raw HTML from GitHub. +.. _feedparser: https://crate.io/packages/feedparser/ + Global license -------------- -This plugin allows you to define a LICENSE setting and adds the contents of that +This plugin allows you to define a ``LICENSE`` setting and adds the contents of that license variable to the article's context, making that variable available to use from within your theme's templates. @@ -235,7 +235,7 @@ Gravatar This plugin assigns the ``author_gravatar`` variable to the Gravatar URL and makes the variable available within the article's context. You can add -AUTHOR_EMAIL to your settings file to define the default author's email +``AUTHOR_EMAIL`` to your settings file to define the default author's email address. Obviously, that email address must be associated with a Gravatar account. @@ -249,7 +249,7 @@ the ``author_gravatar`` variable is added to the article's context. Gzip cache ---------- -Certain web servers (e.g., Nginx) can use a static cache of gzip compressed +Certain web servers (e.g., Nginx) can use a static cache of gzip-compressed files to prevent the server from compressing files during an HTTP call. Since compression occurs at another time, these compressed files can be compressed at a higher compression level for increased optimization. @@ -303,7 +303,7 @@ The sitemap plugin generates plain-text or XML sitemaps. You can use the ``SITEMAP`` variable in your settings file to configure the behavior of the plugin. -The ``SITEMAP`` variable must be a Python dictionary, it can contain three keys: +The ``SITEMAP`` variable must be a Python dictionary and can contain three keys: - ``format``, which sets the output format of the plugin (``xml`` or ``txt``) @@ -336,7 +336,7 @@ default value. The sitemap is saved in ``/sitemap.``. .. note:: - ``priorities`` and ``changefreqs`` are informations for search engines. + ``priorities`` and ``changefreqs`` are information for search engines. They are only used in the XML sitemaps. For more information: diff --git a/docs/settings.rst b/docs/settings.rst index f629a4d6..baf9f60c 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -16,8 +16,8 @@ False, None, etc.), dictionaries, or tuples should *not* be enclosed in quotation marks. All other values (i.e., strings) *must* be enclosed in quotation marks. -Unless otherwise specified, settings that refer to paths can be either absolute or relative to the -configuration file. +Unless otherwise specified, settings that refer to paths can be either absolute +or relative to the configuration file. The settings you define in the configuration file will be passed to the templates, which allows you to use your settings to add site-wide content. @@ -31,12 +31,11 @@ Basic settings Setting name (default value) What does it do? ===================================================================== ===================================================================== `AUTHOR` Default author (put your name) -`DATE_FORMATS` (``{}``) If you do manage multiple languages, you can - set the date formatting here. See "Date format and locales" - section below for details. -`USE_FOLDER_AS_CATEGORY` (``True``) When you don't specify a category in your post metadata and set this - setting to ``True`` and organize your articles in subfolders, the - subfolder will become the category of your post. If set to ``False`` +`DATE_FORMATS` (``{}``) If you manage multiple languages, you can set the date formatting + here. See the "Date format and locales" section below for details. +`USE_FOLDER_AS_CATEGORY` (``True``) When you don't specify a category in your post metadata, set this + setting to ``True``, and organize your articles in subfolders, the + subfolder will become the category of your post. If set to ``False``, ``DEFAULT_CATEGORY`` will be used as a fallback. `DEFAULT_CATEGORY` (``'misc'``) The default category to fall back on. `DEFAULT_DATE_FORMAT` (``'%a %d %B %Y'``) The default date format you want to use. @@ -44,12 +43,12 @@ Setting name (default value) What doe template. Templates may or not honor this setting. `DEFAULT_DATE` (``None``) The default date you want to use. - If 'fs', Pelican will use the file system + If ``fs``, Pelican will use the file system timestamp information (mtime) if it can't get date information from the metadata. - If tuple object, it will instead generate the - default datetime object by passing the tuple to - the datetime.datetime constructor. + If set to a tuple object, the default datetime object will instead + be generated by passing the tuple to the + ``datetime.datetime`` constructor. `DEFAULT_METADATA` (``()``) The default metadata you want to use for all articles and pages. `FILENAME_METADATA` (``'(?P\d{4}-\d{2}-\d{2}).*'``) The regexp that will be used to extract any metadata @@ -83,11 +82,10 @@ Setting name (default value) What doe `PAGE_EXCLUDES` (``()``) A list of directories to exclude when looking for pages. `ARTICLE_DIR` (``''``) Directory to look at for articles, relative to `PATH`. `ARTICLE_EXCLUDES`: (``('pages',)``) A list of directories to exclude when looking for articles. -`PDF_GENERATOR` (``False``) Set to True if you want to have PDF versions - of your documents. You will need to install - `rst2pdf`. +`PDF_GENERATOR` (``False``) Set to ``True`` if you want PDF versions of your documents to be. + generated. You will need to install ``rst2pdf``. `OUTPUT_SOURCES` (``False``) Set to True if you want to copy the articles and pages in their - original format (e.g. Markdown or ReStructeredText) to the + original format (e.g. Markdown or reStructuredText) to the specified OUTPUT_PATH. `OUTPUT_SOURCES_EXTENSION` (``.text``) Controls the extension that will be used by the SourcesGenerator. Defaults to ``.text``. If not a valid string the default value @@ -106,10 +104,10 @@ Setting name (default value) What doe the blog entries. See :ref:`template_pages`. `STATIC_PATHS` (``['images']``) The static paths you want to have accessible on the output path "static". By default, - Pelican will copy the 'images' folder to the + Pelican will copy the "images" folder to the output folder. `TIMEZONE` The timezone used in the date information, to - generate Atom and RSS feeds. See the "timezone" + generate Atom and RSS feeds. See the *Timezone* section below for more info. `TYPOGRIFY` (``False``) If set to True, several typographical improvements will be incorporated into the generated HTML via the `Typogrify @@ -117,19 +115,19 @@ Setting name (default value) What doe library, which can be installed via: ``pip install typogrify`` `DIRECT_TEMPLATES` (``('index', 'tags', 'categories', 'archives')``) List of templates that are used directly to render content. Typically direct templates are used to generate - index pages for collections of content e.g. tags and - category index pages. + index pages for collections of content (e.g. tags and + category index pages). `PAGINATED_DIRECT_TEMPLATES` (``('index',)``) Provides the direct templates that should be paginated. `SUMMARY_MAX_LENGTH` (``50``) When creating a short summary of an article, this will be the default length in words of the text created. This only applies if your content does not otherwise - specify a summary. Setting to None will cause the summary + specify a summary. Setting to ``None`` will cause the summary to be a copy of the original content. -`EXTRA_TEMPLATES_PATHS` (``[]``) A list of paths you want Jinja2 to look for the templates. +`EXTRA_TEMPLATES_PATHS` (``[]``) A list of paths you want Jinja2 to search for templates. Can be used to separate templates from the theme. Example: projects, resume, profile ... - This templates need to use ``DIRECT_TEMPLATES`` setting -`ASCIIDOC_OPTIONS` (``[]``) A list of options to pass to asciidoc, see the `manpage + These templates need to use ``DIRECT_TEMPLATES`` setting. +`ASCIIDOC_OPTIONS` (``[]``) A list of options to pass to AsciiDoc. See the `manpage `_ ===================================================================== ===================================================================== @@ -145,13 +143,13 @@ when testing locally, and absolute URLs are reliable and most useful when publishing. One method of supporting both is to have one Pelican configuration file for local development and another for publishing. To see an example of this type of setup, use the ``pelican-quickstart`` script as described at the top of -the :doc:`Getting Started` page, which will produce two separate +the :doc:`Getting Started ` page, which will produce two separate configuration files for local development and publishing, respectively. You can customize the URLs and locations where files will be saved. The URLs and SAVE_AS variables use Python's format strings. These variables allow you to place -your articles in a location such as '{slug}/index.html' and link to them as -'{slug}' for clean URLs. These settings give you the flexibility to place your +your articles in a location such as ``{slug}/index.html`` and link to them as +``{slug}`` for clean URLs. These settings give you the flexibility to place your articles and pages anywhere you want. .. note:: @@ -175,8 +173,8 @@ Example usage: * ARTICLE_URL = ``'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/'`` * ARTICLE_SAVE_AS = ``'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html'`` -This would save your articles in something like '/posts/2011/Aug/07/sample-post/index.html', -and the URL to this would be '/posts/2011/Aug/07/sample-post/'. +This would save your articles in something like ``/posts/2011/Aug/07/sample-post/index.html``, +and the URL to this would be ``/posts/2011/Aug/07/sample-post/``. ==================================================== ===================================================== Setting name (default value) What does it do? @@ -206,7 +204,7 @@ Setting name (default value) What does it do? .. note:: - When any of `*_SAVE_AS` is set to False, files will not be created. + When any of the `*_SAVE_AS` settings is set to False, files will not be created. Timezone -------- @@ -283,12 +281,12 @@ If you want to generate custom pages besides your blog entries, you can point any Jinja2 template file with a path pointing to the file and the destination path for the generated file. -For instance, if you have a blog with three static pages, for a list of books, -your resume and a contact page, you could have:: +For instance, if you have a blog with three static pages — a list of books, +your resume, and a contact page — you could have:: TEMPLATE_PAGES = {'src/books.html': 'dest/books.html', - 'src/resume.html': 'dest/resume.html', - 'src/contact.html': 'dest/contact.html'} + 'src/resume.html': 'dest/resume.html', + 'src/contact.html': 'dest/contact.html'} Feed settings ============= @@ -326,8 +324,7 @@ Setting name (default value) What does it do? quantity is unrestricted by default. ================================================ ===================================================== -If you don't want to generate some or any of these feeds, set ``None`` to the -variables above. +If you don't want to generate some or any of these feeds, set the above variables to ``None``. .. [2] %s is the name of the category. @@ -399,7 +396,7 @@ N matches `TAG_CLOUD_STEPS` -1). Translations ============ -Pelican offers a way to translate articles. See the Getting Started section for +Pelican offers a way to translate articles. See the :doc:`Getting Started ` section for more information. ===================================================== ===================================================== @@ -467,7 +464,7 @@ Following are example ways to specify your preferred theme:: # Specify a customized theme, via absolute path THEME = "~/projects/mysite/themes/mycustomtheme" -The built-in `notmyidea` theme can make good use of the following settings. Feel +The built-in ``notmyidea`` theme can make good use of the following settings. Feel free to use them in your themes as well. ======================= ======================================================= @@ -496,7 +493,7 @@ Setting name What does it do ? if you want this button to appear. ======================= ======================================================= -In addition, you can use the "wide" version of the `notmyidea` theme by +In addition, you can use the "wide" version of the ``notmyidea`` theme by adding the following to your configuration:: CSS_FILE = "wide.css" From f92c0cb69dad13491f93872af79d3a14ec6a1e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 4 Dec 2012 01:43:19 +0100 Subject: [PATCH 307/359] update the version scheme to support micro versions --- pelican/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 6a7ee708..e2ea7f76 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -18,7 +18,8 @@ from pelican.writers import Writer __major__ = 3 __minor__ = 2 -__version__ = "{0}.{1}".format(__major__, __minor__) +__micro__ = 0 +__version__ = "{0}.{1}.{2}".format(__major__, __minor__, __micro__) logger = logging.getLogger(__name__) From 625afa0621866d1bbc29ade89551b096d4362838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 4 Dec 2012 01:53:52 +0100 Subject: [PATCH 308/359] add the changelog to the text on PyPI --- MANIFEST.in | 2 +- setup.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index bec6d1a3..2f2ea824 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,6 @@ include *.rst global-include *.py recursive-include pelican *.html *.css *png *.in -include LICENSE THANKS +include LICENSE THANKS docs/changelog.rst recursive-include tests * recursive-exclude tests *.pyc diff --git a/setup.py b/setup.py index 326a3195..15ddebd6 100755 --- a/setup.py +++ b/setup.py @@ -18,15 +18,20 @@ entry_points = { ] } + +README = open('README.rst').read() +CHANGELOG = open('docs/changelog.rst').read() + + setup( name="pelican", version="3.2", url='http://getpelican.com/', author='Alexis Metaireau', author_email='authors@getpelican.com', - description="A tool to generate a static blog from reStructuredText or "\ + description="A tool to generate a static blog from reStructuredText or " "Markdown input files.", - long_description=open('README.rst').read(), + long_description=README + '\n' + CHANGELOG, packages=['pelican', 'pelican.tools', 'pelican.plugins'], include_package_data=True, install_requires=requires, From 9f66333d7726513138b9d839b853ba54e8fc308b Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Tue, 4 Dec 2012 02:08:13 +0100 Subject: [PATCH 309/359] fix rst issue --- docs/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 05454e17..ea476ca8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,7 +4,7 @@ Release history 3.2 (XXXX-XX-XX) ================ -* ??? +* [...] 3.1 (2012-12-04) ================ From 694f318614ef6f8ccccf273ecf9ff5cb33ac99c3 Mon Sep 17 00:00:00 2001 From: Roman Skvazh Date: Thu, 6 Dec 2012 21:15:25 +0400 Subject: [PATCH 310/359] Update docs/plugins.rst Change yuicompressor to yui_js and yui_css --- docs/plugins.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 6555e647..d9964287 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -130,9 +130,9 @@ CSS and JS files. The module must first be installed:: The Webassets module allows you to perform a number of useful asset management functions, including: -* CSS minifier (``cssmin``, ``yuicompressor``, ...) +* CSS minifier (``cssmin``, ``yui_css``, ...) * CSS compiler (``less``, ``sass``, ...) -* JS minifier (``uglifyjs``, ``yuicompressor``, ``closure``, ...) +* JS minifier (``uglifyjs``, ``yui_js``, ``closure``, ...) Others filters include gzip compression, integration of images in CSS via data URIs, and more. Webassets can also append a version identifier to your asset From b0ff693839be55e58ff141b08776587ed7d9bf5d Mon Sep 17 00:00:00 2001 From: Trae Blain Date: Fri, 7 Dec 2012 14:40:44 -0600 Subject: [PATCH 311/359] Updated plugins documentation to include actual callable names of each plugin included. --- docs/plugins.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 6555e647..105be574 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -100,16 +100,16 @@ request if you need them! List of plugins =============== -The following plugins are currently included with Pelican under ``pelican.plugins``: +The following plugins are currently included with Pelican: -* `Asset management`_ -* `GitHub activity`_ -* `Global license`_ -* `Gravatar`_ -* `Gzip cache`_ -* `HTML tags for reStructuredText`_ -* `Related posts`_ -* `Sitemap`_ +* `Asset management`_ ``pelican.plugins.assets`` +* `GitHub activity`_ ``pelican.plugins.github_activity`` +* `Global license`_ ``pelican.plugins.global_license`` +* `Gravatar`_ ``pelican.plugins.gravatar`` +* `Gzip cache`_ ``pelican.plugins.gzip_cache`` +* `HTML tags for reStructuredText`_ ``pelican.plugins.html_rst_directive`` +* `Related posts`_ ``pelican.plugins.related_posts`` +* `Sitemap`_ ``pelican.plugins.sitemap`` Ideas for plugins that haven't been written yet: From f79c844855195be990bc8c096b5b174c07708854 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sun, 9 Dec 2012 08:30:17 +0100 Subject: [PATCH 312/359] remote duplicated import statement (thanks @traeblain) --- pelican/readers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pelican/readers.py b/pelican/readers.py index 4dc041ae..61255dee 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -20,7 +20,6 @@ try: asciidoc = True except ImportError: asciidoc = False -import re from pelican.contents import Category, Tag, Author from pelican.utils import get_date, pelican_open From 733e41a6a7a976c29a1f580dc064e599677da54f Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Tue, 11 Dec 2012 00:34:15 -0500 Subject: [PATCH 313/359] Updated markdown reader to parse summary metadata as markup. --- pelican/readers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pelican/readers.py b/pelican/readers.py index 61255dee..4164847d 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -142,7 +142,12 @@ class MarkdownReader(Reader): metadata = {} for name, value in md.Meta.items(): name = name.lower() - metadata[name] = self.process_metadata(name, value[0]) + if name == "summary": + summary_values = "\n".join(str(item) for item in value) + summary = md.convert(summary_values) + metadata[name] = self.process_metadata(name, summary) + else: + metadata[name] = self.process_metadata(name, value[0]) return content, metadata From f66c16bd52ff3e9fe0a9c0833e22f53ede89b531 Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Tue, 11 Dec 2012 00:37:06 -0500 Subject: [PATCH 314/359] Updated unit tests to test markdown summary metadata. --- ...cle_with_markdown_and_summary_metadata_multi.md | 7 +++++++ ...le_with_markdown_and_summary_metadata_single.md | 5 +++++ tests/test_generators.py | 2 ++ tests/test_readers.py | 14 ++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 tests/content/article_with_markdown_and_summary_metadata_multi.md create mode 100644 tests/content/article_with_markdown_and_summary_metadata_single.md diff --git a/tests/content/article_with_markdown_and_summary_metadata_multi.md b/tests/content/article_with_markdown_and_summary_metadata_multi.md new file mode 100644 index 00000000..b6ef666c --- /dev/null +++ b/tests/content/article_with_markdown_and_summary_metadata_multi.md @@ -0,0 +1,7 @@ +Title: Article with markdown and summary metadata multi +Date: 2012-10-31 +Summary: + A multi-line summary should be supported + as well as **inline markup**. + +This is some content. diff --git a/tests/content/article_with_markdown_and_summary_metadata_single.md b/tests/content/article_with_markdown_and_summary_metadata_single.md new file mode 100644 index 00000000..a7d6f09b --- /dev/null +++ b/tests/content/article_with_markdown_and_summary_metadata_single.md @@ -0,0 +1,5 @@ +Title: Article with markdown and summary metadata single +Date: 2012-10-30 +Summary: A single-line summary should be supported as well as **inline markup**. + +This is some content. diff --git a/tests/test_generators.py b/tests/test_generators.py index 90b19227..fb1dbe9c 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -71,6 +71,8 @@ class TestArticlesGenerator(unittest.TestCase): articles = self.distill_articles(generator.articles) articles_expected = [ [u'Article title', 'published', 'Default', 'article'], + [u'Article with markdown and summary metadata single', 'published', u'Default', 'article'], + [u'Article with markdown and summary metadata multi', 'published', u'Default', 'article'], [u'Article with template', 'published', 'Default', 'custom'], [u'Test md File', 'published', 'test', 'article'], [u'Rst with filename metadata', 'published', u'yeah', 'article'], diff --git a/tests/test_readers.py b/tests/test_readers.py index 937a98e3..ae325d62 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -203,6 +203,20 @@ class MdReaderTest(unittest.TestCase): for key, value in expected.items(): self.assertEquals(value, metadata[key], key) + @unittest.skipUnless(readers.Markdown, "markdown isn't installed") + def test_article_with_summary_metadata(self): + reader = readers.MarkdownReader({}) + content, metadata = reader.read( + _filename('article_with_markdown_and_summary_metadata_single.md')) + expected_summary = u'

          A single-line summary should be supported'\ + u' as well as inline markup.

          ' + self.assertEquals(expected_summary, metadata['summary'], 'summary') + content, metadata = reader.read( + _filename('article_with_markdown_and_summary_metadata_multi.md')) + expected_summary = u'

          A multi-line summary should be supported'\ + u'\nas well as inline markup.

          ' + self.assertEquals(expected_summary, metadata['summary'], 'summary') + class AdReaderTest(unittest.TestCase): @unittest.skipUnless(readers.asciidoc, "asciidoc isn't installed") From b35947f7a65c2991cb5ea20d5d16dd094c0d43e2 Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Tue, 11 Dec 2012 00:48:47 -0500 Subject: [PATCH 315/359] Cleaned up markdown read. --- pelican/readers.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index 4164847d..6bd2822d 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -133,21 +133,27 @@ class MarkdownReader(Reader): file_extensions = ['md', 'markdown', 'mkd'] extensions = ['codehilite', 'extra'] + def _parse_metadata(self, meta): + """Return the dict containing document metadata""" + md = Markdown(extensions=set(self.extensions + ['meta'])) + output = {} + for name, value in meta.items(): + name = name.lower() + if name == "summary": + summary_values = "\n".join(str(item) for item in value) + summary = md.convert(summary_values) + output[name] = self.process_metadata(name, summary) + else: + output[name] = self.process_metadata(name, value[0]) + return output + def read(self, filename): """Parse content and metadata of markdown files""" text = pelican_open(filename) md = Markdown(extensions=set(self.extensions + ['meta'])) content = md.convert(text) - metadata = {} - for name, value in md.Meta.items(): - name = name.lower() - if name == "summary": - summary_values = "\n".join(str(item) for item in value) - summary = md.convert(summary_values) - metadata[name] = self.process_metadata(name, summary) - else: - metadata[name] = self.process_metadata(name, value[0]) + metadata = self._parse_metadata(md.Meta) return content, metadata From b4c5d7cf62c21e9f195144704d331dc5f85b5e54 Mon Sep 17 00:00:00 2001 From: David Beitey Date: Wed, 7 Nov 2012 19:14:12 +1000 Subject: [PATCH 316/359] Store slugs in posts by default on Pelican import --- docs/changelog.rst | 2 ++ docs/importer.rst | 31 +++++++++++++++++++++++-------- pelican/tools/pelican_import.py | 27 +++++++++++++++++++-------- tests/test_importer.py | 20 ++++++++++++++++++++ 4 files changed, 64 insertions(+), 16 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index b7c64190..748f5120 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,6 +4,8 @@ Release history 3.1 (XXXX-XX-XX) ================ +* Importer now stores slugs within files by default. This can be disabled with + the ``--disable-slugs`` option. * Improve handling of links to intra-site resources * Ensure WordPress import adds paragraphs in for all types of line endings in post content. diff --git a/docs/importer.rst b/docs/importer.rst index ba96d9c2..ad4e3984 100644 --- a/docs/importer.rst +++ b/docs/importer.rst @@ -39,29 +39,44 @@ Usage """"" | pelican-import [-h] [--wpfile] [--dotclear] [--feed] [-o OUTPUT] -| [-m MARKUP][--dir-cat] +| [-m MARKUP] [--dir-cat] [--strip-raw] [--disable-slugs] | input +Positional arguments +==================== + + input The input file to read + Optional arguments """""""""""""""""" -h, --help show this help message and exit - --wpfile Wordpress XML export - --dotclear Dotclear export - --feed Feed to parse + --wpfile Wordpress XML export (default: False) + --dotclear Dotclear export (default: False) + --feed Feed to parse (default: False) -o OUTPUT, --output OUTPUT - Output path - -m MARKUP Output markup + Output path (default: output) + -m MARKUP, --markup MARKUP + Output markup format (supports rst & markdown) + (default: rst) --dir-cat Put files in directories with categories name + (default: False) + --strip-raw Strip raw HTML code that can't be converted to markup + such as flash embeds or iframes (wordpress import + only) (default: False) + --disable-slugs Disable storing slugs from imported posts within + output. With this disabled, your Pelican URLs may not + be consistent with your original posts. (default: + False) Examples ======== -for WordPress:: +For WordPress:: $ pelican-import --wpfile -o ~/output ~/posts.xml -for Dotclear:: +For Dotclear:: $ pelican-import --dotclear -o ~/output ~/backup.txt diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 053dcffc..fdd1ac51 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -181,7 +181,7 @@ def feed2fields(file): yield (entry.title, entry.description, slug, date, author, [], tags, "html") -def build_header(title, date, author, categories, tags): +def build_header(title, date, author, categories, tags, slug): """Build a header from a list of fields""" header = '%s\n%s\n' % (title, '#' * len(title)) if date: @@ -192,10 +192,12 @@ def build_header(title, date, author, categories, tags): header += ':category: %s\n' % ', '.join(categories) if tags: header += ':tags: %s\n' % ', '.join(tags) + if slug: + header += ':slug: %s\n' % slug header += '\n' return header -def build_markdown_header(title, date, author, categories, tags): +def build_markdown_header(title, date, author, categories, tags, slug): """Build a header from a list of fields""" header = 'Title: %s\n' % title if date: @@ -206,18 +208,21 @@ def build_markdown_header(title, date, author, categories, tags): header += 'Category: %s\n' % ', '.join(categories) if tags: header += 'Tags: %s\n' % ', '.join(tags) + if slug: + header += 'Slug: %s\n' % slug header += '\n' return header -def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=False): +def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=False, disable_slugs=False): for title, content, filename, date, author, categories, tags, in_markup in fields: + slug = not disable_slugs and filename or None if (in_markup == "markdown") or (out_markup == "markdown") : ext = '.md' - header = build_markdown_header(title, date, author, categories, tags) + header = build_markdown_header(title, date, author, categories, tags, slug) else: out_markup = "rst" ext = '.rst' - header = build_header(title, date, author, categories, tags) + header = build_header(title, date, author, categories, tags, slug) filename = os.path.basename(filename) @@ -278,8 +283,8 @@ def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=Fals def main(): parser = argparse.ArgumentParser( - description="Transform feed, Wordpress or Dotclear files to rst files." - "Be sure to have pandoc installed", + description="Transform feed, Wordpress or Dotclear files to reST (rst) " + "or Markdown (md) files. Be sure to have pandoc installed.", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument(dest='input', help='The input file to read') @@ -298,6 +303,11 @@ def main(): parser.add_argument('--strip-raw', action='store_true', dest='strip_raw', help="Strip raw HTML code that can't be converted to " "markup such as flash embeds or iframes (wordpress import only)") + parser.add_argument('--disable-slugs', action='store_true', + dest='disable_slugs', + help='Disable storing slugs from imported posts within output. ' + 'With this disabled, your Pelican URLs may not be consistent ' + 'with your original posts.') args = parser.parse_args() @@ -328,4 +338,5 @@ def main(): fields2pelican(fields, args.markup, args.output, dircat=args.dircat or False, - strip_raw=args.strip_raw or False) + strip_raw=args.strip_raw or False, + disable_slugs=args.disable_slugs or False) diff --git a/tests/test_importer.py b/tests/test_importer.py index 959a556a..449a7643 100644 --- a/tests/test_importer.py +++ b/tests/test_importer.py @@ -48,6 +48,26 @@ class TestWordpressXmlImporter(unittest.TestCase): strip_raw=True)) self.assertFalse(any(' Date: Tue, 18 Dec 2012 12:33:49 +0100 Subject: [PATCH 317/359] update the version of jinja needed, 2.6 is out --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 15ddebd6..b6a54414 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from setuptools import setup -requires = ['feedgenerator', 'jinja2 >= 2.4', 'pygments', 'docutils', 'pytz', +requires = ['feedgenerator', 'jinja2 >= 2.6', 'pygments', 'docutils', 'pytz', 'blinker', 'unidecode'] try: From 30c8825fa23636df8d051628679e40ec06d8bdc9 Mon Sep 17 00:00:00 2001 From: Thanos Lefteris Date: Tue, 25 Dec 2012 23:36:44 +0200 Subject: [PATCH 318/359] Docs update of the pelican core install depedencies --- docs/getting_started.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 3e527611..1c9ea1a3 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -61,17 +61,20 @@ perform the same step to install the most recent version. Dependencies ------------ -At this time, Pelican is dependent on the following Python packages: +At this time, Pelican core is dependent on the following Python packages: * feedgenerator, to generate the Atom feeds * jinja2, for templating support +* pygments, for syntax highlighting * docutils, for supporting reStructuredText as an input format +* pytz, for timezone definitions +* blinker, an object-to-object and broadcast signaling system +* unidecode, for ASCII transliterations of Unicode text If you're not using Python 2.7, you will also need the ``argparse`` package. Optionally: -* pygments, for syntax highlighting * Markdown, for supporting Markdown as an input format * Typogrify, for typographical enhancements From a0b29d980f86985b0181b92cfc803bfdbc7c0a8e Mon Sep 17 00:00:00 2001 From: Thanos Lefteris Date: Tue, 25 Dec 2012 23:59:53 +0200 Subject: [PATCH 319/359] PyPI links for pelican depedencies --- docs/getting_started.rst | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 1c9ea1a3..0952c7d9 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -63,20 +63,26 @@ Dependencies At this time, Pelican core is dependent on the following Python packages: -* feedgenerator, to generate the Atom feeds -* jinja2, for templating support -* pygments, for syntax highlighting -* docutils, for supporting reStructuredText as an input format -* pytz, for timezone definitions -* blinker, an object-to-object and broadcast signaling system -* unidecode, for ASCII transliterations of Unicode text +* `feedgenerator `_, to generate the + Atom feeds +* `jinja2 `_, for templating support +* `pygments `_, for syntax highlighting +* `docutils `_, for supporting + reStructuredText as an input format +* `pytz `_, for timezone definitions +* `blinker `_, an object-to-object and + broadcast signaling system +* `unidecode `_, for ASCII + transliterations of Unicode text If you're not using Python 2.7, you will also need the ``argparse`` package. Optionally: -* Markdown, for supporting Markdown as an input format -* Typogrify, for typographical enhancements +* `markdown `_, for supporting Markdown as + an input format +* `typogrify `_, for typographical + enhancements Kickstart a blog ================ From fcc74be26756f707ab29bd47593006673c29be22 Mon Sep 17 00:00:00 2001 From: "Wraithan (Chris McDonald)" Date: Sat, 29 Dec 2012 09:52:21 -0800 Subject: [PATCH 320/359] pep8/style matching --- pelican/rstdirectives.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pelican/rstdirectives.py b/pelican/rstdirectives.py index b1f1242c..c677144d 100644 --- a/pelican/rstdirectives.py +++ b/pelican/rstdirectives.py @@ -98,15 +98,18 @@ directives.register_directive('youtube', YouTube) _abbr_re = re.compile('\((.*)\)$') -class abbreviation(nodes.Inline, nodes.TextElement): pass + +class abbreviation(nodes.Inline, nodes.TextElement): + pass + def abbr_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): - text = utils.unescape(text) - m = _abbr_re.search(text) - if m is None: - return [abbreviation(text, text)], [] - abbr = text[:m.start()].strip() - expl = m.group(1) - return [abbreviation(abbr, abbr, explanation=expl)], [] + text = utils.unescape(text) + m = _abbr_re.search(text) + if m is None: + return [abbreviation(text, text)], [] + abbr = text[:m.start()].strip() + expl = m.group(1) + return [abbreviation(abbr, abbr, explanation=expl)], [] roles.register_local_role('abbr', abbr_role) From 369bb476e9d71b7e3613466168c45b1e24309d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 1 Jan 2013 00:36:08 +0100 Subject: [PATCH 321/359] Improve Publishing to GitHub section of the doc --- docs/tips.rst | 97 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 32 deletions(-) diff --git a/docs/tips.rst b/docs/tips.rst index abb739b1..64695db0 100644 --- a/docs/tips.rst +++ b/docs/tips.rst @@ -6,47 +6,80 @@ Here are some tips about Pelican that you might find useful. Publishing to GitHub ==================== -GitHub comes with an interesting "pages" feature: you can upload things there -and it will be available directly from their servers. As Pelican is a static -file generator, we can take advantage of this. - -User Pages ----------- -GitHub allows you to create user pages in the form of ``username.github.com``. -Whatever is created in the master branch will be published. For this purpose, -just the output generated by Pelican needs to pushed to GitHub. - -So given a repository containing your articles, just run Pelican over the posts -and deploy the master branch to GitHub:: - - $ pelican -s pelican.conf.py ./path/to/posts -o /path/to/output - -Now add all the files in the output directory generated by Pelican:: - - $ git add /path/to/output/* - $ git commit -am "Your Message" - $ git push origin master +`GitHub Pages `_ offer an easy +and convenient way to publish Pelican sites. There are `two types of GitHub +Pages `_: +*Project Pages* and *User Pages*. Pelican sites can be published as both +Project Pages and User Pages. Project Pages ------------- -For creating Project pages, a branch called ``gh-pages`` is used for publishing. -The excellent `ghp-import `_ makes this -really easy, which can be installed via:: - $ pip install ghp-import +To publish a Pelican site as Project Pages you need to *push* the content of +the ``output`` dir generated by Pelican to a repository's ``gh-pages`` branch +on GitHub. -Then, given a repository containing your articles, you would simply run -Pelican and upload the output to GitHub:: +The excellent `ghp-import `_, which can +be installed with ``easy_install`` or ``pip``, makes this process really easy. - $ pelican -s pelican.conf.py . +For example, if the sources of your Pelican site are contained in a GitHub +repository, and if you want to publish your Pelican site as Project Pages of +this repository, you can then use the following:: + + $ pelican content -o output pelicanconf.py $ ghp-import output $ git push origin gh-pages -And that's it. +The ``ghp-import output`` command updates the local ``gh-pages`` branch with +the content of the ``output`` directory (creating the branch if it doesn't +already exist). The ``git push origin gh-pages`` command updates the remote +``gh-pages`` branch, effectively publishing the Pelican site. -If you want, you can put that directly into a post-commit hook, so each time you -commit, your blog is up-to-date on GitHub! +.. note:: -Put the following into ``.git/hooks/post-commit``:: + The ``github`` target of the Makefile created by the ``pelican-quickstart`` + command publishes the Pelican site as Project Pages as described above. - pelican -s pelican.conf.py . && ghp-import output && git push origin gh-pages +User Pages +---------- + +To publish a Pelican site as User Pages you need to *push* the content of the +``output`` dir generated by Pelican to the ``master`` branch of your +``.github.com`` repository on GitHub. + +Again, you can take advantage of ``ghp-import``:: + + $ pelican content -o output pelicanconf.py + $ ghp-import output + $ git push git@github.com:elemoine/elemoine.github.com.git gh-pages:master + +The ``git push`` command pushes the local ``gh-pages`` branch (freshly updated +by the ``ghp-import`` command) to the ``elemoine.github.com`` repository's +``master`` branch on GitHub. + +.. note:: + + To publish your Pelican site as User Pages feel free to adjust the the + ``github`` target of the Makefile. + +Extra Tips +---------- + +Tip #1: + +To automatically update your Pelican site on each commit you can create +a post-commit hook. For example, you can add the following to +``.git/hooks/post-commit``:: + + pelican pelican content -o output pelicanconf.py && ghp-import output && git push origin gh-pages + +Tip #2: + +To use a `custom domain +`_ with +GitHub Pages you need to have a ``CNAME`` file at the root of your pages. For +that you will add ``CNAME`` file to your ``content``, dir and use the +``FILES_TO_COPY`` setting variable to tell Pelican to copy that file +to the ``output`` dir. For example:: + + FILES_TO_COPY = (('extra/CNAME', 'CNAME'),) From 8cc0da67e1138af0e2bb2c344f6fff3d92004ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Wed, 2 Jan 2013 11:39:37 +0100 Subject: [PATCH 322/359] Fix the THANKS file. --- THANKS | 145 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 127 insertions(+), 18 deletions(-) diff --git a/THANKS b/THANKS index 2a20100e..6d6ee886 100644 --- a/THANKS +++ b/THANKS @@ -1,19 +1,128 @@ -Some people have helped to improve pelican by contributing features, reporting -bugs or giving ideas. Thanks to them ! +Pelican is a project by Alexis Métaireau but there is +a quite big number of people that contributed or implemented key features over +time. We try to keep this list up to date, but you can have a look at the nice +graphs proposed by github about contributors here: +https://github.com/getpelican/pelican/graphs/contributors -- Dan Jacka -- solsTiCe on linuxfr for reporting bugs -- Guillaume B (Gui13) -- Ronny Pfannschmidt -- Jérome Renard -- Nicolas Martin -- David Kulak -- Arnaud Bos -- nblock (Florian) -- Bruno Bord -- Laureline Guérin -- Samuel Martin -- Marcus Fredriksson -- Günter Kolousek -- Simon Liedtke -- Manuel F. Viera +If you want to contibute, check the documentation section about how to do so + + +Aaron Kavlie +Abhishek L +Albrecht Mühlenschulte +Aldiantoro Nugroho +Alen Mujezinovic +Alessandro Martin +Alexander Artemenko +Alexandre RODIERE +Alexis Daboville +Alexis Metaireau +Alexis Métaireau +Allan Whatmough +Andrea Crotti +Andrew Laski +Arnaud BOS +asselinpaul +Borgar +Brandon W Maister +Brendan Wholihan +Brian C. Lane +Brian Hsu +Brian St. Pierre +Bruno Binet +BunnyMan +Chris Streeter +Christophe Chauvet +Clint Howarth +Dafydd Crosby +Dana Woodman +dave mankoff +David Beitey +David Marble +derdon +Dirkjan Ochtman +Dirk Makowski +draftcode +Edward Delaporte +epatters +Eric Case +Erik Hetzner +FELD Boris +Feth Arezki +Feth AREZKI +Florian Jacob +Florian Preinstorfer +Freeculture +Guillaume +Guillaume B +Guillermo López +guillermooo +Ian Cordasco +Iuri de Silvio +James Rowe +jawher +Jerome +Jiachen Yang +Jochen Breuer +joe di castro +Jökull Sólberg Auðunsson +Joshua Adelman +Julian Berman +justinmayer +Justin Mayer +Kyle Fuller +Laureline Guerin +Leonard Huang +Marcel Hellkamp +Marco Milanesi +Marcus Fredriksson +Mario Rodas +Martin Brochhaus +Massimo Santini +Matt Bowcock +Matt Layman +Meir Kriheli +Michael Guntsche +Michael Reneer +Michael Yanovich +Mike Yumatov +Mikhail Korobov +m-r-r +mviera +Nico Di Rocco +Nicolas Duhamel +Nicolas Perriault +Nicolas Steinmetz +Pavel Puchkin +Perry Roper +Philippe Pepiot +Rachid Belaid +Ranjhith Kalisamy +Remi Rampin +Rémy HUBSCHER +renhbo +Roman Skvazh +Ronny Pfannschmidt +Rory McCann +saghul +sam +Samrat Man Singh +Simon +Simon Liedtke +skami +Skami18 +solsTiCe d'Hiver +stephane +Stéphane Bunel +Stéphane Raimbault +Stuart Colville +Tarek Ziade +tBunnyMan +Thanos Lefteris +the Bunny Man +Tobias +Tomi Pieviläinen +Trae Blain +Tshepang Lekhonkhobe +Wladislaw Merezhko +Zoresvit From be040715f984ceee69812c081b901653f8f08e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Wed, 2 Jan 2013 13:46:55 +0100 Subject: [PATCH 323/359] remove duplicates --- THANKS | 6 ------ 1 file changed, 6 deletions(-) diff --git a/THANKS b/THANKS index 6d6ee886..eeaf2309 100644 --- a/THANKS +++ b/THANKS @@ -16,7 +16,6 @@ Alessandro Martin Alexander Artemenko Alexandre RODIERE Alexis Daboville -Alexis Metaireau Alexis Métaireau Allan Whatmough Andrea Crotti @@ -49,7 +48,6 @@ Eric Case Erik Hetzner FELD Boris Feth Arezki -Feth AREZKI Florian Jacob Florian Preinstorfer Freeculture @@ -107,17 +105,13 @@ Rory McCann saghul sam Samrat Man Singh -Simon Simon Liedtke -skami Skami18 solsTiCe d'Hiver -stephane Stéphane Bunel Stéphane Raimbault Stuart Colville Tarek Ziade -tBunnyMan Thanos Lefteris the Bunny Man Tobias From a71465217b4aba4e7585846617ca92923c65f6f4 Mon Sep 17 00:00:00 2001 From: Trae Blain Date: Fri, 21 Dec 2012 17:13:04 -0600 Subject: [PATCH 324/359] Update webassets plugin to allow user to pass configuration settings to Webassets through their settings file. Also removed language about DEBUG not compiling CSS since as of at least webassets 0.8 this is no longer an issue. --- docs/plugins.rst | 17 +++++++++++++---- pelican/plugins/assets.py | 4 ++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 7e09810b..bbeb5930 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -183,10 +183,19 @@ The above will produce a minified and gzipped JS file: Pelican's debug mode is propagated to Webassets to disable asset packaging -and instead work with the uncompressed assets. However, this also means that -the LESS and SASS files are not compiled. This should be fixed in a future -version of Webassets (cf. the related `bug report -`_). +and instead work with the uncompressed assets. + +Many of Webasset's available compilers have additional configuration options +(i.e. 'Less', 'Sass', 'Stylus', 'Closure_js'). You can pass these options to +Webassets using the ``ASSET_CONFIG`` in your settings file. + +The following will handle Google Closure's compilation level and locate +LessCSS's binary: + +.. code-block:: python + + ASSET_CONFIG = (('closure_compressor_optimization', 'WHITESPACE_ONLY'), + ('less_bin', 'lessc.cmd'), ) .. _Webassets: https://github.com/miracle2k/webassets .. _Webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html diff --git a/pelican/plugins/assets.py b/pelican/plugins/assets.py index b5d1cf76..877373f6 100644 --- a/pelican/plugins/assets.py +++ b/pelican/plugins/assets.py @@ -36,6 +36,10 @@ def create_assets_env(generator): assets_src = os.path.join(generator.output_path, 'theme') generator.env.assets_environment = Environment(assets_src, assets_url) + if 'ASSET_CONFIG' in generator.settings: + for item in generator.settings['ASSET_CONFIG']: + generator.env.assets_environment.config[item[0]] = item[1] + logger = logging.getLogger(__name__) if logging.getLevelName(logger.getEffectiveLevel()) == "DEBUG": generator.env.assets_environment.debug = True From 9eb5ad77ef5faa57987aff8322f76abdddffc426 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 3 Jan 2013 12:19:27 -0500 Subject: [PATCH 325/359] settings: Fix abspath existence check for path settings The path to check is `absp`. `p` is the setting name. --- pelican/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/settings.py b/pelican/settings.py index 692fc983..203003a4 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -91,7 +91,7 @@ def read_settings(filename=None, override=None): and not isabs(local_settings[p]): absp = os.path.abspath(os.path.normpath(os.path.join( os.path.dirname(filename), local_settings[p]))) - if p != 'THEME' or os.path.exists(p): + if p != 'THEME' or os.path.exists(absp): local_settings[p] = absp else: local_settings = copy.deepcopy(_DEFAULT_CONFIG) From 88b5a27ddf9f2334108825ef3fbac44868cc5d60 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 3 Jan 2013 18:10:08 -0500 Subject: [PATCH 326/359] contents: Page.url_format should expose all metadata I want to add `directory` metadata to each page in `content/pages/` to place my non-article pages by hand: PAGE_URL = '{directory}/{slug}' PAGE_SAVE_AS = '{directory}/{slug}/index.html' To do this, I need the `directory` metadata for formatting the URL. --- pelican/contents.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index d675a2ad..b986a34e 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -114,14 +114,16 @@ class Page(object): @property def url_format(self): - return { + metadata = copy.copy(self.metadata) + metadata.update({ 'slug': getattr(self, 'slug', ''), 'lang': getattr(self, 'lang', 'en'), 'date': getattr(self, 'date', datetime.now()), 'author': getattr(self, 'author', ''), 'category': getattr(self, 'category', self.settings['DEFAULT_CATEGORY']), - } + }) + return metadata def _expand_settings(self, key): fq_key = ('%s_%s' % (self.__class__.__name__, key)).upper() From 696caac9b0495e29b33c84897c2ecd44e8e7afe0 Mon Sep 17 00:00:00 2001 From: Peter Desmet Date: Mon, 7 Jan 2013 10:49:51 +0100 Subject: [PATCH 327/359] Fixed a typo BeatifulSoup -> Beautiful Soup --- docs/importer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/importer.rst b/docs/importer.rst index ad4e3984..c9fa3be0 100644 --- a/docs/importer.rst +++ b/docs/importer.rst @@ -24,10 +24,10 @@ Dependencies ``pelican-import`` has two dependencies not required by the rest of pelican: -- BeautifulSoup +- Beautiful Soup - pandoc -BeatifulSoup can be installed like any other Python package:: +Beautiful Soup can be installed like any other Python package:: $ pip install BeautifulSoup From 71995d5e1bec6f34ef836e1dc7416e27dd3cfe30 Mon Sep 17 00:00:00 2001 From: Dirk Makowski Date: Fri, 11 Jan 2013 02:57:43 +0100 Subject: [PATCH 328/359] Port pelican to python 3. Stays compatible with 2.x series, thanks to an unified codebase. --- .gitignore | 2 + .travis.yml | 4 +- dev_requirements.txt | 7 +- docs/changelog.rst | 2 +- docs/conf.py | 21 ++-- pelican/__init__.py | 14 ++- pelican/contents.py | 45 ++++--- pelican/generators.py | 36 +++--- pelican/log.py | 36 +++--- pelican/paginator.py | 5 +- pelican/plugins/assets.py | 1 + pelican/plugins/github_activity.py | 1 + pelican/plugins/gzip_cache.py | 2 +- pelican/plugins/html_rst_directive.py | 5 +- pelican/plugins/initialized.py | 4 +- pelican/plugins/related_posts.py | 4 +- pelican/plugins/sitemap.py | 15 ++- pelican/readers.py | 10 +- pelican/rstdirectives.py | 4 +- pelican/server.py | 20 ++++ pelican/settings.py | 16 +-- pelican/signals.py | 2 + pelican/tools/pelican_import.py | 51 +++++--- pelican/tools/pelican_quickstart.py | 82 +++++++------ pelican/tools/pelican_themes.py | 17 +-- pelican/tools/templates/Makefile.in | 2 +- pelican/tools/templates/develop_server.sh.in | 12 +- pelican/utils.py | 120 ++++++++++++++++--- pelican/writers.py | 19 +-- samples/pelican.conf.py | 10 +- setup.py | 4 +- tests/default_conf.py | 7 +- tests/support.py | 6 +- tests/test_contents.py | 6 +- tests/test_generators.py | 43 +++---- tests/test_importer.py | 23 +--- tests/test_pelican.py | 6 +- tests/test_plugins.py | 2 +- tests/test_readers.py | 39 ++---- tests/test_settings.py | 4 +- tests/test_utils.py | 7 +- tests/test_webassets.py | 1 + tox.ini | 65 +++++++++- 43 files changed, 495 insertions(+), 287 deletions(-) create mode 100644 pelican/server.py diff --git a/.gitignore b/.gitignore index 9f9404ef..1ae0e9f6 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ tags .tox .coverage htmlcov +six-*.egg/ +*.orig diff --git a/.travis.yml b/.travis.yml index bb9a22e4..e92b0abc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,13 @@ language: python python: - "2.6" - "2.7" +# - "3.2" before_install: - sudo apt-get update -qq - sudo apt-get install -qq ruby-sass install: - - pip install nose unittest2 mock --use-mirrors + - pip install nose mock --use-mirrors + - if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then pip install --use-mirrors unittest2py3k; else pip install --use-mirrors unittest2; fi - pip install . --use-mirrors - pip install Markdown - pip install webassets diff --git a/dev_requirements.txt b/dev_requirements.txt index acf01773..e0189d35 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,8 +1,9 @@ # Tests -unittest2 mock + # Optional Packages Markdown -BeautifulSoup +BeautifulSoup4 +lxml typogrify -webassets \ No newline at end of file +webassets diff --git a/docs/changelog.rst b/docs/changelog.rst index e29c94c0..aa18ea9e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,7 +4,7 @@ Release history 3.2 (XXXX-XX-XX) ================ -* [...] +* Support for Python 3! 3.1 (2012-12-04) ================ diff --git a/docs/conf.py b/docs/conf.py index 2a11fe3e..6c8ececa 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals import sys, os sys.path.append(os.path.abspath('..')) @@ -10,8 +11,8 @@ templates_path = ['_templates'] extensions = ['sphinx.ext.autodoc',] source_suffix = '.rst' master_doc = 'index' -project = u'Pelican' -copyright = u'2010, Alexis Metaireau and contributors' +project = 'Pelican' +copyright = '2010, Alexis Metaireau and contributors' exclude_patterns = ['_build'] version = __version__ release = __major__ @@ -34,16 +35,16 @@ htmlhelp_basename = 'Pelicandoc' # -- Options for LaTeX output -------------------------------------------------- latex_documents = [ - ('index', 'Pelican.tex', u'Pelican Documentation', - u'Alexis Métaireau', 'manual'), + ('index', 'Pelican.tex', 'Pelican Documentation', + 'Alexis Métaireau', 'manual'), ] # -- Options for manual page output -------------------------------------------- man_pages = [ - ('index', 'pelican', u'pelican documentation', - [u'Alexis Métaireau'], 1), - ('pelican-themes', 'pelican-themes', u'A theme manager for Pelican', - [u'Mickaël Raybaud'], 1), - ('themes', 'pelican-theming', u'How to create themes for Pelican', - [u'The Pelican contributors'], 1) + ('index', 'pelican', 'pelican documentation', + ['Alexis Métaireau'], 1), + ('pelican-themes', 'pelican-themes', 'A theme manager for Pelican', + ['Mickaël Raybaud'], 1), + ('themes', 'pelican-theming', 'How to create themes for Pelican', + ['The Pelican contributors'], 1) ] diff --git a/pelican/__init__.py b/pelican/__init__.py index e2ea7f76..566cb3b0 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -1,3 +1,7 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function +import six + import os import re import sys @@ -55,7 +59,7 @@ class Pelican(object): self.plugins = self.settings['PLUGINS'] for plugin in self.plugins: # if it's a string, then import it - if isinstance(plugin, basestring): + if isinstance(plugin, six.string_types): logger.debug("Loading plugin `{0}' ...".format(plugin)) plugin = __import__(plugin, globals(), locals(), 'module') @@ -265,7 +269,7 @@ def get_instance(args): settings = read_settings(args.settings, override=get_config(args)) cls = settings.get('PELICAN_CLASS') - if isinstance(cls, basestring): + if isinstance(cls, six.string_types): module, cls_name = cls.rsplit('.', 1) module = __import__(module) cls = getattr(module, cls_name) @@ -311,15 +315,15 @@ def main(): "Nothing to generate.") files_found_error = False time.sleep(1) # sleep to avoid cpu load - except Exception, e: + except Exception as e: logger.warning( "Caught exception \"{}\". Reloading.".format(e) ) continue else: pelican.run() - except Exception, e: - logger.critical(unicode(e)) + except Exception as e: + logger.critical(e) if (args.verbosity == logging.DEBUG): raise diff --git a/pelican/contents.py b/pelican/contents.py index d675a2ad..4655d4cc 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function +import six + import copy import locale import logging @@ -11,8 +14,10 @@ from sys import platform, stdin from pelican.settings import _DEFAULT_CONFIG -from pelican.utils import slugify, truncate_html_words, memoized +from pelican.utils import (slugify, truncate_html_words, memoized, + python_2_unicode_compatible) from pelican import signals +import pelican.utils logger = logging.getLogger(__name__) @@ -85,13 +90,8 @@ class Page(object): self.date_format = self.date_format[1] if hasattr(self, 'date'): - encoded_date = self.date.strftime( - self.date_format.encode('ascii', 'xmlcharrefreplace')) - - if platform == 'win32': - self.locale_date = encoded_date.decode(stdin.encoding) - else: - self.locale_date = encoded_date.decode('utf') + self.locale_date = pelican.utils.strftime(self.date, + self.date_format) # manage status if not hasattr(self, 'status'): @@ -167,7 +167,7 @@ class Page(object): origin = '/'.join((siteurl, self._context['filenames'][value].url)) else: - logger.warning(u"Unable to find {fn}, skipping url" + logger.warning("Unable to find {fn}, skipping url" " replacement".format(fn=value)) return m.group('markup') + m.group('quote') + origin \ @@ -243,10 +243,10 @@ class Article(Page): class Quote(Page): base_properties = ('author', 'date') - +@python_2_unicode_compatible class URLWrapper(object): def __init__(self, name, settings): - self.name = unicode(name) + self.name = name self.slug = slugify(self.name) self.settings = settings @@ -257,12 +257,9 @@ class URLWrapper(object): return hash(self.name) def __eq__(self, other): - return self.name == unicode(other) + return self.name == other def __str__(self): - return str(self.name.encode('utf-8', 'replace')) - - def __unicode__(self): return self.name def _from_settings(self, key, get_page_name=False): @@ -272,14 +269,14 @@ class URLWrapper(object): Useful for pagination.""" setting = "%s_%s" % (self.__class__.__name__.upper(), key) value = self.settings[setting] - if not isinstance(value, basestring): - logger.warning(u'%s is set to %s' % (setting, value)) + if not isinstance(value, six.string_types): + logger.warning('%s is set to %s' % (setting, value)) return value else: if get_page_name: - return unicode(os.path.splitext(value)[0]).format(**self.as_dict()) + return os.path.splitext(value)[0].format(**self.as_dict()) else: - return unicode(value).format(**self.as_dict()) + return value.format(**self.as_dict()) page_name = property(functools.partial(_from_settings, key='URL', get_page_name=True)) url = property(functools.partial(_from_settings, key='URL')) @@ -292,13 +289,14 @@ class Category(URLWrapper): class Tag(URLWrapper): def __init__(self, name, *args, **kwargs): - super(Tag, self).__init__(unicode.strip(name), *args, **kwargs) + super(Tag, self).__init__(name.strip(), *args, **kwargs) class Author(URLWrapper): pass +@python_2_unicode_compatible class StaticContent(object): def __init__(self, src, dst=None, settings=None): if not settings: @@ -309,9 +307,6 @@ class StaticContent(object): self.save_as = os.path.join(settings['OUTPUT_PATH'], self.url) def __str__(self): - return str(self.filepath.encode('utf-8', 'replace')) - - def __unicode__(self): return self.filepath @@ -319,7 +314,7 @@ def is_valid_content(content, f): try: content.check_properties() return True - except NameError, e: - logger.error(u"Skipping %s: impossible to find informations about" + except NameError as e: + logger.error("Skipping %s: impossible to find informations about" "'%s'" % (f, e)) return False diff --git a/pelican/generators.py b/pelican/generators.py index b5c1b944..0d2fa6a9 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function + import os import math import random import logging import datetime -import subprocess import shutil from codecs import open @@ -119,7 +120,7 @@ class Generator(object): for item in items: value = getattr(self, item) if hasattr(value, 'items'): - value = value.items() + value = list(value.items()) self.context[item] = value @@ -133,8 +134,8 @@ class _FileLoader(BaseLoader): if template != self.path or not os.path.exists(self.fullpath): raise TemplateNotFound(template) mtime = os.path.getmtime(self.fullpath) - with file(self.fullpath) as f: - source = f.read().decode('utf-8') + with open(self.fullpath, 'r', encoding='utf-8') as f: + source = f.read() return source, self.fullpath, \ lambda: mtime == os.path.getmtime(self.fullpath) @@ -323,8 +324,8 @@ class ArticlesGenerator(Generator): try: signals.article_generate_preread.send(self) content, metadata = read_file(f, settings=self.settings) - except Exception, e: - logger.warning(u'Could not process %s\n%s' % (f, str(e))) + except Exception as e: + logger.warning('Could not process %s\n%s' % (f, str(e))) continue # if no category is set, use the name of the path as a category @@ -333,8 +334,7 @@ class ArticlesGenerator(Generator): if (self.settings['USE_FOLDER_AS_CATEGORY'] and os.path.dirname(f) != article_path): # if the article is in a subdirectory - category = os.path.basename(os.path.dirname(f))\ - .decode('utf-8') + category = os.path.basename(os.path.dirname(f)) else: # if the article is not in a subdirectory category = self.settings['DEFAULT_CATEGORY'] @@ -366,8 +366,8 @@ class ArticlesGenerator(Generator): elif article.status == "draft": self.drafts.append(article) else: - logger.warning(u"Unknown status %s for file %s, skipping it." % - (repr(unicode.encode(article.status, 'utf-8')), + logger.warning("Unknown status %s for file %s, skipping it." % + (repr(article.status), repr(f))) self.articles, self.translations = process_translations(all_articles) @@ -394,7 +394,7 @@ class ArticlesGenerator(Generator): tag_cloud = sorted(tag_cloud.items(), key=itemgetter(1), reverse=True) tag_cloud = tag_cloud[:self.settings.get('TAG_CLOUD_MAX_ITEMS')] - tags = map(itemgetter(1), tag_cloud) + tags = list(map(itemgetter(1), tag_cloud)) if tags: max_count = max(tags) steps = self.settings.get('TAG_CLOUD_STEPS') @@ -450,8 +450,8 @@ class PagesGenerator(Generator): exclude=self.settings['PAGE_EXCLUDES']): try: content, metadata = read_file(f, settings=self.settings) - except Exception, e: - logger.warning(u'Could not process %s\n%s' % (f, str(e))) + except Exception as e: + logger.warning('Could not process %s\n%s' % (f, str(e))) continue signals.pages_generate_context.send(self, metadata=metadata) page = Page(content, metadata, settings=self.settings, @@ -466,8 +466,8 @@ class PagesGenerator(Generator): elif page.status == "hidden": hidden_pages.append(page) else: - logger.warning(u"Unknown status %s for file %s, skipping it." % - (repr(unicode.encode(page.status, 'utf-8')), + logger.warning("Unknown status %s for file %s, skipping it." % + (repr(page.status), repr(f))) self.pages, self.translations = process_translations(all_pages) @@ -550,7 +550,7 @@ class PdfGenerator(Generator): # print "Generating pdf for", obj.filename, " in ", output_pdf with open(obj.filename) as f: self.pdfcreator.createPdf(text=f.read(), output=output_pdf) - logger.info(u' [ok] writing %s' % output_pdf) + logger.info(' [ok] writing %s' % output_pdf) def generate_context(self): pass @@ -558,7 +558,7 @@ class PdfGenerator(Generator): def generate_output(self, writer=None): # we don't use the writer passed as argument here # since we write our own files - logger.info(u' Generating PDF files...') + logger.info(' Generating PDF files...') pdf_path = os.path.join(self.output_path, 'pdf') if not os.path.exists(pdf_path): try: @@ -583,6 +583,6 @@ class SourceFileGenerator(Generator): copy('', obj.filename, dest) def generate_output(self, writer=None): - logger.info(u' Generating source files...') + logger.info(' Generating source files...') for object in chain(self.context['articles'], self.context['pages']): self._create_source(object, self.output_path) diff --git a/pelican/log.py b/pelican/log.py index 9590d7f6..2ce11ea2 100644 --- a/pelican/log.py +++ b/pelican/log.py @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function + __all__ = [ 'init' ] @@ -9,7 +12,7 @@ import logging from logging import Formatter, getLogger, StreamHandler, DEBUG -RESET_TERM = u'\033[0;m' +RESET_TERM = '\033[0;m' COLOR_CODES = { 'red': 31, @@ -24,37 +27,38 @@ COLOR_CODES = { def ansi(color, text): """Wrap text in an ansi escape sequence""" code = COLOR_CODES[color] - return u'\033[1;{0}m{1}{2}'.format(code, text, RESET_TERM) + return '\033[1;{0}m{1}{2}'.format(code, text, RESET_TERM) class ANSIFormatter(Formatter): """ - Convert a `logging.LogReport' object into colored text, using ANSI escape sequences. + Convert a `logging.LogRecord' object into colored text, using ANSI escape sequences. """ ## colors: def format(self, record): - if record.levelname is 'INFO': - return ansi('cyan', '-> ') + unicode(record.msg) - elif record.levelname is 'WARNING': - return ansi('yellow', record.levelname) + ': ' + unicode(record.msg) - elif record.levelname is 'ERROR': - return ansi('red', record.levelname) + ': ' + unicode(record.msg) - elif record.levelname is 'CRITICAL': - return ansi('bgred', record.levelname) + ': ' + unicode(record.msg) - elif record.levelname is 'DEBUG': - return ansi('bggrey', record.levelname) + ': ' + unicode(record.msg) + msg = str(record.msg) + if record.levelname == 'INFO': + return ansi('cyan', '-> ') + msg + elif record.levelname == 'WARNING': + return ansi('yellow', record.levelname) + ': ' + msg + elif record.levelname == 'ERROR': + return ansi('red', record.levelname) + ': ' + msg + elif record.levelname == 'CRITICAL': + return ansi('bgred', record.levelname) + ': ' + msg + elif record.levelname == 'DEBUG': + return ansi('bggrey', record.levelname) + ': ' + msg else: - return ansi('white', record.levelname) + ': ' + unicode(record.msg) + return ansi('white', record.levelname) + ': ' + msg class TextFormatter(Formatter): """ - Convert a `logging.LogReport' object into text. + Convert a `logging.LogRecord' object into text. """ def format(self, record): - if not record.levelname or record.levelname is 'INFO': + if not record.levelname or record.levelname == 'INFO': return record.msg else: return record.levelname + ': ' + record.msg diff --git a/pelican/paginator.py b/pelican/paginator.py index fe871491..067215c2 100644 --- a/pelican/paginator.py +++ b/pelican/paginator.py @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function + # From django.core.paginator from math import ceil @@ -37,7 +40,7 @@ class Paginator(object): Returns a 1-based range of pages for iterating through within a template for loop. """ - return range(1, self.num_pages + 1) + return list(range(1, self.num_pages + 1)) page_range = property(_get_page_range) diff --git a/pelican/plugins/assets.py b/pelican/plugins/assets.py index b5d1cf76..9c819a4b 100644 --- a/pelican/plugins/assets.py +++ b/pelican/plugins/assets.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals """ Asset management plugin for Pelican =================================== diff --git a/pelican/plugins/github_activity.py b/pelican/plugins/github_activity.py index f2ba1da7..cc139efc 100644 --- a/pelican/plugins/github_activity.py +++ b/pelican/plugins/github_activity.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function """ Copyright (c) Marco Milanesi diff --git a/pelican/plugins/gzip_cache.py b/pelican/plugins/gzip_cache.py index 784a6ca0..9080629e 100644 --- a/pelican/plugins/gzip_cache.py +++ b/pelican/plugins/gzip_cache.py @@ -68,7 +68,7 @@ def create_gzip_file(filepath): logger.debug('Compressing: %s' % filepath) compressed = gzip.open(compressed_path, 'wb') compressed.writelines(uncompressed) - except Exception, ex: + except Exception as ex: logger.critical('Gzip compression failed: %s' % ex) finally: compressed.close() diff --git a/pelican/plugins/html_rst_directive.py b/pelican/plugins/html_rst_directive.py index d0a656f5..2b2bceb3 100644 --- a/pelican/plugins/html_rst_directive.py +++ b/pelican/plugins/html_rst_directive.py @@ -1,6 +1,7 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals from docutils import nodes from docutils.parsers.rst import directives, Directive -from pelican import log """ HTML tags for reStructuredText @@ -52,7 +53,7 @@ class RawHtml(Directive): has_content = True def run(self): - html = u' '.join(self.content) + html = ' '.join(self.content) node = nodes.raw('', html, format='html') return [node] diff --git a/pelican/plugins/initialized.py b/pelican/plugins/initialized.py index 5e4cf174..b4b5ab76 100644 --- a/pelican/plugins/initialized.py +++ b/pelican/plugins/initialized.py @@ -1,7 +1,9 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function from pelican import signals def test(sender): - print "%s initialized !!" % sender + print("%s initialized !!" % sender) def register(): signals.initialized.connect(test) diff --git a/pelican/plugins/related_posts.py b/pelican/plugins/related_posts.py index 67715023..c2765c3c 100644 --- a/pelican/plugins/related_posts.py +++ b/pelican/plugins/related_posts.py @@ -41,8 +41,8 @@ def add_related_posts(generator, metadata): if len(related_posts) < 1: return - relation_score = dict(zip(set(related_posts), map(related_posts.count, - set(related_posts)))) + relation_score = dict(list(zip(set(related_posts), list(map(related_posts.count, + set(related_posts)))))) ranked_related = sorted(relation_score, key=relation_score.get) metadata["related_posts"] = ranked_related[:5] diff --git a/pelican/plugins/sitemap.py b/pelican/plugins/sitemap.py index ebce1f04..0ade1288 100644 --- a/pelican/plugins/sitemap.py +++ b/pelican/plugins/sitemap.py @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + import collections import os.path @@ -7,19 +10,19 @@ from codecs import open from pelican import signals, contents -TXT_HEADER = u"""{0}/index.html +TXT_HEADER = """{0}/index.html {0}/archives.html {0}/tags.html {0}/categories.html """ -XML_HEADER = u""" +XML_HEADER = """ """ -XML_URL = u""" +XML_URL = """ {0}/{1} {2} @@ -28,7 +31,7 @@ XML_URL = u""" """ -XML_FOOTER = u""" +XML_FOOTER = """ """ @@ -86,7 +89,7 @@ class SitemapGenerator(object): 'yearly', 'never') if isinstance(pris, dict): - for k, v in pris.iteritems(): + for k, v in pris.items(): if k in valid_keys and not isinstance(v, (int, float)): default = self.priorities[k] warning("sitemap plugin: priorities must be numbers") @@ -99,7 +102,7 @@ class SitemapGenerator(object): warning("sitemap plugin: using the default values") if isinstance(chfreqs, dict): - for k, v in chfreqs.iteritems(): + for k, v in chfreqs.items(): if k in valid_keys and v not in valid_chfreqs: default = self.changefreqs[k] warning("sitemap plugin: invalid changefreq `{0}'".format(v)) diff --git a/pelican/readers.py b/pelican/readers.py index 6bd2822d..b182b6fa 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function +import six + import os import re try: @@ -20,15 +23,16 @@ try: asciidoc = True except ImportError: asciidoc = False +import re from pelican.contents import Category, Tag, Author from pelican.utils import get_date, pelican_open _METADATA_PROCESSORS = { - 'tags': lambda x, y: [Tag(tag, y) for tag in unicode(x).split(',')], + 'tags': lambda x, y: [Tag(tag, y) for tag in x.split(',')], 'date': lambda x, y: get_date(x), - 'status': lambda x, y: unicode.strip(x), + 'status': lambda x, y: x.strip(), 'category': Category, 'author': Author, } @@ -242,7 +246,7 @@ def read_file(filename, fmt=None, settings=None): if filename_metadata: match = re.match(filename_metadata, base) if match: - for k, v in match.groupdict().iteritems(): + for k, v in match.groupdict().items(): if k not in metadata: k = k.lower() # metadata must be lowercase metadata[k] = reader.process_metadata(k, v) diff --git a/pelican/rstdirectives.py b/pelican/rstdirectives.py index c677144d..fb4a6c93 100644 --- a/pelican/rstdirectives.py +++ b/pelican/rstdirectives.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function + from docutils import nodes, utils from docutils.parsers.rst import directives, roles, Directive from pygments.formatters import HtmlFormatter @@ -32,7 +34,7 @@ class Pygments(Directive): # take an arbitrary option if more than one is given formatter = self.options and VARIANTS[self.options.keys()[0]] \ or DEFAULT - parsed = highlight(u'\n'.join(self.content), lexer, formatter) + parsed = highlight('\n'.join(self.content), lexer, formatter) return [nodes.raw('', parsed, format='html')] directives.register_directive('code-block', Pygments) diff --git a/pelican/server.py b/pelican/server.py new file mode 100644 index 00000000..0f5a71d2 --- /dev/null +++ b/pelican/server.py @@ -0,0 +1,20 @@ +from __future__ import print_function +try: + import SimpleHTTPServer as srvmod +except ImportError: + import http.server as srvmod + +try: + import SocketServer as socketserver +except ImportError: + import socketserver + +PORT = 8000 + +Handler = srvmod.SimpleHTTPRequestHandler + +httpd = socketserver.TCPServer(("", PORT), Handler) + +print("serving at port", PORT) +httpd.serve_forever() + diff --git a/pelican/settings.py b/pelican/settings.py index 692fc983..0748f991 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function +import six + import copy import imp import inspect import os import locale import logging -import re from os.path import isabs @@ -54,8 +56,8 @@ _DEFAULT_CONFIG = {'PATH': '.', 'CATEGORY_SAVE_AS': 'category/{slug}.html', 'TAG_URL': 'tag/{slug}.html', 'TAG_SAVE_AS': 'tag/{slug}.html', - 'AUTHOR_URL': u'author/{slug}.html', - 'AUTHOR_SAVE_AS': u'author/{slug}.html', + 'AUTHOR_URL': 'author/{slug}.html', + 'AUTHOR_SAVE_AS': 'author/{slug}.html', 'RELATIVE_URLS': True, 'DEFAULT_LANG': 'en', 'TAG_CLOUD_STEPS': 4, @@ -146,7 +148,7 @@ def configure_settings(settings): # if locales is not a list, make it one locales = settings['LOCALE'] - if isinstance(locales, basestring): + if isinstance(locales, six.string_types): locales = [locales] # try to set the different locales, fallback on the default. @@ -155,7 +157,7 @@ def configure_settings(settings): for locale_ in locales: try: - locale.setlocale(locale.LC_ALL, locale_) + locale.setlocale(locale.LC_ALL, str(locale_)) break # break if it is successful except locale.Error: pass @@ -200,14 +202,14 @@ def configure_settings(settings): "of the Webassets plugin") if 'OUTPUT_SOURCES_EXTENSION' in settings: - if not isinstance(settings['OUTPUT_SOURCES_EXTENSION'], str): + if not isinstance(settings['OUTPUT_SOURCES_EXTENSION'], six.string_types): settings['OUTPUT_SOURCES_EXTENSION'] = _DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION'] logger.warn("Detected misconfiguration with OUTPUT_SOURCES_EXTENSION." " falling back to the default extension " + _DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION']) filename_metadata = settings.get('FILENAME_METADATA') - if filename_metadata and not isinstance(filename_metadata, basestring): + if filename_metadata and not isinstance(filename_metadata, six.string_types): logger.error("Detected misconfiguration with FILENAME_METADATA" " setting (must be string or compiled pattern), falling" "back to the default") diff --git a/pelican/signals.py b/pelican/signals.py index d592599a..1367a117 100644 --- a/pelican/signals.py +++ b/pelican/signals.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function from blinker import signal initialized = signal('pelican_initialized') diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index fdd1ac51..b1a2865f 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -1,7 +1,12 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function import argparse -from HTMLParser import HTMLParser +try: + from html.parser import HTMLParser +except ImportError: + from HTMLParser import HTMLParser import os import subprocess import sys @@ -15,14 +20,14 @@ from pelican.utils import slugify def wp2fields(xml): """Opens a wordpress XML file, and yield pelican fields""" try: - from BeautifulSoup import BeautifulStoneSoup + from bs4 import BeautifulSoup except ImportError: error = ('Missing dependency ' - '"BeautifulSoup" required to import Wordpress XML files.') + '"BeautifulSoup4" and "lxml" required to import Wordpress XML files.') sys.exit(error) xmlfile = open(xml, encoding='utf-8').read() - soup = BeautifulStoneSoup(xmlfile) + soup = BeautifulSoup(xmlfile, "xml") items = soup.rss.channel.findAll('item') for item in items: @@ -54,10 +59,10 @@ def wp2fields(xml): def dc2fields(file): """Opens a Dotclear export file, and yield pelican fields""" try: - from BeautifulSoup import BeautifulStoneSoup + from bs4 import BeautifulSoup except ImportError: error = ('Missing dependency ' - '"BeautifulSoup" required to import Dotclear files.') + '"BeautifulSoup4" and "lxml" required to import Dotclear files.') sys.exit(error) @@ -142,13 +147,27 @@ def dc2fields(file): if len(tag) > 1: if int(tag[:1]) == 1: newtag = tag.split('"')[1] - tags.append(unicode(BeautifulStoneSoup(newtag,convertEntities=BeautifulStoneSoup.HTML_ENTITIES ))) + tags.append( + BeautifulSoup( + newtag + , "xml" + ) + # bs4 always outputs UTF-8 + .decode('utf-8') + ) else: i=1 j=1 while(i <= int(tag[:1])): newtag = tag.split('"')[j].replace('\\','') - tags.append(unicode(BeautifulStoneSoup(newtag,convertEntities=BeautifulStoneSoup.HTML_ENTITIES ))) + tags.append( + BeautifulSoup( + newtag + , "xml" + ) + # bs4 always outputs UTF-8 + .decode('utf-8') + ) i=i+1 if j < int(tag[:1])*2: j=j+2 @@ -244,7 +263,7 @@ def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=Fals # Replace newlines with paragraphs wrapped with

          so # HTML is valid before conversion paragraphs = content.splitlines() - paragraphs = [u'

          {0}

          '.format(p) for p in paragraphs] + paragraphs = ['

          {0}

          '.format(p) for p in paragraphs] new_content = ''.join(paragraphs) fp.write(new_content) @@ -264,7 +283,7 @@ def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=Fals elif rc > 0: error = "Please, check your Pandoc installation." exit(error) - except OSError, e: + except OSError as e: error = "Pandoc execution failed: %s" % e exit(error) @@ -284,7 +303,7 @@ def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=Fals def main(): parser = argparse.ArgumentParser( description="Transform feed, Wordpress or Dotclear files to reST (rst) " - "or Markdown (md) files. Be sure to have pandoc installed.", + "or Markdown (md) files. Be sure to have pandoc installed", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument(dest='input', help='The input file to read') @@ -304,10 +323,10 @@ def main(): help="Strip raw HTML code that can't be converted to " "markup such as flash embeds or iframes (wordpress import only)") parser.add_argument('--disable-slugs', action='store_true', - dest='disable_slugs', - help='Disable storing slugs from imported posts within output. ' - 'With this disabled, your Pelican URLs may not be consistent ' - 'with your original posts.') + dest='disable_slugs', + help='Disable storing slugs from imported posts within output. ' + 'With this disabled, your Pelican URLs may not be consistent ' + 'with your original posts.') args = parser.parse_args() @@ -339,4 +358,4 @@ def main(): fields2pelican(fields, args.markup, args.output, dircat=args.dircat or False, strip_raw=args.strip_raw or False, - disable_slugs=args.disable_slugs or False) + strip_slugs=args.disable_slugs or False) diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index 447a80c5..9f25f2fe 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -1,5 +1,8 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # + +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function +import six import os import string @@ -29,11 +32,22 @@ CONF = { 'lang': 'en' } +def _input_compat(prompt): + if six.PY3: + r = input(prompt) + else: + r = raw_input(prompt).decode('utf-8') + return r + +if six.PY3: + str_compat = str +else: + str_compat = unicode def decoding_strings(f): def wrapper(*args, **kwargs): out = f(*args, **kwargs) - if isinstance(out, basestring): + if isinstance(out, six.string_types): # todo: make encoding configurable? return out.decode(sys.stdin.encoding) return out @@ -55,14 +69,14 @@ def get_template(name, as_encoding='utf-8'): @decoding_strings -def ask(question, answer=str, default=None, l=None): - if answer == str: +def ask(question, answer=str_compat, default=None, l=None): + if answer == str_compat: r = '' while True: if default: - r = raw_input('> {0} [{1}] '.format(question, default)) + r = _input_compat('> {0} [{1}] '.format(question, default)) else: - r = raw_input('> {0} '.format(question, default)) + r = _input_compat('> {0} '.format(question, default)) r = r.strip() @@ -84,11 +98,11 @@ def ask(question, answer=str, default=None, l=None): r = None while True: if default is True: - r = raw_input('> {0} (Y/n) '.format(question)) + r = _input_compat('> {0} (Y/n) '.format(question)) elif default is False: - r = raw_input('> {0} (y/N) '.format(question)) + r = _input_compat('> {0} (y/N) '.format(question)) else: - r = raw_input('> {0} (y/n) '.format(question)) + r = _input_compat('> {0} (y/n) '.format(question)) r = r.strip().lower() @@ -108,9 +122,9 @@ def ask(question, answer=str, default=None, l=None): r = None while True: if default: - r = raw_input('> {0} [{1}] '.format(question, default)) + r = _input_compat('> {0} [{1}] '.format(question, default)) else: - r = raw_input('> {0} '.format(question)) + r = _input_compat('> {0} '.format(question)) r = r.strip() @@ -125,7 +139,7 @@ def ask(question, answer=str, default=None, l=None): print('You must enter an integer') return r else: - raise NotImplemented('Argument `answer` must be str, bool, or integer') + raise NotImplemented('Argument `answer` must be str_compat, bool, or integer') def main(): @@ -158,14 +172,14 @@ needed by Pelican. print('Using project associated with current virtual environment.' 'Will save to:\n%s\n' % CONF['basedir']) else: - CONF['basedir'] = os.path.abspath(ask('Where do you want to create your new web site?', answer=str, default=args.path)) + CONF['basedir'] = os.path.abspath(ask('Where do you want to create your new web site?', answer=str_compat, default=args.path)) - CONF['sitename'] = ask('What will be the title of this web site?', answer=str, default=args.title) - CONF['author'] = ask('Who will be the author of this web site?', answer=str, default=args.author) - CONF['lang'] = ask('What will be the default language of this web site?', str, args.lang or CONF['lang'], 2) + CONF['sitename'] = ask('What will be the title of this web site?', answer=str_compat, default=args.title) + CONF['author'] = ask('Who will be the author of this web site?', answer=str_compat, default=args.author) + CONF['lang'] = ask('What will be the default language of this web site?', str_compat, args.lang or CONF['lang'], 2) if ask('Do you want to specify a URL prefix? e.g., http://example.com ', answer=bool, default=True): - CONF['siteurl'] = ask('What is your URL prefix? (see above example; no trailing slash)', str, CONF['siteurl']) + CONF['siteurl'] = ask('What is your URL prefix? (see above example; no trailing slash)', str_compat, CONF['siteurl']) CONF['with_pagination'] = ask('Do you want to enable article pagination?', bool, bool(CONF['default_pagination'])) @@ -179,38 +193,38 @@ needed by Pelican. if mkfile: if ask('Do you want to upload your website using FTP?', answer=bool, default=False): - CONF['ftp_host'] = ask('What is the hostname of your FTP server?', str, CONF['ftp_host']) - CONF['ftp_user'] = ask('What is your username on that server?', str, CONF['ftp_user']) - CONF['ftp_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ftp_target_dir']) + CONF['ftp_host'] = ask('What is the hostname of your FTP server?', str_compat, CONF['ftp_host']) + CONF['ftp_user'] = ask('What is your username on that server?', str_compat, CONF['ftp_user']) + CONF['ftp_target_dir'] = ask('Where do you want to put your web site on that server?', str_compat, CONF['ftp_target_dir']) if ask('Do you want to upload your website using SSH?', answer=bool, default=False): - CONF['ssh_host'] = ask('What is the hostname of your SSH server?', str, CONF['ssh_host']) + CONF['ssh_host'] = ask('What is the hostname of your SSH server?', str_compat, CONF['ssh_host']) CONF['ssh_port'] = ask('What is the port of your SSH server?', int, CONF['ssh_port']) - CONF['ssh_user'] = ask('What is your username on that server?', str, CONF['ssh_user']) - CONF['ssh_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ssh_target_dir']) + CONF['ssh_user'] = ask('What is your username on that server?', str_compat, CONF['ssh_user']) + CONF['ssh_target_dir'] = ask('Where do you want to put your web site on that server?', str_compat, CONF['ssh_target_dir']) if ask('Do you want to upload your website using Dropbox?', answer=bool, default=False): - CONF['dropbox_dir'] = ask('Where is your Dropbox directory?', str, CONF['dropbox_dir']) + CONF['dropbox_dir'] = ask('Where is your Dropbox directory?', str_compat, CONF['dropbox_dir']) try: os.makedirs(os.path.join(CONF['basedir'], 'content')) - except OSError, e: + except OSError as e: print('Error: {0}'.format(e)) try: os.makedirs(os.path.join(CONF['basedir'], 'output')) - except OSError, e: + except OSError as e: print('Error: {0}'.format(e)) try: with codecs.open(os.path.join(CONF['basedir'], 'pelicanconf.py'), 'w', 'utf-8') as fd: conf_python = dict() - for key, value in CONF.iteritems(): + for key, value in CONF.items(): conf_python[key] = repr(value) for line in get_template('pelicanconf.py'): template = string.Template(line) fd.write(template.safe_substitute(conf_python)) fd.close() - except OSError, e: + except OSError as e: print('Error: {0}'.format(e)) try: @@ -219,7 +233,7 @@ needed by Pelican. template = string.Template(line) fd.write(template.safe_substitute(CONF)) fd.close() - except OSError, e: + except OSError as e: print('Error: {0}'.format(e)) if mkfile: @@ -229,13 +243,13 @@ needed by Pelican. template = string.Template(line) fd.write(template.safe_substitute(CONF)) fd.close() - except OSError, e: + except OSError as e: print('Error: {0}'.format(e)) if develop: conf_shell = dict() - for key, value in CONF.iteritems(): - if isinstance(value, basestring) and ' ' in value: + for key, value in CONF.items(): + if isinstance(value, six.string_types) and ' ' in value: value = '"' + value.replace('"', '\\"') + '"' conf_shell[key] = value try: @@ -244,8 +258,8 @@ needed by Pelican. template = string.Template(line) fd.write(template.safe_substitute(conf_shell)) fd.close() - os.chmod((os.path.join(CONF['basedir'], 'develop_server.sh')), 0755) - except OSError, e: + os.chmod((os.path.join(CONF['basedir'], 'develop_server.sh')), 493) # mode 0o755 + except OSError as e: print('Error: {0}'.format(e)) print('Done. Your new project is available at %s' % CONF['basedir']) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index d13e60e9..8d71535d 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -1,5 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function + +import six import argparse import os @@ -28,7 +31,7 @@ _BUILTIN_THEMES = ['simple', 'notmyidea'] def err(msg, die=None): """Print an error message and exits if an exit code is given""" - sys.stderr.write(str(msg) + '\n') + sys.stderr.write(msg + '\n') if die: sys.exit((die if type(die) is int else 1)) @@ -186,13 +189,13 @@ def install(path, v=False, u=False): for root, dirs, files in os.walk(theme_path): for d in dirs: dname = os.path.join(root, d) - os.chmod(dname, 0755) + os.chmod(dname, 493) # 0o755 for f in files: fname = os.path.join(root, f) - os.chmod(fname, 0644) - except OSError, e: + os.chmod(fname, 420) # 0o644 + except OSError as e: err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) - except Exception, e: + except Exception as e: err("Cannot copy `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e))) @@ -212,7 +215,7 @@ def symlink(path, v=False): print("Linking `{p}' to `{t}' ...".format(p=path, t=theme_path)) try: os.symlink(path, theme_path) - except Exception, e: + except Exception as e: err("Cannot link `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e))) @@ -233,7 +236,7 @@ def clean(v=False): print('Removing {0}'.format(path)) try: os.remove(path) - except OSError, e: + except OSError as e: print('Error: cannot remove {0}'.format(path)) else: c+=1 diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 8e5c80f9..8dd91630 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -49,7 +49,7 @@ regenerate: clean $$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS) serve: - cd $$(OUTPUTDIR) && python -m SimpleHTTPServer + cd $$(OUTPUTDIR) && python -m pelican.server devserver: $$(BASEDIR)/develop_server.sh restart diff --git a/pelican/tools/templates/develop_server.sh.in b/pelican/tools/templates/develop_server.sh.in index 41764728..1eda47c4 100755 --- a/pelican/tools/templates/develop_server.sh.in +++ b/pelican/tools/templates/develop_server.sh.in @@ -20,7 +20,7 @@ PELICAN_PID=$$BASEDIR/pelican.pid function usage(){ echo "usage: $$0 (stop) (start) (restart)" echo "This starts pelican in debug and reload mode and then launches" - echo "A SimpleHTTP server to help site development. It doesn't read" + echo "A pelican.server to help site development. It doesn't read" echo "your pelican options so you edit any paths in your Makefile" echo "you will need to edit it as well" exit 3 @@ -31,14 +31,14 @@ function shut_down(){ PID=$$(cat $$SRV_PID) PROCESS=$$(ps -p $$PID | tail -n 1 | awk '{print $$4}') if [[ $$PROCESS != "" ]]; then - echo "Killing SimpleHTTPServer" + echo "Killing pelican.server" kill $$PID else echo "Stale PID, deleting" fi rm $$SRV_PID else - echo "SimpleHTTPServer PIDFile not found" + echo "pelican.server PIDFile not found" fi if [[ -f $$PELICAN_PID ]]; then @@ -57,15 +57,15 @@ function shut_down(){ } function start_up(){ - echo "Starting up Pelican and SimpleHTTPServer" + echo "Starting up Pelican and pelican.server" shift $$PELICAN --debug --autoreload -r $$INPUTDIR -o $$OUTPUTDIR -s $$CONFFILE $$PELICANOPTS & echo $$! > $$PELICAN_PID cd $$OUTPUTDIR - python -m SimpleHTTPServer & + python -m pelican.server & echo $$! > $$SRV_PID cd $$BASEDIR - sleep 1 && echo 'Pelican and SimpleHTTPServer processes now running in background.' + sleep 1 && echo 'Pelican and pelican.server processes now running in background.' } ### diff --git a/pelican/utils.py b/pelican/utils.py index 6ca797c4..3a41d04e 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -1,10 +1,14 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function +import six + import os import re import pytz import shutil import logging import errno +import locale from collections import defaultdict, Hashable from functools import partial @@ -17,6 +21,77 @@ from operator import attrgetter logger = logging.getLogger(__name__) +def strftime(date, date_format): + """ + Replacement for the builtin strftime(). + + This :func:`strftime()` is compatible to Python 2 and 3. In both cases, + input and output is always unicode. + + Still, Python 3's :func:`strftime()` seems to somehow "normalize" unicode + chars in the format string. So if e.g. your format string contains 'ø' or + 'ä', the result will be 'o' and 'a'. + + See here for an `extensive testcase `_. + + :param date: Any object that sports a :meth:`strftime()` method. + :param date_format: Format string, can always be unicode. + :returns: Unicode string with formatted date. + """ + # As tehkonst confirmed, above mentioned testcase runs correctly on + # Python 2 and 3 on Windows as well. Thanks. + if six.PY3: + # It could be so easy... *sigh* + return date.strftime(date_format) + # TODO Perhaps we should refactor again, so that the + # xmlcharrefreplace-regex-dance is always done, regardless + # of the Python version. + else: + # We must ensure that the format string is an encoded byte + # string, ASCII only WTF!!! + # But with "xmlcharrefreplace" our formatted date will produce + # *yuck* like this: + # "Øl trinken beim Besäufnis" + # --> "Øl trinken beim Besäufnis" + date_format = date_format.encode('ascii', + errors="xmlcharrefreplace") + result = date.strftime(date_format) + # strftime() returns an encoded byte string + # which we must decode into unicode. + lang_code, enc = locale.getlocale(locale.LC_ALL) + if enc: + result = result.decode(enc) + else: + result = unicode(result) + # Convert XML character references back to unicode characters. + if "&#" in result: + result = re.sub(r'&#(?P\d+);' + , lambda m: unichr(int(m.group('num'))) + , result + ) + return result + + + +#---------------------------------------------------------------------------- +# Stolen from Django: django.utils.encoding +# + +def python_2_unicode_compatible(klass): + """ + A decorator that defines __unicode__ and __str__ methods under Python 2. + Under Python 3 it does nothing. + + To support Python 2 and 3 with a single code base, define a __str__ method + returning text and apply this decorator to the class. + """ + if not six.PY3: + klass.__unicode__ = klass.__str__ + klass.__str__ = lambda self: self.__unicode__().encode('utf-8') + return klass + +#---------------------------------------------------------------------------- + class NoFilesError(Exception): pass @@ -78,14 +153,24 @@ def slugify(value): Took from django sources. """ + # TODO Maybe steal again from current Django 1.5dev value = Markup(value).striptags() - if type(value) == unicode: - import unicodedata - from unidecode import unidecode - value = unicode(unidecode(value)) - value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore') - value = unicode(re.sub('[^\w\s-]', '', value).strip().lower()) - return re.sub('[-\s]+', '-', value) + # value must be unicode per se + import unicodedata + from unidecode import unidecode + # unidecode returns str in Py2 and 3, so in Py2 we have to make + # it unicode again + value = unidecode(value) + if isinstance(value, six.binary_type): + value = value.decode('ascii') + # still unicode + value = unicodedata.normalize('NFKD', value) + value = re.sub('[^\w\s-]', '', value).strip().lower() + value = re.sub('[-\s]+', '-', value) + # we want only ASCII chars + value = value.encode('ascii', 'ignore') + # but Pelican should generally use only unicode + return value.decode('ascii') def copy(path, source, destination, destination_path=None, overwrite=False): @@ -137,7 +222,7 @@ def clean_output_dir(path): if not os.path.isdir(path): try: os.remove(path) - except Exception, e: + except Exception as e: logger.error("Unable to delete file %s; %e" % path, e) return @@ -148,13 +233,13 @@ def clean_output_dir(path): try: shutil.rmtree(file) logger.debug("Deleted directory %s" % file) - except Exception, e: + except Exception as e: logger.error("Unable to delete directory %s; %e" % file, e) elif os.path.isfile(file) or os.path.islink(file): try: os.remove(file) logger.debug("Deleted file/link %s" % file) - except Exception, e: + except Exception as e: logger.error("Unable to delete file %s; %e" % file, e) else: logger.error("Unable to delete %s, file type unknown" % file) @@ -180,7 +265,7 @@ def truncate_html_words(s, num, end_text='...'): """ length = int(num) if length <= 0: - return u'' + return '' html4_singlets = ('br', 'col', 'link', 'base', 'img', 'param', 'area', 'hr', 'input') @@ -254,10 +339,10 @@ def process_translations(content_list): for slug, items in grouped_by_slugs: items = list(items) # find items with default language - default_lang_items = filter(attrgetter('in_default_lang'), items) + default_lang_items = list(filter(attrgetter('in_default_lang'), items)) len_ = len(default_lang_items) if len_ > 1: - logger.warning(u'there are %s variants of "%s"' % (len_, slug)) + logger.warning('there are %s variants of "%s"' % (len_, slug)) for x in default_lang_items: logger.warning(' %s' % x.filename) elif len_ == 0: @@ -269,12 +354,9 @@ def process_translations(content_list): + 'content' logger.warning(msg) index.extend(default_lang_items) - translations.extend(filter( - lambda x: x not in default_lang_items, - items - )) + translations.extend([x for x in items if x not in default_lang_items]) for a in items: - a.translations = filter(lambda x: x != a, items) + a.translations = [x for x in items if x != a] return index, translations @@ -333,6 +415,6 @@ def set_date_tzinfo(d, tz_name=None): def mkdir_p(path): try: os.makedirs(path) - except OSError, e: + except OSError as e: if e.errno != errno.EEXIST: raise diff --git a/pelican/writers.py b/pelican/writers.py index 42ddfb13..8374ea3e 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -from __future__ import with_statement +from __future__ import with_statement, unicode_literals, print_function +import six import os import locale @@ -57,7 +58,7 @@ class Writer(object): :param feed_type: the feed type to use (atom or rss) """ old_locale = locale.setlocale(locale.LC_ALL) - locale.setlocale(locale.LC_ALL, 'C') + locale.setlocale(locale.LC_ALL, str('C')) try: self.site_url = context.get('SITEURL', get_relative_path(filename)) self.feed_domain = context.get('FEED_DOMAIN') @@ -68,7 +69,7 @@ class Writer(object): max_items = len(elements) if self.settings['FEED_MAX_ITEMS']: max_items = min(self.settings['FEED_MAX_ITEMS'], max_items) - for i in xrange(max_items): + for i in range(max_items): self._add_item_to_the_feed(feed, elements[i]) if filename: @@ -77,7 +78,7 @@ class Writer(object): os.makedirs(os.path.dirname(complete_path)) except Exception: pass - fp = open(complete_path, 'w') + fp = open(complete_path, 'w', encoding='utf-8' if six.PY3 else None) feed.write(fp, 'utf-8') logger.info('writing %s' % complete_path) @@ -108,7 +109,7 @@ class Writer(object): def _write_file(template, localcontext, output_path, name): """Render the template write the file.""" old_locale = locale.setlocale(locale.LC_ALL) - locale.setlocale(locale.LC_ALL, 'C') + locale.setlocale(locale.LC_ALL, str('C')) try: output = template.render(localcontext) finally: @@ -120,7 +121,7 @@ class Writer(object): pass with open(filename, 'w', encoding='utf-8') as f: f.write(output) - logger.info(u'writing %s' % filename) + logger.info('writing %s' % filename) localcontext = context.copy() if relative_urls: @@ -135,7 +136,7 @@ class Writer(object): if paginated: # pagination needed, init paginators paginators = {} - for key in paginated.iterkeys(): + for key in paginated.keys(): object_list = paginated[key] if self.settings.get('DEFAULT_PAGINATION'): @@ -147,9 +148,9 @@ class Writer(object): # generated pages, and write name_root, ext = os.path.splitext(name) - for page_num in range(paginators.values()[0].num_pages): + for page_num in range(list(paginators.values())[0].num_pages): paginated_localcontext = localcontext.copy() - for key in paginators.iterkeys(): + for key in paginators.keys(): paginator = paginators[key] page = paginator.page(page_num + 1) paginated_localcontext.update( diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py index 0ac4cd2c..714a418c 100755 --- a/samples/pelican.conf.py +++ b/samples/pelican.conf.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- -AUTHOR = u'Alexis Métaireau' -SITENAME = u"Alexis' log" +from __future__ import unicode_literals + +AUTHOR = 'Alexis Métaireau' +SITENAME = "Alexis' log" SITEURL = 'http://blog.notmyidea.org' TIMEZONE = "Europe/Paris" @@ -10,7 +12,7 @@ PDF_GENERATOR = False REVERSE_CATEGORY_ORDER = True LOCALE = "C" DEFAULT_PAGINATION = 4 -DEFAULT_DATE = (2012, 03, 02, 14, 01, 01) +DEFAULT_DATE = (2012, 3, 2, 14, 1, 1) FEED_ALL_RSS = 'feeds/all.rss.xml' CATEGORY_FEED_RSS = 'feeds/%s.rss.xml' @@ -19,7 +21,7 @@ LINKS = (('Biologeek', 'http://biologeek.org'), ('Filyb', "http://filyb.info/"), ('Libert-fr', "http://www.libert-fr.com"), ('N1k0', "http://prendreuncafe.com/blog/"), - (u'Tarek Ziadé', "http://ziade.org/blog"), + ('Tarek Ziadé', "http://ziade.org/blog"), ('Zubin Mithra', "http://zubin71.wordpress.com/"),) SOCIAL = (('twitter', 'http://twitter.com/ametaireau'), diff --git a/setup.py b/setup.py index b6a54414..13afd8cf 100755 --- a/setup.py +++ b/setup.py @@ -1,8 +1,8 @@ #!/usr/bin/env python from setuptools import setup -requires = ['feedgenerator', 'jinja2 >= 2.6', 'pygments', 'docutils', 'pytz', - 'blinker', 'unidecode'] +requires = ['feedgenerator>=1.5', 'jinja2 >= 2.6', 'pygments', 'docutils', 'pytz', + 'blinker', 'unidecode', 'six'] try: import argparse # NOQA diff --git a/tests/default_conf.py b/tests/default_conf.py index acb7d9da..09548fdd 100644 --- a/tests/default_conf.py +++ b/tests/default_conf.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -AUTHOR = u'Alexis Métaireau' -SITENAME = u"Alexis' log" +from __future__ import unicode_literals, print_function +AUTHOR = 'Alexis Métaireau' +SITENAME = "Alexis' log" SITEURL = 'http://blog.notmyidea.org' TIMEZONE = 'UTC' @@ -18,7 +19,7 @@ LINKS = (('Biologeek', 'http://biologeek.org'), ('Filyb', "http://filyb.info/"), ('Libert-fr', "http://www.libert-fr.com"), ('N1k0', "http://prendreuncafe.com/blog/"), - (u'Tarek Ziadé', "http://ziade.org/blog"), + ('Tarek Ziadé', "http://ziade.org/blog"), ('Zubin Mithra', "http://zubin71.wordpress.com/"),) SOCIAL = (('twitter', 'http://twitter.com/ametaireau'), diff --git a/tests/support.py b/tests/support.py index 1bbaf47e..6011e6cd 100644 --- a/tests/support.py +++ b/tests/support.py @@ -1,13 +1,15 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function __all__ = [ 'get_article', 'unittest', ] -import cStringIO import os import re import subprocess import sys +from six import StringIO import logging from logging.handlers import BufferingHandler @@ -101,7 +103,7 @@ def mute(returns_output=False): def wrapper(*args, **kwargs): saved_stdout = sys.stdout - sys.stdout = cStringIO.StringIO() + sys.stdout = StringIO() try: out = func(*args, **kwargs) diff --git a/tests/test_contents.py b/tests/test_contents.py index a8b9877f..eb7b6514 100644 --- a/tests/test_contents.py +++ b/tests/test_contents.py @@ -113,8 +113,8 @@ class TestPage(unittest.TestCase): page = Page(**page_kwargs) self.assertEqual(page.locale_date, - unicode(dt.strftime(_DEFAULT_CONFIG['DEFAULT_DATE_FORMAT']), - 'utf-8')) + dt.strftime(_DEFAULT_CONFIG['DEFAULT_DATE_FORMAT'])) + page_kwargs['settings'] = dict([(x, _DEFAULT_CONFIG[x]) for x in _DEFAULT_CONFIG]) @@ -131,7 +131,7 @@ class TestPage(unittest.TestCase): import locale as locale_module try: page = Page(**page_kwargs) - self.assertEqual(page.locale_date, u'2015-09-13(\u65e5)') + self.assertEqual(page.locale_date, '2015-09-13(\u65e5)') except locale_module.Error: # The constructor of ``Page`` will try to set the locale to # ``ja_JP.utf8``. But this attempt will failed when there is no diff --git a/tests/test_generators.py b/tests/test_generators.py index fb1dbe9c..50f5fe3e 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function from mock import MagicMock import os @@ -31,7 +32,7 @@ class TestArticlesGenerator(unittest.TestCase): settings = get_settings() settings['ARTICLE_DIR'] = 'content' settings['DEFAULT_CATEGORY'] = 'Default' - settings['DEFAULT_DATE'] = (1970, 01, 01) + settings['DEFAULT_DATE'] = (1970, 1, 1) self.generator = ArticlesGenerator(settings.copy(), settings, CUR_DIR, settings['THEME'], None, settings['MARKUP']) @@ -70,18 +71,18 @@ class TestArticlesGenerator(unittest.TestCase): generator = self.get_populated_generator() articles = self.distill_articles(generator.articles) articles_expected = [ - [u'Article title', 'published', 'Default', 'article'], - [u'Article with markdown and summary metadata single', 'published', u'Default', 'article'], - [u'Article with markdown and summary metadata multi', 'published', u'Default', 'article'], - [u'Article with template', 'published', 'Default', 'custom'], - [u'Test md File', 'published', 'test', 'article'], - [u'Rst with filename metadata', 'published', u'yeah', 'article'], - [u'Test Markdown extensions', 'published', u'Default', 'article'], - [u'This is a super article !', 'published', 'Yeah', 'article'], - [u'This is an article with category !', 'published', 'yeah', 'article'], - [u'This is an article without category !', 'published', 'Default', 'article'], - [u'This is an article without category !', 'published', 'TestCategory', 'article'], - [u'This is a super article !', 'published', 'yeah', 'article'] + ['Article title', 'published', 'Default', 'article'], + ['Article with markdown and summary metadata single', 'published', 'Default', 'article'], + ['Article with markdown and summary metadata multi', 'published', 'Default', 'article'], + ['Article with template', 'published', 'Default', 'custom'], + ['Test md File', 'published', 'test', 'article'], + ['Rst with filename metadata', 'published', 'yeah', 'article'], + ['Test Markdown extensions', 'published', 'Default', 'article'], + ['This is a super article !', 'published', 'Yeah', 'article'], + ['This is an article with category !', 'published', 'yeah', 'article'], + ['This is an article without category !', 'published', 'Default', 'article'], + ['This is an article without category !', 'published', 'TestCategory', 'article'], + ['This is a super article !', 'published', 'yeah', 'article'] ] self.assertItemsEqual(articles_expected, articles) @@ -97,7 +98,7 @@ class TestArticlesGenerator(unittest.TestCase): settings = _DEFAULT_CONFIG.copy() settings['ARTICLE_DIR'] = 'content' settings['DEFAULT_CATEGORY'] = 'Default' - settings['DEFAULT_DATE'] = (1970, 01, 01) + settings['DEFAULT_DATE'] = (1970, 1, 1) settings['USE_FOLDER_AS_CATEGORY'] = False settings['filenames'] = {} generator = ArticlesGenerator(settings.copy(), settings, @@ -179,7 +180,7 @@ class TestPageGenerator(unittest.TestCase): def test_generate_context(self): settings = get_settings() settings['PAGE_DIR'] = 'TestPages' - settings['DEFAULT_DATE'] = (1970, 01, 01) + settings['DEFAULT_DATE'] = (1970, 1, 1) generator = PagesGenerator(settings.copy(), settings, CUR_DIR, settings['THEME'], None, @@ -189,14 +190,14 @@ class TestPageGenerator(unittest.TestCase): hidden_pages = self.distill_pages(generator.hidden_pages) pages_expected = [ - [u'This is a test page', 'published', 'page'], - [u'This is a markdown test page', 'published', 'page'], - [u'This is a test page with a preset template', 'published', 'custom'] + ['This is a test page', 'published', 'page'], + ['This is a markdown test page', 'published', 'page'], + ['This is a test page with a preset template', 'published', 'custom'] ] hidden_pages_expected = [ - [u'This is a test hidden page', 'hidden', 'page'], - [u'This is a markdown test hidden page', 'hidden', 'page'], - [u'This is a test hidden page with a custom template', 'hidden', 'custom'] + ['This is a test hidden page', 'hidden', 'page'], + ['This is a markdown test hidden page', 'hidden', 'page'], + ['This is a test hidden page with a custom template', 'hidden', 'custom'] ] self.assertItemsEqual(pages_expected,pages) diff --git a/tests/test_importer.py b/tests/test_importer.py index 449a7643..a79cd493 100644 --- a/tests/test_importer.py +++ b/tests/test_importer.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function import os @@ -9,7 +10,7 @@ CUR_DIR = os.path.dirname(__file__) WORDPRESS_XML_SAMPLE = os.path.join(CUR_DIR, 'content', 'wordpressexport.xml') try: - import BeautifulSoup + from bs4 import BeautifulSoup except ImportError: BeautifulSoup = False # NOQA @@ -48,26 +49,6 @@ class TestWordpressXmlImporter(unittest.TestCase): strip_raw=True)) self.assertFalse(any('Multi-line metadata should be'\ - u' supported\nas well as inline'\ - u' markup.

          \n', + 'summary': '

          Multi-line metadata should be'\ + ' supported\nas well as inline'\ + ' markup.

          \n', 'date': datetime.datetime(2010, 12, 2, 10, 14), 'tags': ['foo', 'bar', 'foobar'], 'custom_field': 'http://notmyidea.org', @@ -40,7 +41,7 @@ class RstReaderTest(unittest.TestCase): settings={}) expected = { 'category': 'yeah', - 'author': u'Alexis Métaireau', + 'author': 'Alexis Métaireau', 'title': 'Rst with filename metadata', } for key, value in metadata.items(): @@ -53,7 +54,7 @@ class RstReaderTest(unittest.TestCase): }) expected = { 'category': 'yeah', - 'author': u'Alexis Métaireau', + 'author': 'Alexis Métaireau', 'title': 'Rst with filename metadata', 'date': datetime.datetime(2012, 11, 29), } @@ -69,7 +70,7 @@ class RstReaderTest(unittest.TestCase): }) expected = { 'category': 'yeah', - 'author': u'Alexis Métaireau', + 'author': 'Alexis Métaireau', 'title': 'Rst with filename metadata', 'date': datetime.datetime(2012, 11, 29), 'slug': 'article_with_filename_metadata', @@ -101,7 +102,7 @@ class RstReaderTest(unittest.TestCase): # otherwise, typogrify should be applied content, _ = readers.read_file(_filename('article.rst'), settings={'TYPOGRIFY': True}) - expected = u"

          This is some content. With some stuff to "\ + expected = "

          This is some content. With some stuff to "\ "“typogrify”.

          \n

          Now with added "\ 'support for '\ 'TLA.

          \n' @@ -168,7 +169,7 @@ class MdReaderTest(unittest.TestCase): settings={}) expected = { 'category': 'yeah', - 'author': u'Alexis Métaireau', + 'author': 'Alexis Métaireau', } for key, value in expected.items(): self.assertEquals(value, metadata[key], key) @@ -180,7 +181,7 @@ class MdReaderTest(unittest.TestCase): }) expected = { 'category': 'yeah', - 'author': u'Alexis Métaireau', + 'author': 'Alexis Métaireau', 'date': datetime.datetime(2012, 11, 30), } for key, value in expected.items(): @@ -195,7 +196,7 @@ class MdReaderTest(unittest.TestCase): }) expected = { 'category': 'yeah', - 'author': u'Alexis Métaireau', + 'author': 'Alexis Métaireau', 'date': datetime.datetime(2012, 11, 30), 'slug': 'md_w_filename_meta', 'mymeta': 'foo', @@ -203,20 +204,6 @@ class MdReaderTest(unittest.TestCase): for key, value in expected.items(): self.assertEquals(value, metadata[key], key) - @unittest.skipUnless(readers.Markdown, "markdown isn't installed") - def test_article_with_summary_metadata(self): - reader = readers.MarkdownReader({}) - content, metadata = reader.read( - _filename('article_with_markdown_and_summary_metadata_single.md')) - expected_summary = u'

          A single-line summary should be supported'\ - u' as well as inline markup.

          ' - self.assertEquals(expected_summary, metadata['summary'], 'summary') - content, metadata = reader.read( - _filename('article_with_markdown_and_summary_metadata_multi.md')) - expected_summary = u'

          A multi-line summary should be supported'\ - u'\nas well as inline markup.

          ' - self.assertEquals(expected_summary, metadata['summary'], 'summary') - class AdReaderTest(unittest.TestCase): @unittest.skipUnless(readers.asciidoc, "asciidoc isn't installed") diff --git a/tests/test_settings.py b/tests/test_settings.py index 379e3deb..0e610c55 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function import copy from os.path import dirname, abspath, join @@ -16,7 +18,7 @@ class TestSettingsConfiguration(unittest.TestCase): self.settings = read_settings(default_conf) def test_overwrite_existing_settings(self): - self.assertEqual(self.settings.get('SITENAME'), u"Alexis' log") + self.assertEqual(self.settings.get('SITENAME'), "Alexis' log") self.assertEqual(self.settings.get('SITEURL'), 'http://blog.notmyidea.org') diff --git a/tests/test_utils.py b/tests/test_utils.py index eda1388a..eddb3e25 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function import shutil import os import datetime @@ -41,10 +42,10 @@ class TestUtils(unittest.TestCase): samples = (('this is a test', 'this-is-a-test'), ('this is a test', 'this-is-a-test'), - (u'this → is ← a ↑ test', 'this-is-a-test'), + ('this → is ← a ↑ test', 'this-is-a-test'), ('this--is---a test', 'this-is-a-test'), - (u'unicode測試許功蓋,你看到了嗎?', 'unicodece-shi-xu-gong-gai-ni-kan-dao-liao-ma'), - (u'大飯原発4号機、18日夜起動へ', 'da-fan-yuan-fa-4hao-ji-18ri-ye-qi-dong-he'),) + ('unicode測試許功蓋,你看到了嗎?', 'unicodece-shi-xu-gong-gai-ni-kan-dao-liao-ma'), + ('大飯原発4号機、18日夜起動へ', 'da-fan-yuan-fa-4hao-ji-18ri-ye-qi-dong-he'),) for value, expected in samples: self.assertEquals(utils.slugify(value), expected) diff --git a/tests/test_webassets.py b/tests/test_webassets.py index ceba7775..87b2789c 100644 --- a/tests/test_webassets.py +++ b/tests/test_webassets.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# from __future__ import unicode_literals import hashlib import os diff --git a/tox.ini b/tox.ini index f7d9cf82..8c3961b9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,74 @@ +# This tests the unified codebase (py26-py32) of Pelican. +# depends on some external libraries that aren't released yet. +# +# To run Pelican, you will already have checked out and installed them. +# +# Now we must tell tox about this package, otherwise tox would load the old +# libraries from PyPi. +# +# Run tox from the libraries source tree. It will save its package in +# the distshare directory from where the tests here will pick it up. +# +# Do that for +# https://github.com/dmdm/smartypants.git +# +# and typogrify: +# https://github.com/dmdm/typogrify/tree/py3k +# +# and webassets: +# https://github.com/dmdm/webassets/tree/py3k +# +# +# CAVEAT: +# ------- +# +# 1/ +# Please be aware that my ports of typogrify and webassets are just 2to3'd. +# They are not backwards compatible with Python 2. +# +# 2/ +# Webassets still has unresolved issues, so I deactivated it for Py32 tests. + + [tox] -envlist = py26,py27 +envlist = py26,py27,py32 [testenv] commands = - nosetests -s tests unit2 discover [] + nosetests -s tests +deps = + +[testenv:py26] deps = nose unittest2 mock Markdown - BeautifulSoup + BeautifulSoup4 + feedgenerator typogrify webassets + +[testenv:py27] +deps = + nose + unittest2 + mock + Markdown + BeautifulSoup4 + feedgenerator + typogrify + webassets + +[testenv:py32] +deps = + nose + unittest2py3k + mock + Markdown + BeautifulSoup4 + feedgenerator +# {distshare}/smartypants-1.6.0.3.zip +# {distshare}/typogrify-2.0.0.zip +# {distshare}/webassets-0.8.dev.zip From d1b238638cb39442a0154740c43a89c608cee634 Mon Sep 17 00:00:00 2001 From: Dirk Makowski Date: Fri, 11 Jan 2013 03:21:06 +0100 Subject: [PATCH 329/359] Update the "how to contribute" docs with py3k info. --- docs/contribute.rst | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/docs/contribute.rst b/docs/contribute.rst index c302dcc6..3ab86263 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -58,6 +58,21 @@ To do so, you can use the following two commands:: samples/content/ $ LC_ALL="C" pelican -o tests/output/basic/ samples/content/ +testing for python3 +------------------- + +On Python 3, if you have installed the Py3k compatible versions of the +plugins manual testing with ``unit2 discover`` is also straightforward. + +However, you must tell tox to use those Py3k libraries. If you forget this, +tox will pull the regular packages from PyPi and the tests will fail. + +Tell tox about the local packages thusly: enter the source directory of +smartypants and run tox there. Do this again for typogrify and webassets. +Smartypants and typogrify do not have real tests, and webassets will fail +noisily, but as a result we get these libraries neatly packaged in tox's +distshare directory. And this we need to run tox for Pelican. + Coding standards ================ @@ -67,3 +82,44 @@ eased via the `pep8 `_ or `flake8 `_ tools, the latter of which in particular will give you some useful hints about ways in which the code/formatting can be improved. + +Python3 support +=============== + +Here are some tips that may be useful when doing some code for both python2 and +python3 at the same time: + +- Assume, every string and literal is unicode (import unicode_literals): + + - Do not use prefix ``u'``. + - Do not encode/decode strings in the middle of sth. Follow the code to the + source (or target) of a string and encode/decode at the first/last possible + point. + - In other words, write your functions to expect and to return unicode. + - Encode/decode strings if e.g. the source is a Python function that is known + to handle this badly, e.g. strftime() in Python 2. + +- Use new syntax: print function, "except ... *as* e" (not comma) etc. +- Refactor method calls like ``dict.iteritems()``, ``xrange()`` etc. in a way + that runs without code change in both Python versions. +- Do not use magic method ``__unicode()__`` in new classes. Use only ``__str()__`` + and decorate the class with ``@python_2_unicode_compatible``. +- Do not start int literals with a zero. This is a syntax error in Py3k. +- Unfortunately I did not find an octal notation that is valid in both + Pythons. Use decimal instead. +- use six, e.g.: + + - ``isinstance(.., basestring) -> isinstance(.., six.string_types)`` + - ``isinstance(.., unicode) -> isinstance(.., six.text_type)`` + +- ``setlocale()`` in Python 2 bails when we give the locale name as unicode, + and since we are using ``from __future__ import unicode_literals``, we do + that everywhere! As a workaround, I enclosed the localename with ``str()``; + in Python 2 this casts the name to a byte string, in Python 3 this should do + nothing, because the locale name already had been unicode. + +- Kept range() almost everywhere as-is (2to3 suggests list(range())), just + changed it where I felt necessary. + +- Changed xrange() back to range(), so it is valid in both Python versions. + From 1197e09626b9c3607b8a287fff769e9c34c01503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Fri, 11 Jan 2013 18:44:35 +0100 Subject: [PATCH 330/359] Revert previously erased changes --- pelican/tools/pelican_import.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index b1a2865f..c373cfd4 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -303,7 +303,7 @@ def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=Fals def main(): parser = argparse.ArgumentParser( description="Transform feed, Wordpress or Dotclear files to reST (rst) " - "or Markdown (md) files. Be sure to have pandoc installed", + "or Markdown (md) files. Be sure to have pandoc installed.", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument(dest='input', help='The input file to read') @@ -323,10 +323,10 @@ def main(): help="Strip raw HTML code that can't be converted to " "markup such as flash embeds or iframes (wordpress import only)") parser.add_argument('--disable-slugs', action='store_true', - dest='disable_slugs', - help='Disable storing slugs from imported posts within output. ' - 'With this disabled, your Pelican URLs may not be consistent ' - 'with your original posts.') + dest='disable_slugs', + help='Disable storing slugs from imported posts within output. ' + 'With this disabled, your Pelican URLs may not be consistent ' + 'with your original posts.') args = parser.parse_args() @@ -358,4 +358,4 @@ def main(): fields2pelican(fields, args.markup, args.output, dircat=args.dircat or False, strip_raw=args.strip_raw or False, - strip_slugs=args.disable_slugs or False) + disable_slugs=args.disable_slugs or False) From 4ac094966e06eac5d540debbd166162297a768d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Fri, 11 Jan 2013 18:47:22 +0100 Subject: [PATCH 331/359] remove py2.6 support --- tox.ini | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/tox.ini b/tox.ini index 8c3961b9..bc6578ac 100644 --- a/tox.ini +++ b/tox.ini @@ -31,7 +31,7 @@ [tox] -envlist = py26,py27,py32 +envlist = py27,py32 [testenv] commands = @@ -39,17 +39,6 @@ commands = nosetests -s tests deps = -[testenv:py26] -deps = - nose - unittest2 - mock - Markdown - BeautifulSoup4 - feedgenerator - typogrify - webassets - [testenv:py27] deps = nose From 149ca493e0b904a6bafd234cf05d3ea568878dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Fri, 11 Jan 2013 18:55:04 +0100 Subject: [PATCH 332/359] Annotate py3k code when needed. --- pelican/generators.py | 2 +- pelican/plugins/sitemap.py | 2 ++ pelican/readers.py | 1 + pelican/tools/pelican_import.py | 4 +++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index 0d2fa6a9..ce102a31 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -120,7 +120,7 @@ class Generator(object): for item in items: value = getattr(self, item) if hasattr(value, 'items'): - value = list(value.items()) + value = list(value.items()) # py3k safeguard for iterators self.context[item] = value diff --git a/pelican/plugins/sitemap.py b/pelican/plugins/sitemap.py index 0ade1288..8043baad 100644 --- a/pelican/plugins/sitemap.py +++ b/pelican/plugins/sitemap.py @@ -89,6 +89,7 @@ class SitemapGenerator(object): 'yearly', 'never') if isinstance(pris, dict): + # We use items for Py3k compat. .iteritems() otherwise for k, v in pris.items(): if k in valid_keys and not isinstance(v, (int, float)): default = self.priorities[k] @@ -102,6 +103,7 @@ class SitemapGenerator(object): warning("sitemap plugin: using the default values") if isinstance(chfreqs, dict): + # .items() for py3k compat. for k, v in chfreqs.items(): if k in valid_keys and v not in valid_chfreqs: default = self.changefreqs[k] diff --git a/pelican/readers.py b/pelican/readers.py index b182b6fa..5c2ae58c 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -246,6 +246,7 @@ def read_file(filename, fmt=None, settings=None): if filename_metadata: match = re.match(filename_metadata, base) if match: + # .items() for py3k compat. for k, v in match.groupdict().items(): if k not in metadata: k = k.lower() # metadata must be lowercase diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index c373cfd4..33041b0e 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -4,9 +4,11 @@ from __future__ import unicode_literals, print_function import argparse try: + # py3k import from html.parser import HTMLParser except ImportError: - from HTMLParser import HTMLParser + # py2 import + from HTMLParser import HTMLParser # NOQA import os import subprocess import sys From d7caaded3fcb2f0a45125973fc0672c1355252f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Fri, 11 Jan 2013 21:24:04 +0100 Subject: [PATCH 333/359] Use the en-us locale for functional tests --- tests/test_pelican.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index e5de0608..4c451794 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -10,8 +10,6 @@ from shutil import rmtree import locale import logging -from mock import patch - from pelican import Pelican from pelican.settings import read_settings from .support import LogCountHandler @@ -73,6 +71,7 @@ class TestPelican(unittest.TestCase): settings = read_settings(filename=None, override={ 'PATH': INPUT_PATH, 'OUTPUT_PATH': self.temp_path, + 'LOCALE': locale.normalize('en_US'), }) pelican = Pelican(settings=settings) pelican.run() @@ -88,6 +87,7 @@ class TestPelican(unittest.TestCase): settings = read_settings(filename=SAMPLE_CONFIG, override={ 'PATH': INPUT_PATH, 'OUTPUT_PATH': self.temp_path, + 'LOCALE': locale.normalize('en_US'), }) pelican = Pelican(settings=settings) pelican.run() From 476f2980ceaa553d65e127b12f34e8687543e17f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 15 Jan 2013 14:23:00 +0100 Subject: [PATCH 334/359] Damn, I forgot to update travis. --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e92b0abc..7ccdafd5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,7 @@ language: python python: - - "2.6" - "2.7" -# - "3.2" + - "3.2" before_install: - sudo apt-get update -qq - sudo apt-get install -qq ruby-sass From 2c434ebac1c64ac2da85cdeeadeaf2c3bd5307cc Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 3 Jan 2013 13:54:56 -0500 Subject: [PATCH 335/359] contents: Add rich comparisons to URLWrapper for easy sorting There have been earlier attempts to sort categories and authors [1,2,3], but they either sorted based on the object id [3], or only sorted the main author and categories list. This patch uses rich comparisons (keyed off URLWrapper.name, but easily adjustable in subclasses) to make the objects sortable without specifying a key for each sort. For example, now {% for tag, articles in tags|sort %} works as expected in a Jinja template. The functools.total_ordering decorator fills in the missing rich comparisons [4,5]. [1]: 877d454c8fa979343d4881a00977d9ac8786f178 [2]: 7f36e0ed20745c73886d96d4af303b0d858b8a53 [3]: d0ec18f4dbd623c55bdf4928ee7c363f699ef696 [4]: http://docs.python.org/2/library/functools.html#functools.total_ordering [5]: http://docs.python.org/3/library/functools.html#functools.total_ordering --- pelican/contents.py | 16 +++++++++++++++- pelican/generators.py | 3 +-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index 4655d4cc..bd257ad8 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -243,7 +243,9 @@ class Article(Page): class Quote(Page): base_properties = ('author', 'date') + @python_2_unicode_compatible +@functools.total_ordering class URLWrapper(object): def __init__(self, name, settings): self.name = name @@ -256,8 +258,20 @@ class URLWrapper(object): def __hash__(self): return hash(self.name) + def _key(self): + return self.name + + def _normalize_key(self, key): + return six.text_type(key) + def __eq__(self, other): - return self.name == other + return self._key() == self._normalize_key(other) + + def __ne__(self, other): + return self._key() != self._normalize_key(other) + + def __lt__(self, other): + return self._key() < self._normalize_key(other) def __str__(self): return self.name diff --git a/pelican/generators.py b/pelican/generators.py index ce102a31..49b6bc1d 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -416,11 +416,10 @@ class ArticlesGenerator(Generator): # order the categories per name self.categories = list(self.categories.items()) self.categories.sort( - key=lambda item: item[0].name, reverse=self.settings['REVERSE_CATEGORY_ORDER']) self.authors = list(self.authors.items()) - self.authors.sort(key=lambda item: item[0].name) + self.authors.sort() self._update_context(('articles', 'dates', 'tags', 'categories', 'tag_cloud', 'authors', 'related_posts')) From 656b5150ff26988d71d41fb32f2f75aeca665617 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 15 Jan 2013 16:32:11 -0500 Subject: [PATCH 336/359] docs/themes.rst: Document URLWrapper sorting for use in Jinja templates --- docs/themes.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/themes.rst b/docs/themes.rst index 664b4466..19fd9274 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -68,6 +68,19 @@ categories A list of (category, articles) tuples, containing pages The list of pages ============= =================================================== +Sorting +------- + +URL wrappers (currently categories, tags, and authors), have +comparison methods that allow them to be easily sorted by name: + + {% for tag, articles in tags|sort %} + +If you want to sort based on different criteria, `Jinja's sort +command`__ has a number of options. + +__ http://jinja.pocoo.org/docs/templates/#sort + index.html ---------- From bebb94c15be1ae7ff7ec241f6e1de5aa18556654 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 15 Jan 2013 22:50:58 -0500 Subject: [PATCH 337/359] test_contents.py: Add URLWrapper comparison tests The name switch between wrapper_a and wrapper_b ensures that we're not secretly comparing some other field (e.g. id(object)). --- tests/test_contents.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/test_contents.py b/tests/test_contents.py index eb7b6514..9b5673bd 100644 --- a/tests/test_contents.py +++ b/tests/test_contents.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals from .support import unittest -from pelican.contents import Page, Article +from pelican.contents import Page, Article, URLWrapper from pelican.settings import _DEFAULT_CONFIG from pelican.utils import truncate_html_words from pelican.signals import content_object_init @@ -187,3 +188,31 @@ class TestArticle(TestPage): article_kwargs['metadata']['template'] = 'custom' custom_article = Article(**article_kwargs) self.assertEqual('custom', custom_article.template) + + +class TestURLWrapper(unittest.TestCase): + def test_comparisons(self): + """URLWrappers are sorted by name + """ + wrapper_a = URLWrapper(name='first', settings={}) + wrapper_b = URLWrapper(name='last', settings={}) + self.assertFalse(wrapper_a > wrapper_b) + self.assertFalse(wrapper_a >= wrapper_b) + self.assertFalse(wrapper_a == wrapper_b) + self.assertTrue(wrapper_a != wrapper_b) + self.assertTrue(wrapper_a <= wrapper_b) + self.assertTrue(wrapper_a < wrapper_b) + wrapper_b.name = 'first' + self.assertFalse(wrapper_a > wrapper_b) + self.assertTrue(wrapper_a >= wrapper_b) + self.assertTrue(wrapper_a == wrapper_b) + self.assertFalse(wrapper_a != wrapper_b) + self.assertTrue(wrapper_a <= wrapper_b) + self.assertFalse(wrapper_a < wrapper_b) + wrapper_a.name = 'last' + self.assertTrue(wrapper_a > wrapper_b) + self.assertTrue(wrapper_a >= wrapper_b) + self.assertFalse(wrapper_a == wrapper_b) + self.assertTrue(wrapper_a != wrapper_b) + self.assertFalse(wrapper_a <= wrapper_b) + self.assertFalse(wrapper_a < wrapper_b) From 733ab8ae6ce59749ca9152bb5ad5cdca50a3e688 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 15 Jan 2013 23:05:48 -0500 Subject: [PATCH 338/359] test_contents: Add tests for metadata export from Page.url_format --- tests/test_contents.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_contents.py b/tests/test_contents.py index a8b9877f..ba94e14e 100644 --- a/tests/test_contents.py +++ b/tests/test_contents.py @@ -99,6 +99,16 @@ class TestPage(unittest.TestCase): page = Page(**self.page_kwargs) self.assertEqual(page.save_as, "pages/foo-bar-fr.html") + def test_metadata_url_format(self): + """Arbitrary metadata should be passed through url_format() + """ + page = Page(**self.page_kwargs) + self.assertIn('summary', page.url_format.keys()) + page.metadata['directory'] = 'test-dir' + page.settings = _DEFAULT_CONFIG.copy() + page.settings['PAGE_SAVE_AS'] = '{directory}/{slug}' + self.assertEqual(page.save_as, 'test-dir/foo-bar') + def test_datetime(self): """If DATETIME is set to a tuple, it should be used to override LOCALE """ From d2a221c8998dff7adb4baa75c4c0f2953187cb7f Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 17 Jan 2013 09:49:03 -0500 Subject: [PATCH 339/359] contents: Encode Unicode locales for Python 2 in Page.__init__ Python 2.7 chokes on Unicode locales: $ python2.7 >>> import locale >>> locale.setlocale(locale.LC_ALL, u'ja_JP.utf8') Traceback (most recent call last): ... ValueError: too many values to unpack With the addition of: from __future__ import unicode_literals to tests/test_contents.py in: commit bebb94c15be1ae7ff7ec241f6e1de5aa18556654 Author: W. Trevor King Date: Tue Jan 15 22:50:58 2013 -0500 test_contents.py: Add URLWrapper comparison tests the locale strings in TestPage.test_datetime are interpreted as Unicode. Rather than fixing the encoding there, this patch updates Page to handle Unicode locales automatically. --- pelican/contents.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pelican/contents.py b/pelican/contents.py index bd257ad8..dc38e32f 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -8,6 +8,7 @@ import logging import functools import os import re +import sys from datetime import datetime from sys import platform, stdin @@ -86,7 +87,10 @@ class Page(object): self.date_format = settings['DEFAULT_DATE_FORMAT'] if isinstance(self.date_format, tuple): - locale.setlocale(locale.LC_ALL, self.date_format[0]) + locale_string = self.date_format[0] + if sys.version_info < (3, ) and isinstance(locale_string, six.text_type): + locale_string = locale_string.encode('ascii') + locale.setlocale(locale.LC_ALL, locale_string) self.date_format = self.date_format[1] if hasattr(self, 'date'): From 61f05672e651f185a6e78dc5827502ba0ff93137 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 4 Jan 2013 13:08:08 -0500 Subject: [PATCH 340/359] content: Convert StaticContent.filepath to .filename For reasons that are unclear to me, StaticContent introduces the `filepath` attribute rather than using the existing (and semantically equivalent) Page.filename. This has caused confusion before [1], and it's probably a good idea to merge the two. While I was touching the line, I also updated the string formatting in StaticGenerator.generate_output to use the forward compatible '{}'.format() syntax. [1]: https://github.com/getpelican/pelican/issues/162#issuecomment-3000363 --- pelican/contents.py | 4 ++-- pelican/generators.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index 43333e18..89e0397d 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -305,11 +305,11 @@ class StaticContent(object): settings = copy.deepcopy(_DEFAULT_CONFIG) self.src = src self.url = dst or src - self.filepath = os.path.join(settings['PATH'], src) + self.filename = os.path.join(settings['PATH'], src) self.save_as = os.path.join(settings['OUTPUT_PATH'], self.url) def __str__(self): - return self.filepath + return self.filename def is_valid_content(content, f): diff --git a/pelican/generators.py b/pelican/generators.py index ce102a31..664f666c 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -520,8 +520,8 @@ class StaticGenerator(Generator): # copy all StaticContent files for sc in self.staticfiles: mkdir_p(os.path.dirname(sc.save_as)) - shutil.copy(sc.filepath, sc.save_as) - logger.info('copying %s to %s' % (sc.filepath, sc.save_as)) + shutil.copy(sc.filename, sc.save_as) + logger.info('copying {} to {}'.format(sc.filename, sc.save_as)) class PdfGenerator(Generator): From 004adfa5ccbb840a585bff6dd6bfd7f65cfeaad9 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 4 Jan 2013 10:50:09 -0500 Subject: [PATCH 341/359] content: Convert Path.filename to .source_path Making everything consistent is a bit awkward, since this is a commonly used attribute, but I've done my best. Reasons for not consolidating on `filename`: * It is often used for the "basename" (last component in the path). Using `source_path` makes it clear that this attribute can contain multiple components. Reasons for not consolidating on `filepath`: * It is barely used in the Pelican source, and therefore easy to change. * `path` is more Pythonic. The only place `filepath` ever show up in the documentation for `os`, `os.path`, and `shutil` is in the `os.path.relpath` documentation [1]. Reasons for not consolidating on `path`: * The Page elements have both a source (this attribute) and a destination (.save_as). To avoid confusion for developers not aware of this, make it painfully obvious that this attribute is for the source. Explicit is better than implicit ;). Where I was touching the line, I also updated the string formatting in StaticGenerator.generate_output to use the forward compatible '{}'.format() syntax. [1]: http://docs.python.org/2/library/os.path.html#os.path.relpath --- pelican/contents.py | 29 +++++++++++++++-------------- pelican/generators.py | 28 ++++++++++++++-------------- pelican/readers.py | 34 +++++++++++++++++----------------- pelican/settings.py | 14 +++++++------- pelican/utils.py | 33 +++++++++++++++++---------------- pelican/writers.py | 22 +++++++++++----------- 6 files changed, 81 insertions(+), 79 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index 89e0397d..88518b0a 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -32,7 +32,7 @@ class Page(object): default_template = 'page' def __init__(self, content, metadata=None, settings=None, - filename=None, context=None): + source_path=None, context=None): # init parameters if not metadata: metadata = {} @@ -75,8 +75,8 @@ class Page(object): if not hasattr(self, 'slug') and hasattr(self, 'title'): self.slug = slugify(self.title) - if filename: - self.filename = filename + if source_path: + self.source_path = source_path # manage the date format if not hasattr(self, 'date_format'): @@ -160,8 +160,8 @@ class Page(object): if value.startswith('/'): value = value[1:] else: - # relative to the filename of this content - value = self.get_relative_filename( + # relative to the source path of this content + value = self.get_relative_source_path( os.path.join(self.relative_dir, value) ) @@ -215,24 +215,25 @@ class Page(object): else: return self.default_template - def get_relative_filename(self, filename=None): + def get_relative_source_path(self, source_path=None): """Return the relative path (from the content path) to the given - filename. + source_path. - If no filename is specified, use the filename of this content object. + If no source path is specified, use the source path of this + content object. """ - if not filename: - filename = self.filename + if not source_path: + source_path = self.source_path return os.path.relpath( - os.path.abspath(os.path.join(self.settings['PATH'], filename)), + os.path.abspath(os.path.join(self.settings['PATH'], source_path)), os.path.abspath(self.settings['PATH']) ) @property def relative_dir(self): return os.path.dirname(os.path.relpath( - os.path.abspath(self.filename), + os.path.abspath(self.source_path), os.path.abspath(self.settings['PATH'])) ) @@ -305,11 +306,11 @@ class StaticContent(object): settings = copy.deepcopy(_DEFAULT_CONFIG) self.src = src self.url = dst or src - self.filename = os.path.join(settings['PATH'], src) + self.source_path = os.path.join(settings['PATH'], src) self.save_as = os.path.join(settings['OUTPUT_PATH'], self.url) def __str__(self): - return self.filename + return self.source_path def is_valid_content(content, f): diff --git a/pelican/generators.py b/pelican/generators.py index 664f666c..01d9fc9b 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -108,8 +108,8 @@ class Generator(object): files.append(os.sep.join((root, f))) return files - def add_filename(self, content): - location = os.path.relpath(os.path.abspath(content.filename), + def add_source_path(self, content): + location = os.path.relpath(os.path.abspath(content.source_path), os.path.abspath(self.path)) self.context['filenames'][location] = content @@ -352,11 +352,11 @@ class ArticlesGenerator(Generator): signals.article_generate_context.send(self, metadata=metadata) article = Article(content, metadata, settings=self.settings, - filename=f, context=self.context) + source_path=f, context=self.context) if not is_valid_content(article, f): continue - self.add_filename(article) + self.add_source_path(article) if article.status == "published": if hasattr(article, 'tags'): @@ -455,11 +455,11 @@ class PagesGenerator(Generator): continue signals.pages_generate_context.send(self, metadata=metadata) page = Page(content, metadata, settings=self.settings, - filename=f, context=self.context) + source_path=f, context=self.context) if not is_valid_content(page, f): continue - self.add_filename(page) + self.add_source_path(page) if page.status == "published": all_pages.append(page) @@ -520,8 +520,8 @@ class StaticGenerator(Generator): # copy all StaticContent files for sc in self.staticfiles: mkdir_p(os.path.dirname(sc.save_as)) - shutil.copy(sc.filename, sc.save_as) - logger.info('copying {} to {}'.format(sc.filename, sc.save_as)) + shutil.copy(sc.source_path, sc.save_as) + logger.info('copying {} to {}'.format(sc.source_path, sc.save_as)) class PdfGenerator(Generator): @@ -544,11 +544,11 @@ class PdfGenerator(Generator): raise Exception("unable to find rst2pdf") def _create_pdf(self, obj, output_path): - if obj.filename.endswith(".rst"): + if obj.source_path.endswith('.rst'): filename = obj.slug + ".pdf" output_pdf = os.path.join(output_path, filename) - # print "Generating pdf for", obj.filename, " in ", output_pdf - with open(obj.filename) as f: + # print('Generating pdf for', obj.source_path, 'in', output_pdf) + with open(obj.source_path) as f: self.pdfcreator.createPdf(text=f.read(), output=output_pdf) logger.info(' [ok] writing %s' % output_pdf) @@ -578,9 +578,9 @@ class SourceFileGenerator(Generator): self.output_extension = self.settings['OUTPUT_SOURCES_EXTENSION'] def _create_source(self, obj, output_path): - filename = os.path.splitext(obj.save_as)[0] - dest = os.path.join(output_path, filename + self.output_extension) - copy('', obj.filename, dest) + output_path = os.path.splitext(obj.save_as)[0] + dest = os.path.join(output_path, output_path + self.output_extension) + copy('', obj.source_path, dest) def generate_output(self, writer=None): logger.info(' Generating source files...') diff --git a/pelican/readers.py b/pelican/readers.py index 5c2ae58c..440bbdf8 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -109,20 +109,20 @@ class RstReader(Reader): output[name] = self.process_metadata(name, value) return output - def _get_publisher(self, filename): + def _get_publisher(self, source_path): extra_params = {'initial_header_level': '2'} pub = docutils.core.Publisher( destination_class=docutils.io.StringOutput) pub.set_components('standalone', 'restructuredtext', 'html') pub.writer.translator_class = PelicanHTMLTranslator pub.process_programmatic_settings(None, extra_params, None) - pub.set_source(source_path=filename) + pub.set_source(source_path=source_path) pub.publish() return pub - def read(self, filename): + def read(self, source_path): """Parses restructured text""" - pub = self._get_publisher(filename) + pub = self._get_publisher(source_path) parts = pub.writer.parts content = parts.get('body') @@ -151,9 +151,9 @@ class MarkdownReader(Reader): output[name] = self.process_metadata(name, value[0]) return output - def read(self, filename): + def read(self, source_path): """Parse content and metadata of markdown files""" - text = pelican_open(filename) + text = pelican_open(source_path) md = Markdown(extensions=set(self.extensions + ['meta'])) content = md.convert(text) @@ -165,9 +165,9 @@ class HtmlReader(Reader): file_extensions = ['html', 'htm'] _re = re.compile('\<\!\-\-\#\s?[A-z0-9_-]*\s?\:s?[A-z0-9\s_-]*\s?\-\-\>') - def read(self, filename): + def read(self, source_path): """Parse content and metadata of (x)HTML files""" - with open(filename) as content: + with open(source_path) as content: metadata = {'title': 'unnamed'} for i in self._re.findall(content): key = i.split(':')[0][5:].strip() @@ -183,10 +183,10 @@ class AsciiDocReader(Reader): file_extensions = ['asc'] default_options = ["--no-header-footer", "-a newline=\\n"] - def read(self, filename): + def read(self, source_path): """Parse content and metadata of asciidoc files""" from cStringIO import StringIO - text = StringIO(pelican_open(filename)) + text = StringIO(pelican_open(source_path)) content = StringIO() ad = AsciiDocAPI() @@ -216,14 +216,14 @@ for cls in Reader.__subclasses__(): _EXTENSIONS[ext] = cls -def read_file(filename, fmt=None, settings=None): +def read_file(path, fmt=None, settings=None): """Return a reader object using the given format.""" - base, ext = os.path.splitext(os.path.basename(filename)) + base, ext = os.path.splitext(os.path.basename(path)) if not fmt: fmt = ext[1:] if fmt not in _EXTENSIONS: - raise TypeError('Pelican does not know how to parse %s' % filename) + raise TypeError('Pelican does not know how to parse {}'.format(path)) reader = _EXTENSIONS[fmt](settings) settings_key = '%s_EXTENSIONS' % fmt.upper() @@ -234,7 +234,7 @@ def read_file(filename, fmt=None, settings=None): if not reader.enabled: raise ValueError("Missing dependencies for %s" % fmt) - content, metadata = reader.read(filename) + content, metadata = reader.read(path) # eventually filter the content with typogrify if asked so if settings and settings.get('TYPOGRIFY'): @@ -242,9 +242,9 @@ def read_file(filename, fmt=None, settings=None): content = typogrify(content) metadata['title'] = typogrify(metadata['title']) - filename_metadata = settings and settings.get('FILENAME_METADATA') - if filename_metadata: - match = re.match(filename_metadata, base) + file_metadata = settings and settings.get('FILENAME_METADATA') + if file_metadata: + match = re.match(file_metadata, base) if match: # .items() for py3k compat. for k, v in match.groupdict().items(): diff --git a/pelican/settings.py b/pelican/settings.py index 9c0d8434..e4e0501d 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -84,15 +84,15 @@ _DEFAULT_CONFIG = {'PATH': '.', } -def read_settings(filename=None, override=None): - if filename: - local_settings = get_settings_from_file(filename) +def read_settings(path=None, override=None): + if path: + local_settings = get_settings_from_file(path) # Make the paths relative to the settings file for p in ['PATH', 'OUTPUT_PATH', 'THEME']: if p in local_settings and local_settings[p] is not None \ and not isabs(local_settings[p]): absp = os.path.abspath(os.path.normpath(os.path.join( - os.path.dirname(filename), local_settings[p]))) + os.path.dirname(path), local_settings[p]))) if p != 'THEME' or os.path.exists(absp): local_settings[p] = absp else: @@ -116,14 +116,14 @@ def get_settings_from_module(module=None, default_settings=_DEFAULT_CONFIG): return context -def get_settings_from_file(filename, default_settings=_DEFAULT_CONFIG): +def get_settings_from_file(path, default_settings=_DEFAULT_CONFIG): """ Load settings from a file path, returning a dict. """ - name = os.path.basename(filename).rpartition(".")[0] - module = imp.load_source(name, filename) + name = os.path.basename(path).rpartition('.')[0] + module = imp.load_source(name, path) return get_settings_from_module(module, default_settings=default_settings) diff --git a/pelican/utils.py b/pelican/utils.py index 3a41d04e..48ed0757 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -141,9 +141,9 @@ def get_date(string): raise ValueError("'%s' is not a valid date" % string) -def pelican_open(filename): +def pelican_open(path): """Open a file and return it's content""" - return open(filename, encoding='utf-8').read() + return open(path, encoding='utf-8').read() def slugify(value): @@ -245,9 +245,9 @@ def clean_output_dir(path): logger.error("Unable to delete %s, file type unknown" % file) -def get_relative_path(filename): - """Return the relative path from the given filename to the root path.""" - nslashes = filename.count('/') +def get_relative_path(path): + """Return the relative path from the given path to the root path.""" + nslashes = path.count('/') if nslashes == 0: return '.' else: @@ -344,15 +344,16 @@ def process_translations(content_list): if len_ > 1: logger.warning('there are %s variants of "%s"' % (len_, slug)) for x in default_lang_items: - logger.warning(' %s' % x.filename) + logger.warning(' {}'.format(x.source_path)) elif len_ == 0: default_lang_items = items[:1] if not slug: - msg = 'empty slug for %r. ' % default_lang_items[0].filename\ - + 'You can fix this by adding a title or a slug to your '\ - + 'content' - logger.warning(msg) + logger.warning(( + 'empty slug for {!r}. ' + 'You can fix this by adding a title or a slug to your ' + 'content' + ).format(default_lang_items[0].source_path)) index.extend(default_lang_items) translations.extend([x for x in items if x not in default_lang_items]) for a in items: @@ -388,14 +389,14 @@ def files_changed(path, extensions): FILENAMES_MTIMES = defaultdict(int) -def file_changed(filename): - mtime = os.stat(filename).st_mtime - if FILENAMES_MTIMES[filename] == 0: - FILENAMES_MTIMES[filename] = mtime +def file_changed(path): + mtime = os.stat(path).st_mtime + if FILENAMES_MTIMES[path] == 0: + FILENAMES_MTIMES[path] = mtime return False else: - if mtime > FILENAMES_MTIMES[filename]: - FILENAMES_MTIMES[filename] = mtime + if mtime > FILENAMES_MTIMES[path]: + FILENAMES_MTIMES[path] = mtime return True return False diff --git a/pelican/writers.py b/pelican/writers.py index 8374ea3e..429507a0 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -46,23 +46,23 @@ class Writer(object): pubdate=set_date_tzinfo(item.date, self.settings.get('TIMEZONE', None))) - def write_feed(self, elements, context, filename=None, feed_type='atom'): + def write_feed(self, elements, context, path=None, feed_type='atom'): """Generate a feed with the list of articles provided - Return the feed. If no output_path or filename is specified, just + Return the feed. If no path or output_path is specified, just return the feed object. :param elements: the articles to put on the feed. :param context: the context to get the feed metadata. - :param filename: the filename to output. + :param path: the path to output. :param feed_type: the feed type to use (atom or rss) """ old_locale = locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_ALL, str('C')) try: - self.site_url = context.get('SITEURL', get_relative_path(filename)) + self.site_url = context.get('SITEURL', get_relative_path(path)) self.feed_domain = context.get('FEED_DOMAIN') - self.feed_url = '%s/%s' % (self.feed_domain, filename) + self.feed_url = '{}/{}'.format(self.feed_domain, path) feed = self._create_new_feed(feed_type, context) @@ -72,8 +72,8 @@ class Writer(object): for i in range(max_items): self._add_item_to_the_feed(feed, elements[i]) - if filename: - complete_path = os.path.join(self.output_path, filename) + if path: + complete_path = os.path.join(self.output_path, path) try: os.makedirs(os.path.dirname(complete_path)) except Exception: @@ -114,14 +114,14 @@ class Writer(object): output = template.render(localcontext) finally: locale.setlocale(locale.LC_ALL, old_locale) - filename = os.sep.join((output_path, name)) + path = os.path.join(output_path, name) try: - os.makedirs(os.path.dirname(filename)) + os.makedirs(os.path.dirname(path)) except Exception: pass - with open(filename, 'w', encoding='utf-8') as f: + with open(path, 'w', encoding='utf-8') as f: f.write(output) - logger.info('writing %s' % filename) + logger.info('writing {}'.format(path)) localcontext = context.copy() if relative_urls: From 9b574361c90e8bc394b17903802935e60ecbe3f0 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 4 Jan 2013 11:17:23 -0500 Subject: [PATCH 342/359] doc: convert Markdown example to source_path and modernize --- docs/internals.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/internals.rst b/docs/internals.rst index 280e14d7..cadd300b 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -47,19 +47,17 @@ Take a look at the Markdown reader:: class MarkdownReader(Reader): enabled = bool(Markdown) - def read(self, filename): + def read(self, source_path): """Parse content and metadata of markdown files""" - text = open(filename) + text = pelican_open(source_path) md = Markdown(extensions = ['meta', 'codehilite']) content = md.convert(text) metadata = {} for name, value in md.Meta.items(): - if name in _METADATA_FIELDS: - meta = _METADATA_FIELDS[name](value[0]) - else: - meta = value[0] - metadata[name.lower()] = meta + name = name.lower() + meta = self.process_metadata(name, value[0]) + metadata[name] = meta return content, metadata Simple, isn't it? From 54a9132aea663dcdc6d8deb350e3c3e3a3381907 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 4 Jan 2013 11:22:49 -0500 Subject: [PATCH 343/359] tests: Update tests after filename/filepath -> source_path --- tests/test_generators.py | 10 +++++----- tests/test_pelican.py | 4 ++-- tests/test_readers.py | 32 ++++++++++++++++---------------- tests/test_utils.py | 12 ++++++------ 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/test_generators.py b/tests/test_generators.py index 50f5fe3e..54fe7e61 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -229,20 +229,20 @@ class TestTemplatePagesGenerator(unittest.TestCase): # create a dummy template file template_dir = os.path.join(self.temp_content, 'template') - template_filename = os.path.join(template_dir, 'source.html') + template_path = os.path.join(template_dir, 'source.html') os.makedirs(template_dir) - with open(template_filename, 'w') as template_file: + with open(template_path, 'w') as template_file: template_file.write(self.TEMPLATE_CONTENT) writer = Writer(self.temp_output, settings=settings) generator.generate_output(writer) - output_filename = os.path.join( + output_path = os.path.join( self.temp_output, 'generated', 'file.html') # output file has been generated - self.assertTrue(os.path.exists(output_filename)) + self.assertTrue(os.path.exists(output_path)) # output content is correct - with open(output_filename, 'r') as output_file: + with open(output_path, 'r') as output_file: self.assertEquals(output_file.read(), 'foo: bar') diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 6a082676..ca0e22cc 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -70,7 +70,7 @@ class TestPelican(unittest.TestCase): def test_basic_generation_works(self): # when running pelican without settings, it should pick up the default # ones and generate correct output without raising any exception - settings = read_settings(filename=None, override={ + settings = read_settings(path=None, override={ 'PATH': INPUT_PATH, 'OUTPUT_PATH': self.temp_path, 'LOCALE': locale.normalize('en_US'), @@ -86,7 +86,7 @@ class TestPelican(unittest.TestCase): def test_custom_generation_works(self): # the same thing with a specified set of settings should work - settings = read_settings(filename=SAMPLE_CONFIG, override={ + settings = read_settings(path=SAMPLE_CONFIG, override={ 'PATH': INPUT_PATH, 'OUTPUT_PATH': self.temp_path, 'LOCALE': locale.normalize('en_US'), diff --git a/tests/test_readers.py b/tests/test_readers.py index e3cea629..75e664d5 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -11,7 +11,7 @@ CUR_DIR = os.path.dirname(__file__) CONTENT_PATH = os.path.join(CUR_DIR, 'content') -def _filename(*args): +def _path(*args): return os.path.join(CONTENT_PATH, *args) @@ -19,7 +19,7 @@ class RstReaderTest(unittest.TestCase): def test_article_with_metadata(self): reader = readers.RstReader({}) - content, metadata = reader.read(_filename('article_with_metadata.rst')) + content, metadata = reader.read(_path('article_with_metadata.rst')) expected = { 'category': 'yeah', 'author': 'Alexis Métaireau', @@ -37,7 +37,7 @@ class RstReaderTest(unittest.TestCase): def test_article_with_filename_metadata(self): content, metadata = readers.read_file( - _filename('2012-11-29_rst_w_filename_meta#foo-bar.rst'), + _path('2012-11-29_rst_w_filename_meta#foo-bar.rst'), settings={}) expected = { 'category': 'yeah', @@ -48,7 +48,7 @@ class RstReaderTest(unittest.TestCase): self.assertEquals(value, expected[key], key) content, metadata = readers.read_file( - _filename('2012-11-29_rst_w_filename_meta#foo-bar.rst'), + _path('2012-11-29_rst_w_filename_meta#foo-bar.rst'), settings={ 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2}).*' }) @@ -62,7 +62,7 @@ class RstReaderTest(unittest.TestCase): self.assertEquals(value, expected[key], key) content, metadata = readers.read_file( - _filename('2012-11-29_rst_w_filename_meta#foo-bar.rst'), + _path('2012-11-29_rst_w_filename_meta#foo-bar.rst'), settings={ 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2})_' \ '_(?P.*)' \ @@ -82,7 +82,7 @@ class RstReaderTest(unittest.TestCase): def test_article_metadata_key_lowercase(self): """Keys of metadata should be lowercase.""" reader = readers.RstReader({}) - content, metadata = reader.read(_filename('article_with_uppercase_metadata.rst')) + content, metadata = reader.read(_path('article_with_uppercase_metadata.rst')) self.assertIn('category', metadata, "Key should be lowercase.") self.assertEquals('Yeah', metadata.get('category'), "Value keeps cases.") @@ -90,7 +90,7 @@ class RstReaderTest(unittest.TestCase): def test_typogrify(self): # if nothing is specified in the settings, the content should be # unmodified - content, _ = readers.read_file(_filename('article.rst')) + content, _ = readers.read_file(_path('article.rst')) expected = "

          This is some content. With some stuff to "\ ""typogrify".

          \n

          Now with added "\ 'support for '\ @@ -100,7 +100,7 @@ class RstReaderTest(unittest.TestCase): try: # otherwise, typogrify should be applied - content, _ = readers.read_file(_filename('article.rst'), + content, _ = readers.read_file(_path('article.rst'), settings={'TYPOGRIFY': True}) expected = "

          This is some content. With some stuff to "\ "“typogrify”.

          \n

          Now with added "\ @@ -118,7 +118,7 @@ class MdReaderTest(unittest.TestCase): def test_article_with_md_extension(self): # test to ensure the md extension is being processed by the correct reader reader = readers.MarkdownReader({}) - content, metadata = reader.read(_filename('article_with_md_extension.md')) + content, metadata = reader.read(_path('article_with_md_extension.md')) expected = "

          Test Markdown File Header

          \n"\ "

          Used for pelican test

          \n"\ "

          The quick brown fox jumped over the lazy dog's back.

          " @@ -136,7 +136,7 @@ class MdReaderTest(unittest.TestCase): def test_article_with_mkd_extension(self): # test to ensure the mkd extension is being processed by the correct reader reader = readers.MarkdownReader({}) - content, metadata = reader.read(_filename('article_with_mkd_extension.mkd')) + content, metadata = reader.read(_path('article_with_mkd_extension.mkd')) expected = "

          Test Markdown File Header

          \n"\ "

          Used for pelican test

          \n"\ "

          This is another markdown test file. Uses the mkd extension.

          " @@ -147,7 +147,7 @@ class MdReaderTest(unittest.TestCase): def test_article_with_markdown_markup_extension(self): # test to ensure the markdown markup extension is being processed as expected content, metadata = readers.read_file( - _filename('article_with_markdown_markup_extensions.md'), + _path('article_with_markdown_markup_extensions.md'), settings={'MD_EXTENSIONS': ['toc', 'codehilite', 'extra']}) expected = '
          \n'\ '
            \n'\ @@ -165,7 +165,7 @@ class MdReaderTest(unittest.TestCase): @unittest.skipUnless(readers.Markdown, "markdown isn't installed") def test_article_with_filename_metadata(self): content, metadata = readers.read_file( - _filename('2012-11-30_md_w_filename_meta#foo-bar.md'), + _path('2012-11-30_md_w_filename_meta#foo-bar.md'), settings={}) expected = { 'category': 'yeah', @@ -175,7 +175,7 @@ class MdReaderTest(unittest.TestCase): self.assertEquals(value, metadata[key], key) content, metadata = readers.read_file( - _filename('2012-11-30_md_w_filename_meta#foo-bar.md'), + _path('2012-11-30_md_w_filename_meta#foo-bar.md'), settings={ 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2}).*' }) @@ -188,7 +188,7 @@ class MdReaderTest(unittest.TestCase): self.assertEquals(value, metadata[key], key) content, metadata = readers.read_file( - _filename('2012-11-30_md_w_filename_meta#foo-bar.md'), + _path('2012-11-30_md_w_filename_meta#foo-bar.md'), settings={ 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2})' '_(?P.*)' @@ -210,7 +210,7 @@ class AdReaderTest(unittest.TestCase): def test_article_with_asc_extension(self): # test to ensure the asc extension is being processed by the correct reader reader = readers.AsciiDocReader({}) - content, metadata = reader.read(_filename('article_with_asc_extension.asc')) + content, metadata = reader.read(_path('article_with_asc_extension.asc')) expected = '
            \n

            Used for pelican test

            \n'\ '

            The quick brown fox jumped over the lazy dog’s back.

            \n' self.assertEqual(content, expected) @@ -241,7 +241,7 @@ class AdReaderTest(unittest.TestCase): def test_article_with_asc_options(self): # test to ensure the ASCIIDOC_OPTIONS is being used reader = readers.AsciiDocReader(dict(ASCIIDOC_OPTIONS=["-a revision=1.0.42"])) - content, metadata = reader.read(_filename('article_with_asc_options.asc')) + content, metadata = reader.read(_path('article_with_asc_options.asc')) expected = '
            \n

            Used for pelican test

            \n'\ '

            version 1.0.42

            \n'\ '

            The quick brown fox jumped over the lazy dog’s back.

            \n' diff --git a/tests/test_utils.py b/tests/test_utils.py index eddb3e25..ea4f839c 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -79,17 +79,17 @@ class TestUtils(unittest.TestCase): """Test if file changes are correctly detected Make sure to handle not getting any files correctly""" - path = os.path.join(os.path.dirname(__file__), 'content') - filename = os.path.join(path, 'article_with_metadata.rst') - changed = utils.files_changed(path, 'rst') + dirname = os.path.join(os.path.dirname(__file__), 'content') + path = os.path.join(dirname, 'article_with_metadata.rst') + changed = utils.files_changed(dirname, 'rst') self.assertEquals(changed, True) - changed = utils.files_changed(path, 'rst') + changed = utils.files_changed(dirname, 'rst') self.assertEquals(changed, False) t = time.time() - os.utime(filename, (t, t)) - changed = utils.files_changed(path, 'rst') + os.utime(path, (t, t)) + changed = utils.files_changed(dirname, 'rst') self.assertEquals(changed, True) self.assertAlmostEqual(utils.LAST_MTIME, t, delta=1) From c3c3037a1d726f3a1e1b04a3ee0b7d88cf1c5226 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 4 Jan 2013 07:29:23 -0500 Subject: [PATCH 344/359] utils: Teach mkdir_p to fail if the existing target isn't a directory Existing symlinks to directories will still pass, because isdir() follows symbolic links. --- pelican/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/utils.py b/pelican/utils.py index 3a41d04e..40406b1a 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -416,5 +416,5 @@ def mkdir_p(path): try: os.makedirs(path) except OSError as e: - if e.errno != errno.EEXIST: + if e.errno != errno.EEXIST or not os.path.isdir(path): raise From ec50e18a3e4ed6e823126778df39c606ce7c3036 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 4 Jan 2013 13:02:30 -0500 Subject: [PATCH 345/359] utils: Add deprecated_attribute decorator --- pelican/utils.py | 43 +++++++++++++++++++++++++++++++++++++++++++ tests/test_utils.py | 11 +++++++++++ 2 files changed, 54 insertions(+) diff --git a/pelican/utils.py b/pelican/utils.py index 48ed0757..9c3bd7be 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -6,6 +6,7 @@ import os import re import pytz import shutil +import traceback import logging import errno import locale @@ -122,6 +123,48 @@ class memoized(object): '''Support instance methods.''' return partial(self.__call__, obj) + +def deprecated_attribute(old, new, since=None, remove=None, doc=None): + """Attribute deprecation decorator for gentle upgrades + + For example: + + class MyClass (object): + @deprecated_attribute( + old='abc', new='xyz', since=(3, 2, 0), remove=(4, 1, 3)) + def abc(): return None + + def __init__(self): + xyz = 5 + + Note that the decorator needs a dummy method to attach to, but the + content of the dummy method is ignored. + """ + def _warn(): + version = '.'.join(six.text_type(x) for x in since) + message = ['{} has been deprecated since {}'.format(old, version)] + if remove: + version = '.'.join(six.text_type(x) for x in remove) + message.append( + ' and will be removed by version {}'.format(version)) + message.append('. Use {} instead.'.format(new)) + logger.warning(''.join(message)) + logger.debug(''.join( + six.text_type(x) for x in traceback.format_stack())) + + def fget(self): + _warn() + return getattr(self, new) + + def fset(self, value): + _warn() + setattr(self, new, value) + + def decorator(dummy): + return property(fget=fget, fset=fset, doc=doc) + + return decorator + def get_date(string): """Return a datetime object from a string. diff --git a/tests/test_utils.py b/tests/test_utils.py index ea4f839c..75e87c04 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -11,6 +11,17 @@ from pelican.utils import NoFilesError class TestUtils(unittest.TestCase): + _new_attribute = 'new_value' + + @utils.deprecated_attribute( + old='_old_attribute', new='_new_attribute', + since=(3, 1, 0), remove=(4, 1, 3)) + def _old_attribute(): return None + + def test_deprecated_attribute(self): + value = self._old_attribute + self.assertEquals(value, self._new_attribute) + # TODO: check log warning def test_get_date(self): # valid ones From 13cd0a4cb3f62b8166ff3957e3385c405b28f34d Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 4 Jan 2013 13:03:19 -0500 Subject: [PATCH 346/359] contents: Add deprecation warnings for Page.filename and StaticContent.filepath --- pelican/contents.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pelican/contents.py b/pelican/contents.py index 88518b0a..0dc0f0e9 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -15,7 +15,7 @@ from sys import platform, stdin from pelican.settings import _DEFAULT_CONFIG from pelican.utils import (slugify, truncate_html_words, memoized, - python_2_unicode_compatible) + python_2_unicode_compatible, deprecated_attribute) from pelican import signals import pelican.utils @@ -31,6 +31,10 @@ class Page(object): mandatory_properties = ('title',) default_template = 'page' + @deprecated_attribute(old='filename', new='source_path', since=(3, 2, 0)) + def filename(): + return None + def __init__(self, content, metadata=None, settings=None, source_path=None, context=None): # init parameters @@ -301,6 +305,10 @@ class Author(URLWrapper): @python_2_unicode_compatible class StaticContent(object): + @deprecated_attribute(old='filepath', new='source_path', since=(3, 2, 0)) + def filepath(): + return None + def __init__(self, src, dst=None, settings=None): if not settings: settings = copy.deepcopy(_DEFAULT_CONFIG) From 4fcdaa91e96988e2754b9aec5e141e7219baae89 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 18 Jan 2013 07:27:35 -0500 Subject: [PATCH 347/359] tests/support: Factor LogCountHandler testing out into LoggedTestCase To avoid duplicating boilerplate when we need to test logged messages outside of TestPelican. --- tests/support.py | 21 +++++++++++++++++++++ tests/test_pelican.py | 19 +++++++------------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/tests/support.py b/tests/support.py index 6011e6cd..209cc665 100644 --- a/tests/support.py +++ b/tests/support.py @@ -176,3 +176,24 @@ class LogCountHandler(BufferingHandler): if (msg is None or re.match(msg, l.getMessage())) and (level is None or l.levelno == level) ]) + + +class LoggedTestCase(unittest.TestCase): + """A test case that captures log messages + """ + + def setUp(self): + super(LoggedTestCase, self).setUp() + self._logcount_handler = LogCountHandler() + logging.getLogger().addHandler(self._logcount_handler) + + def tearDown(self): + logging.getLogger().removeHandler(self._logcount_handler) + super(LoggedTestCase, self).tearDown() + + def assertLogCountEqual(self, count=None, msg=None, **kwargs): + actual = self._logcount_handler.count_logs(msg=msg, **kwargs) + self.assertEqual( + actual, count, + msg='expected {} occurrences of {!r}, but found {}'.format( + count, msg, actual)) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index ca0e22cc..49e20b0a 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -1,9 +1,5 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function -try: - import unittest2 as unittest -except ImportError: - import unittest # NOQA import os from filecmp import dircmp @@ -14,7 +10,7 @@ import logging from pelican import Pelican from pelican.settings import read_settings -from .support import LogCountHandler +from .support import LoggedTestCase CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) SAMPLES_PATH = os.path.abspath(os.sep.join((CURRENT_DIR, "..", "samples"))) @@ -39,13 +35,12 @@ def recursiveDiff(dcmp): return diff -class TestPelican(unittest.TestCase): +class TestPelican(LoggedTestCase): # general functional testing for pelican. Basically, this test case tries # to run pelican in different situations and see how it behaves def setUp(self): - self.logcount_handler = LogCountHandler() - logging.getLogger().addHandler(self.logcount_handler) + super(TestPelican, self).setUp() self.temp_path = mkdtemp() self.old_locale = locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_ALL, str('C')) @@ -53,7 +48,7 @@ class TestPelican(unittest.TestCase): def tearDown(self): rmtree(self.temp_path) locale.setlocale(locale.LC_ALL, self.old_locale) - logging.getLogger().removeHandler(self.logcount_handler) + super(TestPelican, self).tearDown() def assertFilesEqual(self, diff): msg = "some generated files differ from the expected functional " \ @@ -79,10 +74,10 @@ class TestPelican(unittest.TestCase): pelican.run() dcmp = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "basic"))) self.assertFilesEqual(recursiveDiff(dcmp)) - self.assertEqual(self.logcount_handler.count_logs( + self.assertLogCountEqual( + count=10, msg="Unable to find.*skipping url replacement", - level=logging.WARNING, - ), 10, msg="bad number of occurences found for this log") + level=logging.WARNING) def test_custom_generation_works(self): # the same thing with a specified set of settings should work From 13b36a5c34b7a64f36662d537c2fa192994048df Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 18 Jan 2013 07:33:42 -0500 Subject: [PATCH 348/359] test_utils: Add log count checks to test_deprecated_attribute --- tests/test_utils.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index 75e87c04..c176325e 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,16 +1,17 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function +import logging import shutil import os import datetime import time from pelican import utils -from .support import get_article, unittest +from .support import get_article, LoggedTestCase from pelican.utils import NoFilesError -class TestUtils(unittest.TestCase): +class TestUtils(LoggedTestCase): _new_attribute = 'new_value' @utils.deprecated_attribute( @@ -21,7 +22,11 @@ class TestUtils(unittest.TestCase): def test_deprecated_attribute(self): value = self._old_attribute self.assertEquals(value, self._new_attribute) - # TODO: check log warning + self.assertLogCountEqual( + count=1, + msg=('_old_attribute has been deprecated since 3.1.0 and will be ' + 'removed by version 4.1.3. Use _new_attribute instead'), + level=logging.WARNING) def test_get_date(self): # valid ones From 6686f1c9bd2aaae633f97e48dac60ac82c9f7c68 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 18 Jan 2013 17:49:09 -0500 Subject: [PATCH 349/359] setup.py: Update trove classifiers to Python 2.7, 3.2, and 3.3 --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 13afd8cf..4c791008 100755 --- a/setup.py +++ b/setup.py @@ -41,8 +41,10 @@ setup( 'Environment :: Console', 'License :: OSI Approved :: GNU Affero General Public License v3', 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Software Development :: Libraries :: Python Modules', ], From 5466ffd61476205feb2a9a7fef737714b12ebf74 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 18 Jan 2013 19:45:39 -0500 Subject: [PATCH 350/359] .travis.yml: Test on Python 3.3 as well as 2.7 and 3.2 If we advertise 3.3 support in setup.py, we should test for it. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7ccdafd5..20f6b57e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: python python: - "2.7" - "3.2" + - "3.3" before_install: - sudo apt-get update -qq - sudo apt-get install -qq ruby-sass From 763244dad53404a4ec126beca92d3f30d1325af2 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 18 Jan 2013 19:46:58 -0500 Subject: [PATCH 351/359] tox.ini: Test on Python 3.3 as well as 2.7 and 3.2 I just copied the 3.2 environment for 3.3. They should be similar, but it's possible some packages have extra issues on 3.3. --- tox.ini | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index bc6578ac..6d1a134a 100644 --- a/tox.ini +++ b/tox.ini @@ -31,7 +31,7 @@ [tox] -envlist = py27,py32 +envlist = py27,py32,py33 [testenv] commands = @@ -61,3 +61,15 @@ deps = # {distshare}/smartypants-1.6.0.3.zip # {distshare}/typogrify-2.0.0.zip # {distshare}/webassets-0.8.dev.zip + +[testenv:py33] +deps = + nose + unittest2py3k + mock + Markdown + BeautifulSoup4 + feedgenerator +# {distshare}/smartypants-1.6.0.3.zip +# {distshare}/typogrify-2.0.0.zip +# {distshare}/webassets-0.8.dev.zip From b01ddbb29c3f6fb1de1794f20e19630cc8810fda Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 19 Jan 2013 16:44:12 +0100 Subject: [PATCH 352/359] fix python 3.3 travis build unittest2py3k is requiredfor python 3.3 (instead of unittest2) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 20f6b57e..6048335f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ before_install: - sudo apt-get install -qq ruby-sass install: - pip install nose mock --use-mirrors - - if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then pip install --use-mirrors unittest2py3k; else pip install --use-mirrors unittest2; fi + - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install --use-mirrors unittest2; else pip install --use-mirrors unittest2py3k; fi - pip install . --use-mirrors - pip install Markdown - pip install webassets From 67a67846aaa248c4e79f74fd6f42f8f47e641437 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 19 Jan 2013 17:10:12 +0100 Subject: [PATCH 353/359] temporary deactivate travis tests for Python 3.3 the functional tests currently fail on Python 3.3 because the feeds output differs. (see #688) this is a temporary fix that will make travis happy while we provide a valid fix for this issue. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6048335f..8b292101 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: python python: - "2.7" - "3.2" - - "3.3" before_install: - sudo apt-get update -qq - sudo apt-get install -qq ruby-sass From 0a6294a2a3bbd0d1447e1dc1e05b5e4fc2f633d1 Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 20 Jan 2013 17:27:28 -0600 Subject: [PATCH 354/359] More clear example for related posts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing related posts example doesn't show properties for the collection, this could be confusing to individuals who are not programmers, because as it was the code would render five bullet points. I am also looking to add some type of loop control or if statement to the loop to detect duplicate, I tried t a dictionary sort filter through jinja, bu that through an error, the following is not guarantted to work then: {% set LASTARTICLE = "notset" %} {% if article.related_posts %}
              {% for related_post in article.related_posts|dictsort(false, 'url')  %} {% if not (LASTARTICLE == related_post.url) %}  
            • {{ related_post.title }}
            • {% endif %} {% set LASTARTICLE = related_post.url %} {% endfor %}
            {% endif %} the dicsort does not work (is this not a dict, I'm not a python guy so I'm just hacking at it. --- docs/plugins.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 7e09810b..ca9a0dde 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -291,7 +291,7 @@ For example:: {% if article.related_posts %} {% endif %} From 688dee2dca7fdd60bf94af72d928d912f8a5ddbb Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 18 Dec 2012 14:03:05 +0100 Subject: [PATCH 355/359] Improve importer documentation. --- docs/importer.rst | 54 +++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/docs/importer.rst b/docs/importer.rst index c9fa3be0..7ca3142d 100644 --- a/docs/importer.rst +++ b/docs/importer.rst @@ -4,54 +4,56 @@ Import from other blog software ================================= + Description =========== -``pelican-import`` is a command line tool for converting articles from other -software to ReStructuredText. The supported formats are: +``pelican-import`` is a command-line tool for converting articles from other +software to ReStructuredText or Markdown. The supported import formats are: - WordPress XML export - Dotclear export - RSS/Atom feed -The conversion from HTML to reStructuredText relies on `pandoc -`_. For Dotclear, if the source posts are -written with Markdown syntax, they will not be converted (as Pelican also -supports Markdown). +The conversion from HTML to reStructuredText or Markdown relies on `Pandoc`_. +For Dotclear, if the source posts are written with Markdown syntax, they will +not be converted (as Pelican also supports Markdown). + Dependencies -"""""""""""" +============ -``pelican-import`` has two dependencies not required by the rest of pelican: +``pelican-import`` has some dependencies not required by the rest of pelican: -- Beautiful Soup -- pandoc +- *BeautifulSoup*, for WordPress and Dotclear import. Can be installed like + any other Python package (``pip install BeautifulSoup``). +- *Feedparser*, for feed import (``pip install feedparser``). +- *Pandoc*, see the `Pandoc site`_ for installation instructions on your + operating system. -Beautiful Soup can be installed like any other Python package:: - - $ pip install BeautifulSoup - -For pandoc, install a package for your operating system from the -`pandoc site `_. +.. _Pandoc: http://johnmacfarlane.net/pandoc/ +.. _Pandoc site: http://johnmacfarlane.net/pandoc/installing.html Usage -""""" +===== -| pelican-import [-h] [--wpfile] [--dotclear] [--feed] [-o OUTPUT] -| [-m MARKUP] [--dir-cat] [--strip-raw] [--disable-slugs] -| input +:: + + pelican-import [-h] [--wpfile] [--dotclear] [--feed] [-o OUTPUT] + [-m MARKUP] [--dir-cat] [--strip-raw] [--disable-slugs] + input Positional arguments -==================== +-------------------- input The input file to read Optional arguments -"""""""""""""""""" +------------------ - -h, --help show this help message and exit - --wpfile Wordpress XML export (default: False) + -h, --help Show this help message and exit + --wpfile WordPress XML export (default: False) --dotclear Dotclear export (default: False) --feed Feed to parse (default: False) -o OUTPUT, --output OUTPUT @@ -69,6 +71,7 @@ Optional arguments be consistent with your original posts. (default: False) + Examples ======== @@ -80,10 +83,11 @@ For Dotclear:: $ pelican-import --dotclear -o ~/output ~/backup.txt + Tests ===== To test the module, one can use sample files: -- for Wordpress: http://wpcandy.com/made/the-sample-post-collection +- for WordPress: http://wpcandy.com/made/the-sample-post-collection - for Dotclear: http://themes.dotaddict.org/files/public/downloads/lorem-backup.txt From 56a276d92e709b87a7f6f078e2e5fe93ad429cc5 Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Mon, 10 Dec 2012 23:32:35 -0500 Subject: [PATCH 356/359] Added unit test to test the markdown file extension. --- .../content/article_with_markdown_extension.markdown | 10 ++++++++++ tests/test_readers.py | 11 +++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/content/article_with_markdown_extension.markdown diff --git a/tests/content/article_with_markdown_extension.markdown b/tests/content/article_with_markdown_extension.markdown new file mode 100644 index 00000000..94e92871 --- /dev/null +++ b/tests/content/article_with_markdown_extension.markdown @@ -0,0 +1,10 @@ +title: Test markdown File +category: test + +Test Markdown File Header +========================= + +Used for pelican test +--------------------- + +This is another markdown test file. Uses the markdown extension. diff --git a/tests/test_readers.py b/tests/test_readers.py index 75e664d5..474b1b4b 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -143,6 +143,17 @@ class MdReaderTest(unittest.TestCase): self.assertEqual(content, expected) + @unittest.skipUnless(readers.Markdown, "markdown isn't installed") + def test_article_with_mkd_extension(self): + # test to ensure the markdown extension is being processed by the correct reader + reader = readers.MarkdownReader({}) + content, metadata = reader.read(_filename('article_with_markdown_extension.markdown')) + expected = "

            Test Markdown File Header

            \n"\ + "

            Used for pelican test

            \n"\ + "

            This is another markdown test file. Uses the markdown extension.

            " + + self.assertEqual(content, expected) + @unittest.skipUnless(readers.Markdown, "markdown isn't installed") def test_article_with_markdown_markup_extension(self): # test to ensure the markdown markup extension is being processed as expected From a441596b072ee124ca5720b211dc2605880c279e Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Tue, 11 Dec 2012 10:23:43 -0500 Subject: [PATCH 357/359] Cleaned up markdown test cases: - test_article_with_md_extension - test_article_with_mkd_extension - test_article_with_markdown_extension and replaced with: - test_article_with_metadata - test_article_with_file_extensions --- tests/content/article_with_md_extension.md | 7 ++- tests/test_readers.py | 51 ++++++++++++---------- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/tests/content/article_with_md_extension.md b/tests/content/article_with_md_extension.md index 11aa22a2..1f111796 100644 --- a/tests/content/article_with_md_extension.md +++ b/tests/content/article_with_md_extension.md @@ -1,5 +1,8 @@ -title: Test md File -category: test +Title: Test md File +Category: test +Tags: foo, bar, foobar +Date: 2010-12-02 10:14 +Summary: I have a lot to test Test Markdown File Header ========================= diff --git a/tests/test_readers.py b/tests/test_readers.py index 474b1b4b..f7cf71d9 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -115,43 +115,46 @@ class RstReaderTest(unittest.TestCase): class MdReaderTest(unittest.TestCase): @unittest.skipUnless(readers.Markdown, "markdown isn't installed") - def test_article_with_md_extension(self): - # test to ensure the md extension is being processed by the correct reader + def test_article_with_metadata(self): reader = readers.MarkdownReader({}) - content, metadata = reader.read(_path('article_with_md_extension.md')) - expected = "

            Test Markdown File Header

            \n"\ - "

            Used for pelican test

            \n"\ - "

            The quick brown fox jumped over the lazy dog's back.

            " - - self.assertEqual(content, expected) - + content, metadata = reader.read( + _path('article_with_md_extension.md')) expected = { 'category': 'test', 'title': 'Test md File', + 'summary': '

            I have a lot to test

            ', + 'date': datetime.datetime(2010, 12, 2, 10, 14), + 'tags': ['foo', 'bar', 'foobar'], } for key, value in metadata.items(): self.assertEquals(value, expected[key], key) @unittest.skipUnless(readers.Markdown, "markdown isn't installed") - def test_article_with_mkd_extension(self): - # test to ensure the mkd extension is being processed by the correct reader + def test_article_with_file_extensions(self): reader = readers.MarkdownReader({}) - content, metadata = reader.read(_path('article_with_mkd_extension.mkd')) + # test to ensure the md file extension is being processed by the + # correct reader + content, metadata = reader.read( + _path('article_with_md_extension.md')) expected = "

            Test Markdown File Header

            \n"\ "

            Used for pelican test

            \n"\ - "

            This is another markdown test file. Uses the mkd extension.

            " - + "

            The quick brown fox jumped over the lazy dog's back.

            " self.assertEqual(content, expected) - - @unittest.skipUnless(readers.Markdown, "markdown isn't installed") - def test_article_with_mkd_extension(self): - # test to ensure the markdown extension is being processed by the correct reader - reader = readers.MarkdownReader({}) - content, metadata = reader.read(_filename('article_with_markdown_extension.markdown')) - expected = "

            Test Markdown File Header

            \n"\ - "

            Used for pelican test

            \n"\ - "

            This is another markdown test file. Uses the markdown extension.

            " - + # test to ensure the mkd file extension is being processed by the + # correct reader + content, metadata = reader.read( + _path('article_with_mkd_extension.mkd')) + expected = "

            Test Markdown File Header

            \n

            Used for pelican"\ + " test

            \n

            This is another markdown test file. Uses"\ + " the mkd extension.

            " + self.assertEqual(content, expected) + # test to ensure the markdown file extension is being processed by the + # correct reader + content, metadata = reader.read( + _path('article_with_markdown_extension.markdown')) + expected = "

            Test Markdown File Header

            \n

            Used for pelican"\ + " test

            \n

            This is another markdown test file. Uses"\ + " the markdown extension.

            " self.assertEqual(content, expected) @unittest.skipUnless(readers.Markdown, "markdown isn't installed") From 0288bf1f68095e5be48c3ebb065a6b47ffe7e13a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C4=B1dvan=20=C3=96rsvuran?= Date: Wed, 19 Dec 2012 16:26:00 +0200 Subject: [PATCH 358/359] added IGNORE_FILES setting for autoreload --- pelican/__init__.py | 5 +++-- pelican/settings.py | 3 ++- pelican/utils.py | 7 ++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 566cb3b0..a4d61b73 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -44,6 +44,7 @@ class Pelican(object): self.theme = settings['THEME'] self.output_path = settings['OUTPUT_PATH'] self.markup = settings['MARKUP'] + self.ignore_files = settings['IGNORE_FILES'] self.delete_outputdir = settings['DELETE_OUTPUT_DIRECTORY'] self.init_path() @@ -292,8 +293,8 @@ def main(): # restriction; all files are recursively checked if they # have changed, no matter what extension the filenames # have. - if files_changed(pelican.path, pelican.markup) or \ - files_changed(pelican.theme, ['']): + if files_changed(pelican.path, pelican.markup, pelican.ignore_files) or \ + files_changed(pelican.theme, [''], pelican.ignore_files): if not files_found_error: files_found_error = True pelican.run() diff --git a/pelican/settings.py b/pelican/settings.py index e4e0501d..8d6c1608 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -80,7 +80,8 @@ _DEFAULT_CONFIG = {'PATH': '.', 'TYPOGRIFY': False, 'SUMMARY_MAX_LENGTH': 50, 'PLUGINS': [], - 'TEMPLATE_PAGES': {} + 'TEMPLATE_PAGES': {}, + 'IGNORE_FILES': [] } diff --git a/pelican/utils.py b/pelican/utils.py index edf5068b..cfbc3c23 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -10,6 +10,7 @@ import traceback import logging import errno import locale +import fnmatch from collections import defaultdict, Hashable from functools import partial @@ -406,8 +407,7 @@ def process_translations(content_list): LAST_MTIME = 0 - -def files_changed(path, extensions): +def files_changed(path, extensions, ignores=[]): """Return True if the files have changed since the last check""" def file_times(path): @@ -415,7 +415,8 @@ def files_changed(path, extensions): for root, dirs, files in os.walk(path): dirs[:] = [x for x in dirs if x[0] != '.'] for f in files: - if any(f.endswith(ext) for ext in extensions): + if any(f.endswith(ext) for ext in extensions) \ + and not any(fnmatch.fnmatch(f, ignore) for ignore in ignores): yield os.stat(os.path.join(root, f)).st_mtime global LAST_MTIME From 5f3a3e4582f84cf4407875dff945a3d42f79b368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20HERVIER?= Date: Thu, 24 Jan 2013 14:10:26 +0100 Subject: [PATCH 359/359] Update pelican/contents.py Put a space in error message to not concatain word 'about' and the missing tag --- pelican/contents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/contents.py b/pelican/contents.py index 5bde3c0a..d7d7e558 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -344,6 +344,6 @@ def is_valid_content(content, f): content.check_properties() return True except NameError as e: - logger.error("Skipping %s: impossible to find informations about" + logger.error("Skipping %s: impossible to find informations about " "'%s'" % (f, e)) return False