merge with master

This commit is contained in:
Alexis Métaireau 2012-10-25 14:54:19 +02:00
commit 0ebba1c4ab
57 changed files with 1056 additions and 382 deletions

View file

@ -0,0 +1,8 @@
Title: Test Markdown extensions
[TOC]
## Level1
### Level2

View file

@ -55,8 +55,8 @@
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2012-07-26T22:04:43.481849">
Thu 26 July 2012
<abbr class="published" title="2012-09-17T15:02:39.591671">
Mon 17 September 2012
</abbr>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>A Pelican Blog</title><link href="/" rel="alternate"></link><link href="/feeds/all-fr.atom.xml" rel="self"></link><id>/</id><updated>2012-07-26T22:04:43Z</updated><entry><title>Trop bien !</title><link href="/oh-yeah-fr.html" rel="alternate"></link><updated>2012-07-26T22:04:43Z</updated><author><name>Dummy Author</name></author><id>tag:,2012-07-26:oh-yeah-fr.html</id><summary type="html">&lt;p&gt;Et voila du contenu en français&lt;/p&gt;
<feed xmlns="http://www.w3.org/2005/Atom"><title>A Pelican Blog</title><link href="/" rel="alternate"></link><link href="/feeds/all-fr.atom.xml" rel="self"></link><id>/</id><updated>2012-09-17T15:02:39Z</updated><entry><title>Trop bien !</title><link href="/oh-yeah-fr.html" rel="alternate"></link><updated>2012-09-17T15:02:39Z</updated><author><name>Dummy Author</name></author><id>tag:,2012-09-17:oh-yeah-fr.html</id><summary type="html">&lt;p&gt;Et voila du contenu en français&lt;/p&gt;
</summary></entry><entry><title>Deuxième article</title><link href="/second-article-fr.html" rel="alternate"></link><updated>2012-02-29T00:00:00Z</updated><author><name>Dummy Author</name></author><id>tag:,2012-02-29:second-article-fr.html</id><summary type="html">&lt;p&gt;Ceci est un article, en français.&lt;/p&gt;
</summary><category term="foo"></category><category term="bar"></category><category term="baz"></category></entry></feed>

View file

@ -55,8 +55,8 @@
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2012-07-26T22:04:43.481849">
Thu 26 July 2012
<abbr class="published" title="2012-09-17T15:02:39.591671">
Mon 17 September 2012
</abbr>

View file

@ -51,7 +51,7 @@
<aside id="featured" class="body">
<article>
<h1 class="entry-title"><a href=".././second-article.html">Second article</a></h1>
<h1 class="entry-title"><a href=".././second-article-fr.html">Deuxième article</a></h1>
<footer class="post-info">
<abbr class="published" title="2012-02-29T00:00:00">
Wed 29 February 2012
@ -68,10 +68,10 @@
Translations:
<a href=".././second-article-fr.html">fr</a>
<a href=".././second-article.html">en</a>
</footer><!-- /.post-info --><p>This is some article, in english</p>
</footer><!-- /.post-info --><p>Ceci est un article, en français.</p>
</article>
@ -92,8 +92,8 @@ Translations:
<li><article class="hentry">
<header>
<h1><a href=".././second-article-fr.html" rel="bookmark"
title="Permalink to Deuxième article">Deuxième article</a></h1>
<h1><a href=".././second-article.html" rel="bookmark"
title="Permalink to Second article">Second article</a></h1>
</header>
<div class="entry-content">
@ -113,13 +113,13 @@ Translations:
Translations:
<a href=".././second-article.html">en</a>
<a href=".././second-article-fr.html">fr</a>
</footer><!-- /.post-info -->
<p>Ceci est un article, en français.</p>
<p>This is some article, in english</p>
<a class="readmore" href=".././second-article-fr.html">read more</a>
<a class="readmore" href=".././second-article.html">read more</a>
</div><!-- /.entry-content -->
</article></li>

View file

@ -51,7 +51,7 @@
<aside id="featured" class="body">
<article>
<h1 class="entry-title"><a href=".././second-article.html">Second article</a></h1>
<h1 class="entry-title"><a href=".././second-article-fr.html">Deuxième article</a></h1>
<footer class="post-info">
<abbr class="published" title="2012-02-29T00:00:00">
Wed 29 February 2012
@ -68,10 +68,10 @@
Translations:
<a href=".././second-article-fr.html">fr</a>
<a href=".././second-article.html">en</a>
</footer><!-- /.post-info --><p>This is some article, in english</p>
</footer><!-- /.post-info --><p>Ceci est un article, en français.</p>
</article>
@ -92,8 +92,8 @@ Translations:
<li><article class="hentry">
<header>
<h1><a href=".././second-article-fr.html" rel="bookmark"
title="Permalink to Deuxième article">Deuxième article</a></h1>
<h1><a href=".././second-article.html" rel="bookmark"
title="Permalink to Second article">Second article</a></h1>
</header>
<div class="entry-content">
@ -113,13 +113,13 @@ Translations:
Translations:
<a href=".././second-article.html">en</a>
<a href=".././second-article-fr.html">fr</a>
</footer><!-- /.post-info -->
<p>Ceci est un article, en français.</p>
<p>This is some article, in english</p>
<a class="readmore" href=".././second-article-fr.html">read more</a>
<a class="readmore" href=".././second-article.html">read more</a>
</div><!-- /.entry-content -->
</article></li>

View file

@ -51,7 +51,7 @@
<aside id="featured" class="body">
<article>
<h1 class="entry-title"><a href=".././second-article.html">Second article</a></h1>
<h1 class="entry-title"><a href=".././second-article-fr.html">Deuxième article</a></h1>
<footer class="post-info">
<abbr class="published" title="2012-02-29T00:00:00">
Wed 29 February 2012
@ -68,10 +68,10 @@
Translations:
<a href=".././second-article-fr.html">fr</a>
<a href=".././second-article.html">en</a>
</footer><!-- /.post-info --><p>This is some article, in english</p>
</footer><!-- /.post-info --><p>Ceci est un article, en français.</p>
</article>
@ -92,8 +92,8 @@ Translations:
<li><article class="hentry">
<header>
<h1><a href=".././second-article-fr.html" rel="bookmark"
title="Permalink to Deuxième article">Deuxième article</a></h1>
<h1><a href=".././second-article.html" rel="bookmark"
title="Permalink to Second article">Second article</a></h1>
</header>
<div class="entry-content">
@ -113,13 +113,13 @@ Translations:
Translations:
<a href=".././second-article.html">en</a>
<a href=".././second-article-fr.html">fr</a>
</footer><!-- /.post-info -->
<p>Ceci est un article, en français.</p>
<p>This is some article, in english</p>
<a class="readmore" href=".././second-article-fr.html">read more</a>
<a class="readmore" href=".././second-article.html">read more</a>
</div><!-- /.entry-content -->
</article></li>

View file

@ -97,7 +97,7 @@ dl {margin: 0 0 1.5em 0;}
dt {font-weight: bold;}
dd {margin-left: 1.5em;}
pre{background-color: #000; padding: 10px; color: #fff; margin: 10px; overflow: auto;}
pre{background-color: rgb(238, 238, 238); padding: 10px; margin: 10px; overflow: auto;}
/* Quotes */
blockquote {
@ -308,7 +308,8 @@ img.left, figure.left {float: left; margin: 0 2em 2em 0;}
.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');}
.social a[href*='gitorious.org'] {background-image: url('../images/icons/gitorious.png');}
.social a[href*='gittip.com'] {background-image: url('../images/icons/gittip.png');}
/*
About

View file

@ -1,5 +1,5 @@
.hll {
background-color:#FFFFCC;
background-color:#eee;
}
.c {
color:#408090;

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

View file

@ -59,7 +59,7 @@
<aside id="featured" class="body">
<article>
<h1 class="entry-title"><a href=".././second-article.html">Second article</a></h1>
<h1 class="entry-title"><a href=".././second-article-fr.html">Deuxième article</a></h1>
<footer class="post-info">
<abbr class="published" title="2012-02-29T00:00:00">
Wed 29 February 2012
@ -76,11 +76,11 @@
Translations:
<a href=".././second-article-fr.html">fr</a>
<a href=".././second-article.html">en</a>
</footer><!-- /.post-info --><p>This is some article, in english</p>
<p>There are <a href=".././second-article.html#disqus_thread">comments</a>.</p>
</footer><!-- /.post-info --><p>Ceci est un article, en français.</p>
<p>There are <a href=".././second-article-fr.html#disqus_thread">comments</a>.</p>
</article>
</aside><!-- /#featured -->
@ -100,8 +100,8 @@ Translations:
<li><article class="hentry">
<header>
<h1><a href=".././second-article-fr.html" rel="bookmark"
title="Permalink to Deuxième article">Deuxième article</a></h1>
<h1><a href=".././second-article.html" rel="bookmark"
title="Permalink to Second article">Second article</a></h1>
</header>
<div class="entry-content">
@ -121,14 +121,14 @@ Translations:
Translations:
<a href=".././second-article.html">en</a>
<a href=".././second-article-fr.html">fr</a>
</footer><!-- /.post-info -->
<p>Ceci est un article, en français.</p>
<p>This is some article, in english</p>
<a class="readmore" href=".././second-article-fr.html">read more</a>
<p>There are <a href=".././second-article-fr.html#disqus_thread">comments</a>.</p>
<a class="readmore" href=".././second-article.html">read more</a>
<p>There are <a href=".././second-article.html#disqus_thread">comments</a>.</p>
</div><!-- /.entry-content -->
</article></li>

View file

@ -59,7 +59,7 @@
<aside id="featured" class="body">
<article>
<h1 class="entry-title"><a href=".././second-article.html">Second article</a></h1>
<h1 class="entry-title"><a href=".././second-article-fr.html">Deuxième article</a></h1>
<footer class="post-info">
<abbr class="published" title="2012-02-29T00:00:00">
Wed 29 February 2012
@ -76,11 +76,11 @@
Translations:
<a href=".././second-article-fr.html">fr</a>
<a href=".././second-article.html">en</a>
</footer><!-- /.post-info --><p>This is some article, in english</p>
<p>There are <a href=".././second-article.html#disqus_thread">comments</a>.</p>
</footer><!-- /.post-info --><p>Ceci est un article, en français.</p>
<p>There are <a href=".././second-article-fr.html#disqus_thread">comments</a>.</p>
</article>
</aside><!-- /#featured -->
@ -100,8 +100,8 @@ Translations:
<li><article class="hentry">
<header>
<h1><a href=".././second-article-fr.html" rel="bookmark"
title="Permalink to Deuxième article">Deuxième article</a></h1>
<h1><a href=".././second-article.html" rel="bookmark"
title="Permalink to Second article">Second article</a></h1>
</header>
<div class="entry-content">
@ -121,14 +121,14 @@ Translations:
Translations:
<a href=".././second-article.html">en</a>
<a href=".././second-article-fr.html">fr</a>
</footer><!-- /.post-info -->
<p>Ceci est un article, en français.</p>
<p>This is some article, in english</p>
<a class="readmore" href=".././second-article-fr.html">read more</a>
<p>There are <a href=".././second-article-fr.html#disqus_thread">comments</a>.</p>
<a class="readmore" href=".././second-article.html">read more</a>
<p>There are <a href=".././second-article.html#disqus_thread">comments</a>.</p>
</div><!-- /.entry-content -->
</article></li>

View file

@ -59,7 +59,7 @@
<aside id="featured" class="body">
<article>
<h1 class="entry-title"><a href=".././second-article.html">Second article</a></h1>
<h1 class="entry-title"><a href=".././second-article-fr.html">Deuxième article</a></h1>
<footer class="post-info">
<abbr class="published" title="2012-02-29T00:00:00">
Wed 29 February 2012
@ -76,11 +76,11 @@
Translations:
<a href=".././second-article-fr.html">fr</a>
<a href=".././second-article.html">en</a>
</footer><!-- /.post-info --><p>This is some article, in english</p>
<p>There are <a href=".././second-article.html#disqus_thread">comments</a>.</p>
</footer><!-- /.post-info --><p>Ceci est un article, en français.</p>
<p>There are <a href=".././second-article-fr.html#disqus_thread">comments</a>.</p>
</article>
</aside><!-- /#featured -->
@ -100,8 +100,8 @@ Translations:
<li><article class="hentry">
<header>
<h1><a href=".././second-article-fr.html" rel="bookmark"
title="Permalink to Deuxième article">Deuxième article</a></h1>
<h1><a href=".././second-article.html" rel="bookmark"
title="Permalink to Second article">Second article</a></h1>
</header>
<div class="entry-content">
@ -121,14 +121,14 @@ Translations:
Translations:
<a href=".././second-article.html">en</a>
<a href=".././second-article-fr.html">fr</a>
</footer><!-- /.post-info -->
<p>Ceci est un article, en français.</p>
<p>This is some article, in english</p>
<a class="readmore" href=".././second-article-fr.html">read more</a>
<p>There are <a href=".././second-article-fr.html#disqus_thread">comments</a>.</p>
<a class="readmore" href=".././second-article.html">read more</a>
<p>There are <a href=".././second-article.html#disqus_thread">comments</a>.</p>
</div><!-- /.entry-content -->
</article></li>

View file

@ -97,7 +97,7 @@ dl {margin: 0 0 1.5em 0;}
dt {font-weight: bold;}
dd {margin-left: 1.5em;}
pre{background-color: #000; padding: 10px; color: #fff; margin: 10px; overflow: auto;}
pre{background-color: rgb(238, 238, 238); padding: 10px; margin: 10px; overflow: auto;}
/* Quotes */
blockquote {
@ -308,7 +308,8 @@ img.left, figure.left {float: left; margin: 0 2em 2em 0;}
.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');}
.social a[href*='gitorious.org'] {background-image: url('../images/icons/gitorious.png');}
.social a[href*='gittip.com'] {background-image: url('../images/icons/gittip.png');}
/*
About

View file

@ -1,5 +1,5 @@
.hll {
background-color:#FFFFCC;
background-color:#eee;
}
.c {
color:#408090;

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

View file

@ -5,7 +5,7 @@ from .support import unittest
from pelican.contents import Page, Article
from pelican.settings import _DEFAULT_CONFIG
from pelican.utils import truncate_html_words
from pelican.signals import content_object_init
from jinja2.utils import generate_lorem_ipsum
# generate one paragraph, enclosed with <p>
@ -158,6 +158,17 @@ class TestPage(unittest.TestCase):
return page_kwargs
def test_signal(self):
"""If a title is given, it should be used to generate the slug."""
def receiver_test_function(sender,instance):
pass
content_object_init.connect(receiver_test_function ,sender=Page)
page = Page(**self.page_kwargs)
self.assertTrue(content_object_init.has_receivers_for(Page))
class TestArticle(TestPage):
def test_template(self):
"""

View file

@ -69,6 +69,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'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'],

View file

@ -55,7 +55,11 @@ class TestPelican(unittest.TestCase):
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)
settings = read_settings(filename=None, override={
'PATH': INPUT_PATH,
'OUTPUT_PATH': self.temp_path,
})
pelican = Pelican(settings=settings)
pelican.run()
diff = dircmp(
self.temp_path, os.sep.join((OUTPUT_PATH, "basic")))
@ -63,8 +67,11 @@ class TestPelican(unittest.TestCase):
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))
settings = read_settings(filename=SAMPLE_CONFIG, override={
'PATH': INPUT_PATH,
'OUTPUT_PATH': self.temp_path,
})
pelican = Pelican(settings=settings)
pelican.run()
diff = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "custom")))
self.assertFilesEqual(diff)

View file

@ -70,7 +70,7 @@ class RstReaderTest(unittest.TestCase):
class MdReaderTest(unittest.TestCase):
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
def test_article_with_md_extention(self):
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'))
@ -91,6 +91,25 @@ class MdReaderTest(unittest.TestCase):
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
reader = readers.MarkdownReader({})
reader.settings.update(dict(MARKDOWN_EXTENSIONS=['toc', ]))
content, metadata = reader.read(_filename('article_with_markdown_markup_extensions.md'))
expected = '<div class="toc">\n'\
'<ul>\n'\
'<li><a href="#level1">Level1</a><ul>\n'\
'<li><a href="#level2">Level2</a></li>\n'\
'</ul>\n'\
'</li>\n'\
'</ul>\n'\
'</div>\n'\
'<h2 id="level1">Level1</h2>\n'\
'<h3 id="level2">Level2</h3>'
self.assertEqual(content, expected)
class HtmlReaderTest(unittest.TestCase):

View file

@ -56,16 +56,19 @@ class TestSettingsConfiguration(unittest.TestCase):
def test_configure_settings(self):
"""Manipulations to settings should be applied correctly."""
# SITEURL should not have a trailing slash
settings = {'SITEURL': 'http://blog.notmyidea.org/', 'LOCALE': ''}
settings = {
'SITEURL': 'http://blog.notmyidea.org/',
'LOCALE': '',
'PATH': '.',
'THEME': DEFAULT_THEME,
}
configure_settings(settings)
# SITEURL should not have a trailing slash
self.assertEqual(settings['SITEURL'], 'http://blog.notmyidea.org')
# FEED_DOMAIN, if undefined, should default to SITEURL
settings = {'SITEURL': 'http://blog.notmyidea.org', 'LOCALE': ''}
configure_settings(settings)
self.assertEqual(settings['FEED_DOMAIN'], 'http://blog.notmyidea.org')
settings = {'FEED_DOMAIN': 'http://feeds.example.com', 'LOCALE': ''}
settings['FEED_DOMAIN'] = 'http://feeds.example.com'
configure_settings(settings)
self.assertEqual(settings['FEED_DOMAIN'], 'http://feeds.example.com')

View file

@ -112,3 +112,16 @@ class TestUtils(unittest.TestCase):
self.assertTrue(os.path.isdir(test_directory))
self.assertListEqual([], os.listdir(test_directory))
shutil.rmtree(test_directory)
def test_clean_output_dir_not_there(self):
test_directory = os.path.join(os.path.dirname(__file__), 'does_not_exist')
utils.clean_output_dir(test_directory)
self.assertTrue(not os.path.exists(test_directory))
def test_clean_output_dir_is_file(self):
test_directory = os.path.join(os.path.dirname(__file__), 'this_is_a_file')
f = open(test_directory, 'w')
f.write('')
f.close()
utils.clean_output_dir(test_directory)
self.assertTrue(not os.path.exists(test_directory))