The quick brown fox jumped over'
' the lazy dog’s back.
\n')
- self.assertEqual(content, expected)
+ self.assertEqual(page.content, expected)
expected = {
'category': 'Blog',
'author': 'Author O. Article',
@@ -302,7 +302,7 @@ class AdReaderTest(ReaderTest):
}
for key, value in expected.items():
- self.assertEqual(value, metadata[key], key)
+ self.assertEqual(value, page.metadata[key], key)
@unittest.skipUnless(readers.asciidoc, "asciidoc isn't installed")
def test_article_with_asc_options(self):
@@ -319,24 +319,24 @@ class AdReaderTest(ReaderTest):
class HTMLReaderTest(ReaderTest):
def test_article_with_comments(self):
- content, metadata = self.read_file(path='article_with_comments.html')
+ page = self.read_file(path='article_with_comments.html')
self.assertEqual('''
Body content
- ''', content)
+ ''', page.content)
def test_article_with_keywords(self):
- content, metadata = self.read_file(path='article_with_keywords.html')
+ page = self.read_file(path='article_with_keywords.html')
expected = {
'tags': ['foo', 'bar', 'foobar'],
}
for key, value in expected.items():
- self.assertEqual(value, metadata[key], key)
+ self.assertEqual(value, page.metadata[key], key)
def test_article_with_metadata(self):
- content, metadata = self.read_file(path='article_with_metadata.html')
+ page = self.read_file(path='article_with_metadata.html')
expected = {
'category': 'yeah',
'author': 'Alexis Métaireau',
@@ -348,21 +348,19 @@ class HTMLReaderTest(ReaderTest):
}
for key, value in expected.items():
- self.assertEqual(value, metadata[key], key)
+ self.assertEqual(value, page.metadata[key], key)
def test_article_with_null_attributes(self):
- content, metadata = self.read_file(
- path='article_with_null_attributes.html')
+ page = self.read_file(path='article_with_null_attributes.html')
self.assertEqual('''
Ensure that empty attributes are copied properly.
- ''', content)
+ ''', page.content)
def test_article_metadata_key_lowercase(self):
# Keys of metadata should be lowercase.
- content, metadata = self.read_file(
- path='article_with_uppercase_metadata.html')
- self.assertIn('category', metadata, 'Key should be lowercase.')
- self.assertEqual('Yeah', metadata.get('category'),
+ page = self.read_file(path='article_with_uppercase_metadata.html')
+ self.assertIn('category', page.metadata, 'Key should be lowercase.')
+ self.assertEqual('Yeah', page.metadata.get('category'),
'Value keeps cases.')
From f63325aa9a459b2c510bd16297a381544a1571ea Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Mon, 3 Jun 2013 15:26:23 -0400
Subject: [PATCH 026/160] test_generators: Replace CUR_DIR with CONTENT_DIR for
subdir cat. detection
In situations where I've cleared ARTICLE_DIR, I've done so to ensure
that there are no directories that will override the DEFAULT_CATEGORY
due to USE_FOLDER_AS_CATEGORY.
---
pelican/tests/test_generators.py | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/pelican/tests/test_generators.py b/pelican/tests/test_generators.py
index 48aff498..f5ed6b85 100644
--- a/pelican/tests/test_generators.py
+++ b/pelican/tests/test_generators.py
@@ -15,6 +15,7 @@ from pelican.settings import DEFAULT_CONFIG
from pelican.tests.support import unittest, get_settings
CUR_DIR = os.path.dirname(__file__)
+CONTENT_DIR = os.path.join(CUR_DIR, 'content')
class TestArticlesGenerator(unittest.TestCase):
@@ -30,12 +31,10 @@ class TestArticlesGenerator(unittest.TestCase):
"""
if self.generator is None:
settings = get_settings(filenames={})
- settings['ARTICLE_DIR'] = 'content'
settings['DEFAULT_CATEGORY'] = 'Default'
settings['DEFAULT_DATE'] = (1970, 1, 1)
self.generator = ArticlesGenerator(settings.copy(), settings,
- CUR_DIR, settings['THEME'], None,
- settings['MARKUP'])
+ CONTENT_DIR, settings['THEME'], None, settings['MARKUP'])
self.generator.generate_context()
return self.generator
@@ -118,14 +117,13 @@ class TestArticlesGenerator(unittest.TestCase):
def test_do_not_use_folder_as_category(self):
settings = DEFAULT_CONFIG.copy()
- settings['ARTICLE_DIR'] = 'content'
settings['DEFAULT_CATEGORY'] = 'Default'
settings['DEFAULT_DATE'] = (1970, 1, 1)
settings['USE_FOLDER_AS_CATEGORY'] = False
settings['filenames'] = {}
generator = ArticlesGenerator(
- settings.copy(), settings, CUR_DIR, DEFAULT_CONFIG['THEME'], None,
- DEFAULT_CONFIG['MARKUP'])
+ settings.copy(), settings, CONTENT_DIR, DEFAULT_CONFIG['THEME'],
+ None, DEFAULT_CONFIG['MARKUP'])
generator.generate_context()
# test for name
# categories are grouped by slug; if two categories have the same slug
@@ -213,12 +211,12 @@ class TestPageGenerator(unittest.TestCase):
def test_generate_context(self):
settings = get_settings(filenames={})
- settings['PAGE_DIR'] = 'TestPages'
+ settings['PAGE_DIR'] = 'TestPages' # relative to CUR_DIR
settings['DEFAULT_DATE'] = (1970, 1, 1)
- generator = PagesGenerator(settings.copy(), settings, CUR_DIR,
- settings['THEME'], None,
- settings['MARKUP'])
+ generator = PagesGenerator(
+ settings.copy(), settings, CUR_DIR, settings['THEME'], None,
+ settings['MARKUP'])
generator.generate_context()
pages = self.distill_pages(generator.pages)
hidden_pages = self.distill_pages(generator.hidden_pages)
From fdde17281d36f28cf7084a21daafa77eea9fe3cb Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Fri, 4 Jan 2013 19:47:55 -0500
Subject: [PATCH 027/160] contents: Page fallbacks for context and localsiteurl
---
pelican/contents.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pelican/contents.py b/pelican/contents.py
index 5f2e66b0..fd33bc4c 100644
--- a/pelican/contents.py
+++ b/pelican/contents.py
@@ -48,6 +48,8 @@ class Content(object):
self.settings = settings
self._content = content
+ if context is None:
+ context = {}
self._context = context
self.translations = []
@@ -220,7 +222,7 @@ class Content(object):
@property
def content(self):
- return self.get_content(self._context['localsiteurl'])
+ return self.get_content(self._context.get('localsiteurl', ''))
def _get_summary(self):
"""Returns the summary of an article.
From 29f0aa39d2239122782fa5c1a547827cf7acedb0 Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Fri, 22 Mar 2013 00:13:37 -0400
Subject: [PATCH 028/160] content: Don't update static content
---
pelican/contents.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/pelican/contents.py b/pelican/contents.py
index fd33bc4c..1b604f19 100644
--- a/pelican/contents.py
+++ b/pelican/contents.py
@@ -171,6 +171,9 @@ class Content(object):
:param siteurl: siteurl which is locally generated by the writer in
case of RELATIVE_URLS.
"""
+ if not content:
+ return content
+
hrefs = re.compile(r"""
(?P<\s*[^\>]* # match tag with src and href attr
(?:href|src)\s*=)
From 4058cfdea44725c520dc574c033476892c235d58 Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Sun, 24 Mar 2013 10:19:01 -0400
Subject: [PATCH 029/160] settings: Add a warning for folks using
FILES_TO_COPY.
---
pelican/settings.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pelican/settings.py b/pelican/settings.py
index 13896032..35e76346 100644
--- a/pelican/settings.py
+++ b/pelican/settings.py
@@ -257,6 +257,8 @@ def configure_settings(settings):
for old,new,doc in [
('LESS_GENERATOR', 'the Webassets plugin', None),
+ ('FILES_TO_COPY', 'STATIC_PATHS and EXTRA_PATH_METADATA',
+ 'https://github.com/getpelican/pelican/pull/795'),
]:
if old in settings:
message = 'The {} setting has been removed in favor of {}'
From 38c22e83b6bfe7fdcd4f8987063cd240d5655539 Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Mon, 3 Jun 2013 15:29:54 -0400
Subject: [PATCH 030/160] readers: Ensure the reader class is enabled before
instantiating
Otherwise the MarkdownReader fails with:
'bool' object is not callable
if Markdown is not installed.
Reported-by: Deniz Turgut
---
pelican/readers.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/pelican/readers.py b/pelican/readers.py
index 3e00b430..bd9f5914 100644
--- a/pelican/readers.py
+++ b/pelican/readers.py
@@ -361,15 +361,17 @@ def read_file(base_path, path, content_class=Page, fmt=None,
if settings is None:
settings = {}
- reader = EXTENSIONS[fmt](settings)
+ reader_class = EXTENSIONS[fmt]
+ if not reader_class.enabled:
+ raise ValueError('Missing dependencies for {}'.format(fmt))
+
+ reader = reader_class(settings)
+
settings_key = '%s_EXTENSIONS' % fmt.upper()
if settings and settings_key in settings:
reader.extensions = settings[settings_key]
- if not reader.enabled:
- raise ValueError("Missing dependencies for %s" % fmt)
-
metadata = default_metadata(
settings=settings, process=reader.process_metadata)
metadata.update(path_metadata(
From 8797f0ebefee5df4edef6f9a8a98685e1cc1ee92 Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Fri, 7 Jun 2013 14:56:21 -0400
Subject: [PATCH 031/160] docs/plugins.rst: Document signal name changes
---
docs/plugins.rst | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/docs/plugins.rst b/docs/plugins.rst
index 9e262962..9bf08ff3 100644
--- a/docs/plugins.rst
+++ b/docs/plugins.rst
@@ -104,3 +104,22 @@ request if you need them!
def register():
signals.content_object_init.connect(test, sender=contents.Article)
+
+.. note::
+
+ After Pelican 3.2, signal names were standardized. Older plugins
+ may need to be updated to use the new names:
+
+ ========================== ===========================
+ Old name New name
+ ========================== ===========================
+ article_generate_context article_generator_context
+ article_generate_finalized article_generator_finalized
+ article_generate_preread article_generator_preread
+ pages_generate_context page_generator_context
+ pages_generate_preread page_generator_preread
+ pages_generator_finalized page_generator_finalized
+ pages_generator_init page_generator_init
+ static_generate_context static_generator_context
+ static_generate_preread static_generator_preread
+ ========================== ===========================
From ce0a9b697e08fee069cda6c12a8b9921c183830c Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Fri, 18 Jan 2013 19:00:45 -0500
Subject: [PATCH 032/160] Document path metadata extraction
---
docs/getting_started.rst | 2 ++
docs/settings.rst | 49 ++++++++++++++++++++++++++++++++++++++++
pelican/settings.py | 2 +-
3 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index b41f8c18..b2e0aeda 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -213,6 +213,8 @@ The idea behind "pages" is that they are usually not temporal in nature and are
used for content that does not change very often (e.g., "About" or "Contact"
pages).
+.. _internal_metadata:
+
File metadata
-------------
diff --git a/docs/settings.rst b/docs/settings.rst
index c7d7f199..ffcddc7a 100644
--- a/docs/settings.rst
+++ b/docs/settings.rst
@@ -62,9 +62,12 @@ Setting name (default value) What doe
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.*)'``.
+ See :ref:`path_metadata`.
`PATH_METADATA` (``''``) Like ``FILENAME_METADATA``, but parsed from a page's
full path relative to the content source directory.
+ See :ref:`path_metadata`.
`EXTRA_PATH_METADATA` (``{}``) Extra metadata dictionaries keyed by relative path.
+ See :ref:`path_metadata`.
`DELETE_OUTPUT_DIRECTORY` (``False``) Delete the output directory, and **all** of its contents, before
generating new files. This can be useful in preventing older,
unnecessary files from persisting in your output. However, **this is
@@ -335,6 +338,52 @@ your resume, and a contact page — you could have::
'src/resume.html': 'dest/resume.html',
'src/contact.html': 'dest/contact.html'}
+
+.. _path_metadata:
+
+Path metadata
+=============
+
+Not all metadata needs to be `embedded in source file itself`__. For
+example, blog posts are often named following a ``YYYY-MM-DD-SLUG.rst``
+pattern, or nested into ``YYYY/MM/DD-SLUG`` directories. To extract
+metadata from the filename or path, set ``FILENAME_METADATA`` or
+``PATH_METADATA`` to regular expressions that use Python's `group name
+notation`_ ``(?P…)``. If you want to attach additional metadata
+but don't want to encode it in the path, you can set
+``EXTRA_PATH_METADATA``:
+
+.. parsed-literal::
+
+ EXTRA_PATH_METADATA = {
+ 'relative/path/to/file-1': {
+ 'key-1a': 'value-1a',
+ 'key-1b': 'value-1b',
+ },
+ 'relative/path/to/file-2': {
+ 'key-2': 'value-2',
+ },
+ }
+
+This can be a convenient way to shift the installed location of a
+particular file:
+
+.. parsed-literal::
+
+ # Take advantage of the following defaults
+ # STATIC_SAVE_AS = '{path}'
+ # STATIC_URL = '{path}'
+ STATIC_PATHS = [
+ 'extra/robots.txt',
+ ]
+ EXTRA_PATH_METADATA = {
+ 'extra/robots.txt': {'path': 'robots.txt'},
+ }
+
+__ internal_metadata__
+.. _group name notation:
+ http://docs.python.org/3/library/re.html#regular-expression-syntax
+
Feed settings
=============
diff --git a/pelican/settings.py b/pelican/settings.py
index 35e76346..df3ad6b6 100644
--- a/pelican/settings.py
+++ b/pelican/settings.py
@@ -258,7 +258,7 @@ def configure_settings(settings):
for old,new,doc in [
('LESS_GENERATOR', 'the Webassets plugin', None),
('FILES_TO_COPY', 'STATIC_PATHS and EXTRA_PATH_METADATA',
- 'https://github.com/getpelican/pelican/pull/795'),
+ 'https://github.com/getpelican/pelican/blob/master/docs/settings.rst#path-metadata'),
]:
if old in settings:
message = 'The {} setting has been removed in favor of {}'
From 9b42b2a13082e325fabf3f8e4b3f86b3b775bfe7 Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Wed, 12 Jun 2013 16:07:24 -0400
Subject: [PATCH 033/160] generators: get_files() should use paths relative to
Generator.path
All paths should be relative to Generator.path unless we're actively
accessing the filesystem. This makes the argument less ambiguous, so
we have less likelyhood of joining paths multiple times.
---
pelican/generators.py | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/pelican/generators.py b/pelican/generators.py
index c48f8067..a01281dc 100644
--- a/pelican/generators.py
+++ b/pelican/generators.py
@@ -102,23 +102,25 @@ class Generator(object):
def get_files(self, path, exclude=[], extensions=None):
"""Return a list of files to use, based on rules
- :param path: the path to search the file on
+ :param path: the path to search (relative to self.path)
:param exclude: the list of path to exclude
:param extensions: the list of allowed extensions (if False, all
extensions are allowed)
"""
files = []
+ root = os.path.join(self.path, path)
- if os.path.isdir(path):
- for root, dirs, temp_files in os.walk(path, followlinks=True):
+ if os.path.isdir(root):
+ for dirpath, dirs, temp_files in os.walk(root, followlinks=True):
for e in exclude:
if e in dirs:
dirs.remove(e)
+ reldir = os.path.relpath(dirpath, self.path)
for f in temp_files:
- fp = os.path.join(root, f)
+ fp = os.path.join(reldir, f)
if self._include_path(fp, extensions):
files.append(fp)
- elif os.path.exists(path) and self._include_path(path, extensions):
+ elif os.path.exists(root) and self._include_path(path, extensions):
files.append(path) # can't walk non-directories
return files
@@ -372,12 +374,9 @@ class ArticlesGenerator(Generator):
def generate_context(self):
"""Add the articles into the shared context"""
- article_path = os.path.normpath( # we have to remove trailing slashes
- os.path.join(self.path, self.settings['ARTICLE_DIR'])
- )
all_articles = []
for f in self.get_files(
- article_path,
+ self.settings['ARTICLE_DIR'],
exclude=self.settings['ARTICLE_EXCLUDES']):
try:
article = read_file(
@@ -485,7 +484,7 @@ class PagesGenerator(Generator):
all_pages = []
hidden_pages = []
for f in self.get_files(
- os.path.join(self.path, self.settings['PAGE_DIR']),
+ self.settings['PAGE_DIR'],
exclude=self.settings['PAGE_EXCLUDES']):
try:
page = read_file(
@@ -547,7 +546,7 @@ class StaticGenerator(Generator):
# walk static paths
for static_path in self.settings['STATIC_PATHS']:
for f in self.get_files(
- os.path.join(self.path, static_path), extensions=False):
+ static_path, extensions=False):
static = read_file(
base_path=self.path, path=f, content_class=Static,
fmt='static',
From 180cf9165fd0f35d57c51b4cc4111f1a5a92858c Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Thu, 13 Jun 2013 21:12:43 -0400
Subject: [PATCH 034/160] settings: Fix deprecation warning in
configure_settings()
The broken code came from my 1d4d86c (settings: Rework the
LESS_GENERATOR removal warning for easy extension, 2013-03-24), where
I put formatting placeholders ({}) into the warning message, but
forgot to fill them in :/.
---
pelican/settings.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pelican/settings.py b/pelican/settings.py
index df3ad6b6..c6cc6c3c 100644
--- a/pelican/settings.py
+++ b/pelican/settings.py
@@ -261,9 +261,10 @@ def configure_settings(settings):
'https://github.com/getpelican/pelican/blob/master/docs/settings.rst#path-metadata'),
]:
if old in settings:
- message = 'The {} setting has been removed in favor of {}'
+ message = 'The {} setting has been removed in favor of {}'.format(
+ old, new)
if doc:
- message += ', see {} for details'
+ message += ', see {} for details'.format(doc)
logger.warning(message)
return settings
From dfb29b53880ecd8c5f6ee99c09040d84fa17c57b Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Sat, 15 Jun 2013 12:24:48 -0700
Subject: [PATCH 035/160] Update changelog
---
docs/changelog.rst | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/docs/changelog.rst b/docs/changelog.rst
index fcec0b53..0804c8b0 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -4,6 +4,17 @@ Release history
3.3 (XXXX-XX-XX)
================
+* Rename signals for better consistency (some plugins may need to be updated)
+* Move metadata extraction from generators to readers; metadata extraction no
+ longer article-specific
+* Deprecate ``FILES_TO_COPY`` in favor of ``STATIC_PATHS`` and
+ ``EXTRA_PATH_METADATA``
+
+3.2.1 and 3.2.2
+===============
+
+* Facilitate inclusion in FreeBSD Ports Collection
+
3.2 (2013-04-24)
================
From 0dee76f2598336a70d3c4535fd49217566971a44 Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Sat, 5 Jan 2013 08:42:50 -0500
Subject: [PATCH 036/160] samples: Remove EXTRA_PATH_METADATA entries for
pictures
I'd added them earlier to test that a configuration edit could
preserve the original output locations. However, it is likely that
you have quite a number of static files, and we shouldn't recommend
listing explicit paths for all of them. With this configuration
change, the pictures will be copied into the output directory using
their original relative path (e.g. `pictures/Fat_Cat.jpg` without the
`static`). Any |filename|-style links will be updated automatically.
If you *want* the pictures to end up in a `static` directory, it's
easier to just organize your source that way.
---
.../output/custom/author/alexis-metaireau2.html | 2 +-
pelican/tests/output/custom/category/bar.html | 2 +-
pelican/tests/output/custom/category/yeah.html | 4 ++--
pelican/tests/output/custom/feeds/all-en.atom.xml | 6 +++---
pelican/tests/output/custom/feeds/all.atom.xml | 6 +++---
pelican/tests/output/custom/feeds/all.rss.xml | 6 +++---
pelican/tests/output/custom/feeds/bar.atom.xml | 2 +-
pelican/tests/output/custom/feeds/bar.rss.xml | 2 +-
pelican/tests/output/custom/feeds/yeah.atom.xml | 4 ++--
pelican/tests/output/custom/feeds/yeah.rss.xml | 4 ++--
pelican/tests/output/custom/index2.html | 2 +-
pelican/tests/output/custom/oh-yeah.html | 2 +-
.../output/custom/pages/this-is-a-test-page.html | 2 +-
.../output/custom/{static => }/pictures/Fat_Cat.jpg | Bin
.../output/custom/{static => }/pictures/Sushi.jpg | Bin
.../custom/{static => }/pictures/Sushi_Macro.jpg | Bin
pelican/tests/output/custom/robots.txt | 2 +-
pelican/tests/output/custom/tag/bar.html | 2 +-
pelican/tests/output/custom/tag/foobar.html | 4 ++--
pelican/tests/output/custom/tag/oh.html | 2 +-
pelican/tests/output/custom/tag/yeah.html | 2 +-
.../output/custom/this-is-a-super-article.html | 4 ++--
samples/content/extra/robots.txt | 2 +-
samples/pelican.conf.py | 3 ---
24 files changed, 31 insertions(+), 34 deletions(-)
rename pelican/tests/output/custom/{static => }/pictures/Fat_Cat.jpg (100%)
rename pelican/tests/output/custom/{static => }/pictures/Sushi.jpg (100%)
rename pelican/tests/output/custom/{static => }/pictures/Sushi_Macro.jpg (100%)
diff --git a/pelican/tests/output/custom/author/alexis-metaireau2.html b/pelican/tests/output/custom/author/alexis-metaireau2.html
index 23346f5b..9f4a31e8 100644
--- a/pelican/tests/output/custom/author/alexis-metaireau2.html
+++ b/pelican/tests/output/custom/author/alexis-metaireau2.html
@@ -81,7 +81,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 !
-
+
read more
diff --git a/pelican/tests/output/custom/category/bar.html b/pelican/tests/output/custom/category/bar.html
index 2c1fc646..f7f1bbf3 100644
--- a/pelican/tests/output/custom/category/bar.html
+++ b/pelican/tests/output/custom/category/bar.html
@@ -49,7 +49,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 !
>>> from ipdb import set_trace
>>> set_trace()
diff --git a/samples/content/extra/robots.txt b/samples/content/extra/robots.txt
index ae5b0d05..19a6e299 100644
--- a/samples/content/extra/robots.txt
+++ b/samples/content/extra/robots.txt
@@ -1,2 +1,2 @@
User-agent: *
-Disallow: /static/pictures
+Disallow: /pictures
diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py
index ad2042fd..4d5cd06d 100755
--- a/samples/pelican.conf.py
+++ b/samples/pelican.conf.py
@@ -37,9 +37,6 @@ DEFAULT_METADATA = (('yeah', 'it is'),)
# path-specific metadata
EXTRA_PATH_METADATA = {
'extra/robots.txt': {'path': 'robots.txt'},
- 'pictures/Fat_Cat.jpg': {'path': 'static/pictures/Fat_Cat.jpg'},
- 'pictures/Sushi.jpg': {'path': 'static/pictures/Sushi.jpg'},
- 'pictures/Sushi_Macro.jpg': {'path': 'static/pictures/Sushi_Macro.jpg'},
}
# static paths will be copied without parsing their contents
From 8f295f7a037e0d512181946b9b87636f4a853e26 Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Sun, 16 Jun 2013 08:53:45 -0700
Subject: [PATCH 037/160] PyPI now has CDN; Travis shouldn't use mirrors
Now that PyPI utilizes a CDN, the "--use-mirrors" setting slows down the
install process and has essentially been deprecated.
---
.travis.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 1ff512b6..918fd3f9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,7 @@ before_install:
- sudo locale-gen fr_FR.UTF-8 tr_TR.UTF-8
install:
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then ln -s /usr/share/asciidoc/asciidocapi.py ~/virtualenv/python2.7/lib/python2.7/site-packages/; fi
- - pip install mock --use-mirrors
- - pip install . --use-mirrors
- - pip install --use-mirrors Markdown
+ - pip install mock
+ - pip install .
+ - pip install Markdown
script: python -m unittest discover
From 0d1866b393e79a76ab2b416eb22ac6a924b3849b Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Sat, 5 Jan 2013 11:39:06 -0500
Subject: [PATCH 038/160] Pelican.run: Use keyword arguments when initializing
generators
This makes it easier to add new arguments to Generator subclasses.
---
pelican/__init__.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/pelican/__init__.py b/pelican/__init__.py
index 7f406c4f..78a16e27 100644
--- a/pelican/__init__.py
+++ b/pelican/__init__.py
@@ -157,12 +157,12 @@ class Pelican(object):
context['localsiteurl'] = self.settings['SITEURL'] # share
generators = [
cls(
- context,
- self.settings,
- self.path,
- self.theme,
- self.output_path,
- self.markup,
+ context=context,
+ settings=self.settings,
+ path=self.path,
+ theme=self.theme,
+ output_path=self.output_path,
+ markup=self.markup,
) for cls in self.get_generator_classes()
]
From 6e527e7416cc51b07c4a83b41f050bcf12618fdc Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Sat, 5 Jan 2013 14:23:02 -0500
Subject: [PATCH 039/160] test_generators: Use keyword arguments to initialize
Generators
---
pelican/tests/test_generators.py | 54 +++++++++++++++++++-------------
1 file changed, 33 insertions(+), 21 deletions(-)
diff --git a/pelican/tests/test_generators.py b/pelican/tests/test_generators.py
index f5ed6b85..54f4a232 100644
--- a/pelican/tests/test_generators.py
+++ b/pelican/tests/test_generators.py
@@ -33,8 +33,10 @@ class TestArticlesGenerator(unittest.TestCase):
settings = get_settings(filenames={})
settings['DEFAULT_CATEGORY'] = 'Default'
settings['DEFAULT_DATE'] = (1970, 1, 1)
- self.generator = ArticlesGenerator(settings.copy(), settings,
- CONTENT_DIR, settings['THEME'], None, settings['MARKUP'])
+ self.generator = ArticlesGenerator(
+ context=settings.copy(), settings=settings,
+ path=CONTENT_DIR, theme=settings['THEME'],
+ output_path=None, markup=settings['MARKUP'])
self.generator.generate_context()
return self.generator
@@ -52,16 +54,19 @@ class TestArticlesGenerator(unittest.TestCase):
def test_generate_feeds(self):
settings = get_settings()
- generator = ArticlesGenerator(settings, settings, None,
- settings['THEME'], None, settings['MARKUP'])
+ generator = ArticlesGenerator(
+ context=settings, settings=settings,
+ path=None, theme=settings['THEME'],
+ output_path=None, markup=settings['MARKUP'])
writer = MagicMock()
generator.generate_feeds(writer)
writer.write_feed.assert_called_with([], settings,
'feeds/all.atom.xml')
generator = ArticlesGenerator(
- settings, get_settings(FEED_ALL_ATOM=None), None,
- settings['THEME'], None, None)
+ context=settings, settings=get_settings(FEED_ALL_ATOM=None),
+ path=None, theme=settings['THEME'],
+ output_path=None, markup=None)
writer = MagicMock()
generator.generate_feeds(writer)
self.assertFalse(writer.write_feed.called)
@@ -122,8 +127,9 @@ class TestArticlesGenerator(unittest.TestCase):
settings['USE_FOLDER_AS_CATEGORY'] = False
settings['filenames'] = {}
generator = ArticlesGenerator(
- settings.copy(), settings, CONTENT_DIR, DEFAULT_CONFIG['THEME'],
- None, DEFAULT_CONFIG['MARKUP'])
+ context=settings.copy(), settings=settings,
+ path=CONTENT_DIR, theme=DEFAULT_CONFIG['THEME'],
+ output_path=None, markup=DEFAULT_CONFIG['MARKUP'])
generator.generate_context()
# test for name
# categories are grouped by slug; if two categories have the same slug
@@ -143,9 +149,10 @@ class TestArticlesGenerator(unittest.TestCase):
def test_direct_templates_save_as_default(self):
settings = get_settings(filenames={})
- generator = ArticlesGenerator(settings, settings, None,
- settings['THEME'], None,
- settings['MARKUP'])
+ generator = ArticlesGenerator(
+ context=settings, settings=settings,
+ path=None, theme=settings['THEME'],
+ output_path=None, markup=settings['MARKUP'])
write = MagicMock()
generator.generate_direct_templates(write)
write.assert_called_with("archives.html",
@@ -157,9 +164,10 @@ class TestArticlesGenerator(unittest.TestCase):
settings = get_settings()
settings['DIRECT_TEMPLATES'] = ['archives']
settings['ARCHIVES_SAVE_AS'] = 'archives/index.html'
- generator = ArticlesGenerator(settings, settings, None,
- settings['THEME'], None,
- settings['MARKUP'])
+ generator = ArticlesGenerator(
+ context=settings, settings=settings,
+ path=None, theme=settings['THEME'],
+ output_path=None, markup=settings['MARKUP'])
write = MagicMock()
generator.generate_direct_templates(write)
write.assert_called_with("archives/index.html",
@@ -171,9 +179,10 @@ class TestArticlesGenerator(unittest.TestCase):
settings = get_settings()
settings['DIRECT_TEMPLATES'] = ['archives']
settings['ARCHIVES_SAVE_AS'] = 'archives/index.html'
- generator = ArticlesGenerator(settings, settings, None,
- settings['THEME'], None,
- settings['MARKUP'])
+ generator = ArticlesGenerator(
+ context=settings, settings=settings,
+ path=None, theme=settings['THEME'],
+ output_path=None, markup=settings['MARKUP'])
write = MagicMock()
generator.generate_direct_templates(write)
write.assert_called_count == 0
@@ -215,8 +224,9 @@ class TestPageGenerator(unittest.TestCase):
settings['DEFAULT_DATE'] = (1970, 1, 1)
generator = PagesGenerator(
- settings.copy(), settings, CUR_DIR, settings['THEME'], None,
- settings['MARKUP'])
+ context=settings.copy(), settings=settings,
+ path=CUR_DIR, theme=settings['THEME'],
+ output_path=None, markup=settings['MARKUP'])
generator.generate_context()
pages = self.distill_pages(generator.pages)
hidden_pages = self.distill_pages(generator.hidden_pages)
@@ -258,8 +268,10 @@ class TestTemplatePagesGenerator(unittest.TestCase):
'template/source.html': 'generated/file.html'
}
- generator = TemplatePagesGenerator({'foo': 'bar'}, settings,
- self.temp_content, '', self.temp_output, None)
+ generator = TemplatePagesGenerator(
+ context={'foo': 'bar'}, settings=settings,
+ path=self.temp_content, theme='',
+ output_path=self.temp_output, markup=None)
# create a dummy template file
template_dir = os.path.join(self.temp_content, 'template')
From 12dd35ef360e30f7fb5cc107069cacbe5c43595b Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Sat, 5 Jan 2013 11:41:33 -0500
Subject: [PATCH 040/160] generators: Remove wonky argument handling from
Generator.__init__
---
pelican/generators.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/pelican/generators.py b/pelican/generators.py
index a01281dc..3ebcb648 100644
--- a/pelican/generators.py
+++ b/pelican/generators.py
@@ -31,10 +31,14 @@ logger = logging.getLogger(__name__)
class Generator(object):
"""Baseclass generator"""
- def __init__(self, *args, **kwargs):
- for idx, item in enumerate(('context', 'settings', 'path', 'theme',
- 'output_path', 'markup')):
- setattr(self, item, args[idx])
+ def __init__(self, context, settings, path, theme, output_path, markup,
+ **kwargs):
+ self.context = context
+ self.settings = settings
+ self.path = path
+ self.theme = theme
+ self.output_path = output_path
+ self.markup = markup
for arg, value in kwargs.items():
setattr(self, arg, value)
From 39dd4a025581cfa3b4d6256a3b8f327b26372e1d Mon Sep 17 00:00:00 2001
From: Kyle Machulis
Date: Fri, 14 Jun 2013 12:12:19 -0700
Subject: [PATCH 041/160] Changed meta tag "contents" attribute to "content",
to conform to HTML spec. Fixes #918
---
docs/getting_started.rst | 10 +++++-----
pelican/readers.py | 15 ++++++++++++---
pelican/tests/content/article_with_keywords.html | 2 +-
pelican/tests/content/article_with_metadata.html | 12 ++++++------
.../article_with_metadata_and_contents.html | 15 +++++++++++++++
.../content/article_with_uppercase_metadata.html | 2 +-
pelican/tests/test_readers.py | 15 +++++++++++++++
7 files changed, 55 insertions(+), 16 deletions(-)
create mode 100644 pelican/tests/content/article_with_metadata_and_contents.html
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index 383acdc4..1e31f26d 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -265,11 +265,11 @@ interprets the HTML in a very straightforward manner, reading metadata from
My super title
-
-
-
-
-
+
+
+
+
+
This is the content of my super blog post.
diff --git a/pelican/readers.py b/pelican/readers.py
index bd9f5914..fb2ccfc4 100644
--- a/pelican/readers.py
+++ b/pelican/readers.py
@@ -5,6 +5,7 @@ import datetime
import logging
import os
import re
+import logging
try:
import docutils
import docutils.core
@@ -47,6 +48,8 @@ METADATA_PROCESSORS = {
'author': Author,
}
+logger = logging.getLogger(__name__)
+
class Reader(object):
enabled = True
@@ -199,7 +202,7 @@ class HTMLReader(Reader):
enabled = True
class _HTMLParser(HTMLParser):
- def __init__(self, settings):
+ def __init__(self, settings, filename):
HTMLParser.__init__(self)
self.body = ''
self.metadata = {}
@@ -207,6 +210,8 @@ class HTMLReader(Reader):
self._data_buffer = ''
+ self._filename = filename
+
self._in_top_level = True
self._in_head = False
self._in_title = False
@@ -275,7 +280,11 @@ class HTMLReader(Reader):
def _handle_meta_tag(self, attrs):
name = self._attr_value(attrs, 'name').lower()
- contents = self._attr_value(attrs, 'contents', '')
+ contents = self._attr_value(attrs, 'content', '')
+ if not contents:
+ contents = self._attr_value(attrs, 'contents', '')
+ if contents:
+ logger.warning("Meta tag attribute 'contents' used in file %s, should be changed to 'content'", self._filename)
if name == 'keywords':
name = 'tags'
@@ -288,7 +297,7 @@ class HTMLReader(Reader):
def read(self, filename):
"""Parse content and metadata of HTML files"""
with pelican_open(filename) as content:
- parser = self._HTMLParser(self.settings)
+ parser = self._HTMLParser(self.settings, filename)
parser.feed(content)
parser.close()
diff --git a/pelican/tests/content/article_with_keywords.html b/pelican/tests/content/article_with_keywords.html
index c869f514..0744c754 100644
--- a/pelican/tests/content/article_with_keywords.html
+++ b/pelican/tests/content/article_with_keywords.html
@@ -1,6 +1,6 @@
This is a super article !
-
+
diff --git a/pelican/tests/content/article_with_metadata.html b/pelican/tests/content/article_with_metadata.html
index b108ac8a..b501ea29 100644
--- a/pelican/tests/content/article_with_metadata.html
+++ b/pelican/tests/content/article_with_metadata.html
@@ -1,12 +1,12 @@
This is a super article !
-
-
-
-
-
-
+
+
+
+
+
+
Multi-line metadata should be supported
diff --git a/pelican/tests/content/article_with_metadata_and_contents.html b/pelican/tests/content/article_with_metadata_and_contents.html
new file mode 100644
index 00000000..b108ac8a
--- /dev/null
+++ b/pelican/tests/content/article_with_metadata_and_contents.html
@@ -0,0 +1,15 @@
+
+
+ This is a super article !
+
+
+
+
+
+
+
+
+ Multi-line metadata should be supported
+ as well as inline markup.
+
+
diff --git a/pelican/tests/content/article_with_uppercase_metadata.html b/pelican/tests/content/article_with_uppercase_metadata.html
index 4fe5a9ee..b4cedf39 100644
--- a/pelican/tests/content/article_with_uppercase_metadata.html
+++ b/pelican/tests/content/article_with_uppercase_metadata.html
@@ -1,6 +1,6 @@
This is a super article !
-
+
diff --git a/pelican/tests/test_readers.py b/pelican/tests/test_readers.py
index 14d42325..c67b8a1f 100644
--- a/pelican/tests/test_readers.py
+++ b/pelican/tests/test_readers.py
@@ -350,6 +350,21 @@ class HTMLReaderTest(ReaderTest):
for key, value in expected.items():
self.assertEqual(value, page.metadata[key], key)
+ def test_article_with_metadata_and_contents_attrib(self):
+ page = self.read_file(path='article_with_metadata_and_contents.html')
+ expected = {
+ 'category': 'yeah',
+ 'author': 'Alexis Métaireau',
+ 'title': 'This is a super article !',
+ 'summary': 'Summary and stuff',
+ 'date': datetime.datetime(2010, 12, 2, 10, 14),
+ 'tags': ['foo', 'bar', 'foobar'],
+ 'custom_field': 'http://notmyidea.org',
+ }
+ for key, value in expected.items():
+ self.assertEqual(value, page.metadata[key], key)
+
+
def test_article_with_null_attributes(self):
page = self.read_file(path='article_with_null_attributes.html')
From d8c9fb31d0d1a0f5f3f5319dbabbf50e36fd255b Mon Sep 17 00:00:00 2001
From: Danilo Bargen
Date: Thu, 20 Jun 2013 00:13:57 +0200
Subject: [PATCH 042/160] Better duck typing in isinstance check
---
pelican/__init__.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pelican/__init__.py b/pelican/__init__.py
index 78a16e27..1739aae3 100644
--- a/pelican/__init__.py
+++ b/pelican/__init__.py
@@ -9,6 +9,7 @@ import time
import logging
import argparse
import locale
+import collections
from pelican import signals
@@ -205,7 +206,7 @@ class Pelican(object):
for pair in signals.get_generators.send(self):
(funct, value) = pair
- if not isinstance(value, (tuple, list)):
+ if not isinstance(value, collections.Iterable):
value = (value, )
for v in value:
From dd9f55c8bb0979d230c42cd28bb8b6fbe6d41d98 Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Sat, 22 Jun 2013 12:28:37 -0700
Subject: [PATCH 043/160] Clean up minor text formatting, spelling, grammar
---
pelican/utils.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/pelican/utils.py b/pelican/utils.py
index 9ba234a5..fea7b953 100644
--- a/pelican/utils.py
+++ b/pelican/utils.py
@@ -67,11 +67,11 @@ def strftime(date, date_format):
class DateFormatter(object):
'''A date formatter object used as a jinja filter
-
- Uses the `strftime` implementation and makes sure jinja uses the locale
+
+ Uses the `strftime` implementation and makes sure jinja uses the locale
defined in LOCALE setting
'''
-
+
def __init__(self):
self.locale = locale.setlocale(locale.LC_TIME)
@@ -216,7 +216,7 @@ def get_date(string):
class pelican_open(object):
- """Open a file and return it's content"""
+ """Open a file and return its content"""
def __init__(self, filename):
self.filename = filename
@@ -236,7 +236,7 @@ def slugify(value):
Normalizes string, converts to lowercase, removes non-alpha characters,
and converts spaces to hyphens.
- Took from django sources.
+ Took from Django sources.
"""
# TODO Maybe steal again from current Django 1.5dev
value = Markup(value).striptags()
From e9fec3b1dc32cf9df20fc9774a63065bc14ddad8 Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Mon, 24 Jun 2013 13:05:00 -0700
Subject: [PATCH 044/160] Remove "clean" task from "make html"; fixes #637
This change removes the "clean" task from the "html" and "regenerate"
tasks in the default Makefile generated by pelican-quickstart. The
previous behavior ignored whether the DELETE_OUTPUT_DIRECTORY
setting was set to True or not and deleted everything in the output
directory every time the "make html" or "make regenerate" task was run.
In addition to violating the Principle of Least Astonishment, there was
also the potential for data loss if the user wasn't careful when
defining the output directory location in the Makefile.
The new behavior therefore relies primarily on the
DELETE_OUTPUT_DIRECTORY setting to control if and when the output
directory is cleaned. The default settings and Makefile generated by the
pelican-quickstart command, for example, no longer clean the output
directory when the "make html" task is run. If the user wants to change
this behavior and have the output directory cleaned on every "make html"
run, the recommended method would be to set DELETE_OUTPUT_DIRECTORY to
True in pelicanconf.py. Alternatively, the user can manually run "make
clean", with the caveat that the output directory and its contents will
be entirely destroyed, including any otherwise to-be-retained files or
folders specified in the OUTPUT_RETENTION setting. It is for that reason
that relying on the DELETE_OUTPUT_DIRECTORY setting is instead
recommended.
As before, DELETE_OUTPUT_DIRECTORY is set to True in the publishconf.py
settings file generated by the pelican-quickstart script. This way, any
potentially old and irrelevant files will be automatically removed
before the latest version of the site is transferred to the production
server environment.
In summary, this change allows for the sanest possible default settings,
while still allowing end users to customize output cleaning to their
preferred behavior with a minimum of confusion.
---
pelican/tools/templates/Makefile.in | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in
index 221568aa..8890db6f 100644
--- a/pelican/tools/templates/Makefile.in
+++ b/pelican/tools/templates/Makefile.in
@@ -40,15 +40,13 @@ help:
@echo ' '
-html: clean $$(OUTPUTDIR)/index.html
-
-$$(OUTPUTDIR)/%.html:
+html:
$$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)
clean:
[ ! -d $$(OUTPUTDIR) ] || find $$(OUTPUTDIR) -mindepth 1 -delete
-regenerate: clean
+regenerate:
$$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)
serve:
From bf0a50880d35f803ec5c929bfe60b026accf9307 Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Mon, 24 Jun 2013 13:40:32 -0700
Subject: [PATCH 045/160] Revert "make clean" behavior to rm -rf. Fixes #773
The change to the "make clean" task in 764a2cf from "rm -rf" to instead
relying on GNU "find" appears to have broken cross-platform portability,
likely causing problems on *BSD and other platforms. This commit reverts
that change back to the previous "rm -rf" behavior.
---
pelican/tools/templates/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in
index 8890db6f..4bc764ca 100644
--- a/pelican/tools/templates/Makefile.in
+++ b/pelican/tools/templates/Makefile.in
@@ -44,7 +44,7 @@ html:
$$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)
clean:
- [ ! -d $$(OUTPUTDIR) ] || find $$(OUTPUTDIR) -mindepth 1 -delete
+ [ ! -d $$(OUTPUTDIR) ] || rm -rf $$(OUTPUTDIR)
regenerate:
$$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)
From 6f36b0a2460a41eabb1edd0bd70318c52ddadd47 Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Sun, 23 Jun 2013 11:44:53 -0700
Subject: [PATCH 046/160] Keep certain files when cleaning output; fix #574
If DELETE_OUTPUT_DIRECTORY is set to True, all files and directories are
deleted from the output directory. There are, however, several reasons
one might want to retain certain files/directories and avoid their
deletion from the output directory. One such use case is version control
system data: a versioned output directory can facilitate deployment via
Heroku and/or allow the user to easily revert to a prior version of the
site without having to rely on regeneration via Pelican.
This change introduces the OUTPUT_RETENTION setting, a tuple of
filenames that will be preserved when the clean_output_dir function in
pelican.utils is run. Setting OUTPUT_RETENTION = (".hg", ".git") would,
for example, prevent the relevant VCS data from being deleted when the
output directory is cleaned.
---
docs/settings.rst | 3 +++
pelican/__init__.py | 3 ++-
pelican/settings.py | 1 +
pelican/tests/test_utils.py | 9 ++++++---
pelican/utils.py | 11 +++++++----
5 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/docs/settings.rst b/docs/settings.rst
index ffcddc7a..97662cce 100644
--- a/docs/settings.rst
+++ b/docs/settings.rst
@@ -72,6 +72,9 @@ Setting name (default value) What doe
generating new files. This can be useful in preventing older,
unnecessary files from persisting in your output. However, **this is
a destructive setting and should be handled with extreme care.**
+`OUTPUT_RETENTION` (``()``) A tuple of filenames that should be retained and not deleted from the
+ output directory. One use case would be the preservation of version
+ control data. For example: ``(".hg", ".git", ".bzr")``
`JINJA_EXTENSIONS` (``[]``) A list of any Jinja2 extensions you want to use.
`JINJA_FILTERS` (``{}``) A list of custom Jinja2 filters you want to use.
The dictionary should map the filtername to the filter function.
diff --git a/pelican/__init__.py b/pelican/__init__.py
index 1739aae3..53216421 100644
--- a/pelican/__init__.py
+++ b/pelican/__init__.py
@@ -49,6 +49,7 @@ class Pelican(object):
self.markup = settings['MARKUP']
self.ignore_files = settings['IGNORE_FILES']
self.delete_outputdir = settings['DELETE_OUTPUT_DIRECTORY']
+ self.output_retention = settings['OUTPUT_RETENTION']
self.init_path()
self.init_plugins()
@@ -175,7 +176,7 @@ class Pelican(object):
# explicitely asked
if (self.delete_outputdir and not
os.path.realpath(self.path).startswith(self.output_path)):
- clean_output_dir(self.output_path)
+ clean_output_dir(self.output_path, self.output_retention)
writer = self.get_writer()
diff --git a/pelican/settings.py b/pelican/settings.py
index c6cc6c3c..1c9b48c3 100644
--- a/pelican/settings.py
+++ b/pelican/settings.py
@@ -54,6 +54,7 @@ DEFAULT_CONFIG = {
'NEWEST_FIRST_ARCHIVES': True,
'REVERSE_CATEGORY_ORDER': False,
'DELETE_OUTPUT_DIRECTORY': False,
+ 'OUTPUT_RETENTION': (),
'ARTICLE_URL': '{slug}.html',
'ARTICLE_SAVE_AS': '{slug}.html',
'ARTICLE_LANG_URL': '{slug}-{lang}.html',
diff --git a/pelican/tests/test_utils.py b/pelican/tests/test_utils.py
index 0713e5ed..ab35d991 100644
--- a/pelican/tests/test_utils.py
+++ b/pelican/tests/test_utils.py
@@ -193,28 +193,31 @@ class TestUtils(LoggedTestCase):
shutil.rmtree(empty_path, True)
def test_clean_output_dir(self):
+ retention = ()
test_directory = os.path.join(os.path.dirname(__file__),
'clean_output')
content = os.path.join(os.path.dirname(__file__), 'content')
shutil.copytree(content, test_directory)
- utils.clean_output_dir(test_directory)
+ utils.clean_output_dir(test_directory, retention)
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):
+ retention = ()
test_directory = os.path.join(os.path.dirname(__file__),
'does_not_exist')
- utils.clean_output_dir(test_directory)
+ utils.clean_output_dir(test_directory, retention)
self.assertFalse(os.path.exists(test_directory))
def test_clean_output_dir_is_file(self):
+ retention = ()
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)
+ utils.clean_output_dir(test_directory, retention)
self.assertFalse(os.path.exists(test_directory))
def test_strftime(self):
diff --git a/pelican/utils.py b/pelican/utils.py
index fea7b953..2c70ae8c 100644
--- a/pelican/utils.py
+++ b/pelican/utils.py
@@ -298,8 +298,8 @@ def copy(path, source, destination, destination_path=None, overwrite=False):
logger.warning('skipped copy %s to %s' % (source_, destination_))
-def clean_output_dir(path):
- """Remove all the files from the output directory"""
+def clean_output_dir(path, retention):
+ """Remove all files from output directory except those in retention list"""
if not os.path.exists(path):
logger.debug("Directory already removed: %s" % path)
@@ -312,10 +312,13 @@ def clean_output_dir(path):
logger.error("Unable to delete file %s; %s" % (path, str(e)))
return
- # remove all the existing content from the output folder
+ # remove existing content from output folder unless in retention list
for filename in os.listdir(path):
file = os.path.join(path, filename)
- if os.path.isdir(file):
+ if any(filename == retain for retain in retention):
+ logger.debug("Skipping deletion; %s is on retention list: %s" \
+ % (filename, file))
+ elif os.path.isdir(file):
try:
shutil.rmtree(file)
logger.debug("Deleted directory %s" % file)
From 7d37cfa7485e3a8cb1f8e0ac6001be66fb553bbc Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Tue, 25 Jun 2013 19:17:40 -0700
Subject: [PATCH 047/160] Missing -s flag added to command on tips doc page
---
docs/tips.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/tips.rst b/docs/tips.rst
index 64695db0..e29f73d2 100644
--- a/docs/tips.rst
+++ b/docs/tips.rst
@@ -26,7 +26,7 @@ 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
+ $ pelican content -o output -s pelicanconf.py
$ ghp-import output
$ git push origin gh-pages
From 12fd53c27e133ed4e79c2f5a85ea8fb038c23b12 Mon Sep 17 00:00:00 2001
From: bas smit
Date: Wed, 26 Jun 2013 13:25:20 +0200
Subject: [PATCH 048/160] Add debug target to the template makefile
If the DEBUG variable is set (e.g. DEBUG=1 make target) debugging will
be enabled by using pelicans -D flag.
---
pelican/tools/templates/Makefile.in | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in
index 221568aa..fd553550 100644
--- a/pelican/tools/templates/Makefile.in
+++ b/pelican/tools/templates/Makefile.in
@@ -20,6 +20,11 @@ S3_BUCKET=$s3_bucket
DROPBOX_DIR=$dropbox_dir
+DEBUG ?= 0
+ifeq ($(DEBUG), 1)
+ PELICANOPTS += -D
+endif
+
help:
@echo 'Makefile for a pelican Web site '
@echo ' '
From 0d63b4520a302d5fb8e249c1d98c0043c566315b Mon Sep 17 00:00:00 2001
From: bas smit
Date: Wed, 26 Jun 2013 13:58:35 +0200
Subject: [PATCH 049/160] Add info about debugging to the help output of the
makefile
---
pelican/tools/templates/Makefile.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in
index fd553550..80cf4737 100644
--- a/pelican/tools/templates/Makefile.in
+++ b/pelican/tools/templates/Makefile.in
@@ -43,7 +43,8 @@ help:
@echo ' s3_upload upload the web site via S3 '
@echo ' github upload the web site via gh-pages '
@echo ' '
-
+ @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
+ @echo ' '
html: clean $$(OUTPUTDIR)/index.html
From 5d000ca2904e84c12c255a7b930fc9c38639c580 Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Wed, 26 Jun 2013 06:39:09 -0700
Subject: [PATCH 050/160] Add more missing -s flags to tips doc page
---
docs/tips.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/tips.rst b/docs/tips.rst
index e29f73d2..430d6488 100644
--- a/docs/tips.rst
+++ b/docs/tips.rst
@@ -49,7 +49,7 @@ To publish a Pelican site as User Pages you need to *push* the content of the
Again, you can take advantage of ``ghp-import``::
- $ pelican content -o output pelicanconf.py
+ $ pelican content -o output -s pelicanconf.py
$ ghp-import output
$ git push git@github.com:elemoine/elemoine.github.com.git gh-pages:master
@@ -71,7 +71,7 @@ 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
+ pelican pelican content -o output -s pelicanconf.py && ghp-import output && git push origin gh-pages
Tip #2:
From 931d57160602db2b12d06d4c2a2124504addbd93 Mon Sep 17 00:00:00 2001
From: Danilo Bargen
Date: Fri, 28 Jun 2013 00:53:26 +0200
Subject: [PATCH 051/160] More explicit settings docs concerning list templates
I think the author list and tag list are so common that they should be
listed explicitly in the settings.
---
docs/settings.rst | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/docs/settings.rst b/docs/settings.rst
index 97662cce..1444e174 100644
--- a/docs/settings.rst
+++ b/docs/settings.rst
@@ -237,12 +237,16 @@ Setting name (default value) What does it do?
use the default language.
`PAGE_LANG_SAVE_AS` (``'pages/{slug}-{lang}.html'``) The location we will save the page which doesn't
use the default language.
-`AUTHOR_URL` (``'author/{slug}.html'``) The URL to use for an author.
-`AUTHOR_SAVE_AS` (``'author/{slug}.html'``) The location to save an author.
`CATEGORY_URL` (``'category/{slug}.html'``) The URL to use for a category.
`CATEGORY_SAVE_AS` (``'category/{slug}.html'``) The location to save a category.
`TAG_URL` (``'tag/{slug}.html'``) The URL to use for a tag.
`TAG_SAVE_AS` (``'tag/{slug}.html'``) The location to save the tag page.
+`TAGS_URL` (``'tag/{slug}.html'``) The URL to use for the tag list.
+`TAGS_SAVE_AS` (``'tags.html'``) The location to save the tag list.
+`AUTHOR_URL` (``'author/{slug}.html'``) The URL to use for an author.
+`AUTHOR_SAVE_AS` (``'author/{slug}.html'``) The location to save an author.
+`AUTHORS_URL` (``'authors.html'``) The URL to use for the author list.
+`AUTHORS_SAVE_AS` (``'authors.html'``) The location to save the author list.
`_SAVE_AS` The location to save content generated from direct
templates. Where is the
upper case template name.
From 298151237e9f418aabcf4d70333dc3550a519914 Mon Sep 17 00:00:00 2001
From: Andrew Ma
Date: Wed, 3 Jul 2013 22:36:52 -0700
Subject: [PATCH 052/160] Adding stackoverflow to social icons
---
pelican/themes/notmyidea/static/css/main.css | 1 +
.../static/images/icons/stackoverflow.png | Bin 0 -> 916 bytes
2 files changed, 1 insertion(+)
create mode 100644 pelican/themes/notmyidea/static/images/icons/stackoverflow.png
diff --git a/pelican/themes/notmyidea/static/css/main.css b/pelican/themes/notmyidea/static/css/main.css
index 7f4ca363..fa0bcf1c 100644
--- a/pelican/themes/notmyidea/static/css/main.css
+++ b/pelican/themes/notmyidea/static/css/main.css
@@ -326,6 +326,7 @@ 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*='slideshare.net'] {background-image: url('../images/icons/slideshare.png');}
.social a[href*='speakerdeck.com'] {background-image: url('../images/icons/speakerdeck.png');}
+ .social a[href*='stackoverflow.com'] {background-image: url('../images/icons/stackoverflow.png');}
.social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');}
.social a[href*='vimeo.com'] {background-image: url('../images/icons/vimeo.png');}
.social a[href*='youtube.com'] {background-image: url('../images/icons/youtube.png');}
diff --git a/pelican/themes/notmyidea/static/images/icons/stackoverflow.png b/pelican/themes/notmyidea/static/images/icons/stackoverflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..f5b65e9990dbf423ff652b297f1d0172c8c1cf27
GIT binary patch
literal 916
zcmeAS@N?(olHy`uVBq!ia0vp^0w65F1|7sn8f<3~fRJ+vJ~_8MEyP6_>_pwTJhc%)&)Mu9Ed(YG|jmTlZ9
z@KIPeZ^FK^-?9GB|W>{Q7m)EC+@8;a3mYxk}1?tCE&x6kxKjd-nU)D+_Cb1MZtP
zf6ioHdF7Ur;v^T%WC`(qYnHY?KFysk()nSxK=;)vJ-w30K5t&s)3ykMV9;LODnQ81ohPJtCw>uw6%3rniLY9y-{G%>&K7poH)Ybf9hcZ
zPx7%K&0{68BG<3+JpQ`j393DPNr7J)G`t`kgi;Fv5%&IGQ?s!oY8v6HF>egkKm6gM^6?fU09+hB7{`$2g
z!Dr>|-0l5+On2^2_f4p`m-+THD#}N=VM2Fz(!8K!0$xisQhfv_dG-h{GMTvHCdbLN
z^XFvvX21P9HE8+fMNXk>uPs~lGBfn^9g#*-%#3?x$4
ze30#20|W~;m8*zxxBvb3Dl3rX#Piv+IUi
Date: Fri, 28 Jun 2013 15:09:36 -0700
Subject: [PATCH 053/160] Updating unit tests
---
pelican/tests/output/basic/theme/css/main.css | 1 +
.../basic/theme/images/icons/stackoverflow.png | Bin 0 -> 916 bytes
pelican/tests/output/custom/theme/css/main.css | 1 +
.../custom/theme/images/icons/stackoverflow.png | Bin 0 -> 916 bytes
4 files changed, 2 insertions(+)
create mode 100644 pelican/tests/output/basic/theme/images/icons/stackoverflow.png
create mode 100644 pelican/tests/output/custom/theme/images/icons/stackoverflow.png
diff --git a/pelican/tests/output/basic/theme/css/main.css b/pelican/tests/output/basic/theme/css/main.css
index 7f4ca363..fa0bcf1c 100644
--- a/pelican/tests/output/basic/theme/css/main.css
+++ b/pelican/tests/output/basic/theme/css/main.css
@@ -326,6 +326,7 @@ 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*='slideshare.net'] {background-image: url('../images/icons/slideshare.png');}
.social a[href*='speakerdeck.com'] {background-image: url('../images/icons/speakerdeck.png');}
+ .social a[href*='stackoverflow.com'] {background-image: url('../images/icons/stackoverflow.png');}
.social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');}
.social a[href*='vimeo.com'] {background-image: url('../images/icons/vimeo.png');}
.social a[href*='youtube.com'] {background-image: url('../images/icons/youtube.png');}
diff --git a/pelican/tests/output/basic/theme/images/icons/stackoverflow.png b/pelican/tests/output/basic/theme/images/icons/stackoverflow.png
new file mode 100644
index 0000000000000000000000000000000000000000..f5b65e9990dbf423ff652b297f1d0172c8c1cf27
GIT binary patch
literal 916
zcmeAS@N?(olHy`uVBq!ia0vp^0w65F1|7sn8f<3~fRJ+vJ~_8MEyP6_>_pwTJhc%)&)Mu9Ed(YG|jmTlZ9
z@KIPeZ^FK^-?9GB|W>{Q7m)EC+@8;a3mYxk}1?tCE&x6kxKjd-nU)D+_Cb1MZtP
zf6ioHdF7Ur;v^T%WC`(qYnHY?KFysk()nSxK=;)vJ-w30K5t&s)3ykMV9;LODnQ81ohPJtCw>uw6%3rniLY9y-{G%>&K7poH)Ybf9hcZ
zPx7%K&0{68BG<3+JpQ`j393DPNr7J)G`t`kgi;Fv5%&IGQ?s!oY8v6HF>egkKm6gM^6?fU09+hB7{`$2g
z!Dr>|-0l5+On2^2_f4p`m-+THD#}N=VM2Fz(!8K!0$xisQhfv_dG-h{GMTvHCdbLN
z^XFvvX21P9HE8+fMNXk>uPs~lGBfn^9g#*-%#3?x$4
ze30#20|W~;m8*zxxBvb3Dl3rX#Piv+IUi7sn8f<3~fRJ+vJ~_8MEyP6_>_pwTJhc%)&)Mu9Ed(YG|jmTlZ9
z@KIPeZ^FK^-?9GB|W>{Q7m)EC+@8;a3mYxk}1?tCE&x6kxKjd-nU)D+_Cb1MZtP
zf6ioHdF7Ur;v^T%WC`(qYnHY?KFysk()nSxK=;)vJ-w30K5t&s)3ykMV9;LODnQ81ohPJtCw>uw6%3rniLY9y-{G%>&K7poH)Ybf9hcZ
zPx7%K&0{68BG<3+JpQ`j393DPNr7J)G`t`kgi;Fv5%&IGQ?s!oY8v6HF>egkKm6gM^6?fU09+hB7{`$2g
z!Dr>|-0l5+On2^2_f4p`m-+THD#}N=VM2Fz(!8K!0$xisQhfv_dG-h{GMTvHCdbLN
z^XFvvX21P9HE8+fMNXk>uPs~lGBfn^9g#*-%#3?x$4
ze30#20|W~;m8*zxxBvb3Dl3rX#Piv+IUi
Date: Fri, 28 Jun 2013 19:59:00 -0700
Subject: [PATCH 054/160] Document how to stop generation of certain pages
The documentation doesn't make it very clear how to prevent certain
pages from being generated, such as the Authors, Tags, and Categories
collection pages. This change makes it slightly more obvious how to
prevent these pages from being generated. Fixes #940.
---
docs/settings.rst | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/docs/settings.rst b/docs/settings.rst
index 1444e174..78a0ddf7 100644
--- a/docs/settings.rst
+++ b/docs/settings.rst
@@ -138,8 +138,9 @@ 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). If the tag and category collections
+ are not needed, set ``DIRECT_TEMPLATES = ('index', 'archives')``
`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.
@@ -261,7 +262,10 @@ Setting name (default value) What does it do?
.. note::
- When any of the `*_SAVE_AS` settings is set to False, files will not be created.
+ If you do not want one or more of the default pages to be created (e.g.,
+ you are the only author on your site and thus do not need an Authors page),
+ set the corresponding ``*_SAVE_AS`` setting to ``False`` to prevent the
+ relevant page from being generated.
Timezone
--------
From 39518e15efc6535ef654b0e9e526239db62d7ac8 Mon Sep 17 00:00:00 2001
From: Andy Pearce
Date: Fri, 14 Jun 2013 15:54:06 +0100
Subject: [PATCH 055/160] Allow text substitutions when generating slugs
The `slugify()` function used by Pelican is in general very good at
coming up with something both readable and URL-safe. However, there are
a few specific cases where it causes conflicts. One that I've run into
is using the strings `C++` and `C` as tags, both of which transform to
the slug `c`. This commit adds an optional `SLUG_SUBSTITUTIONS` setting
which is a list of 2-tuples of substitutions to be carried out
case-insensitively just prior to stripping out non-alphanumeric
characters. This allows cases like `C++` to be transformed to `CPP` or
similar. This can also improve the readability of slugs.
---
docs/settings.rst | 4 ++++
pelican/contents.py | 3 ++-
pelican/settings.py | 1 +
pelican/tests/test_utils.py | 11 +++++++++++
pelican/urlwrappers.py | 11 ++++++-----
pelican/utils.py | 8 +++++---
6 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/docs/settings.rst b/docs/settings.rst
index 78a0ddf7..61ccc2b2 100644
--- a/docs/settings.rst
+++ b/docs/settings.rst
@@ -258,6 +258,10 @@ Setting name (default value) What does it do?
posts.
`DAY_ARCHIVE_SAVE_AS` (False) The location to save per-day archives of your
posts.
+`SLUG_SUBSTITUTIONS` (``()``) Substitutions to make prior to stripping out
+ non-alphanumerics when generating slugs. Specified
+ as a list of 2-tuples of ``(from, to)`` which are
+ applied in order.
==================================================== =====================================================
.. note::
diff --git a/pelican/contents.py b/pelican/contents.py
index 1b604f19..d56335dd 100644
--- a/pelican/contents.py
+++ b/pelican/contents.py
@@ -86,7 +86,8 @@ class Content(object):
# create the slug if not existing, from the title
if not hasattr(self, 'slug') and hasattr(self, 'title'):
- self.slug = slugify(self.title)
+ self.slug = slugify(self.title,
+ settings.get('SLUG_SUBSTITUTIONS', ()))
self.source_path = source_path
diff --git a/pelican/settings.py b/pelican/settings.py
index 1c9b48c3..01203504 100644
--- a/pelican/settings.py
+++ b/pelican/settings.py
@@ -105,6 +105,7 @@ DEFAULT_CONFIG = {
'PLUGINS': [],
'TEMPLATE_PAGES': {},
'IGNORE_FILES': ['.#*'],
+ 'SLUG_SUBSTITUTIONS': (),
}
def read_settings(path=None, override=None):
diff --git a/pelican/tests/test_utils.py b/pelican/tests/test_utils.py
index ab35d991..0e65003a 100644
--- a/pelican/tests/test_utils.py
+++ b/pelican/tests/test_utils.py
@@ -94,6 +94,17 @@ class TestUtils(LoggedTestCase):
for value, expected in samples:
self.assertEqual(utils.slugify(value), expected)
+ def test_slugify_substitute(self):
+
+ samples = (('C++ is based on C', 'cpp-is-based-on-c'),
+ ('C+++ test C+ test', 'cpp-test-c-test'),
+ ('c++, c#, C#, C++', 'cpp-c-sharp-c-sharp-cpp'),
+ ('c++-streams', 'cpp-streams'),)
+
+ subs = (('C++', 'CPP'), ('C#', 'C-SHARP'))
+ for value, expected in samples:
+ self.assertEqual(utils.slugify(value, subs), expected)
+
def test_get_relative_path(self):
samples = ((os.path.join('test', 'test.html'), os.pardir),
diff --git a/pelican/urlwrappers.py b/pelican/urlwrappers.py
index b0df61ad..acb8e07d 100644
--- a/pelican/urlwrappers.py
+++ b/pelican/urlwrappers.py
@@ -15,10 +15,10 @@ class URLWrapper(object):
def __init__(self, name, settings):
# next 2 lines are redundant with the setter of the name property
# but are here for clarity
- self._name = name
- self.slug = slugify(name)
- self.name = name
self.settings = settings
+ self._name = name
+ self.slug = slugify(name, self.settings.get('SLUG_SUBSTITUTIONS', ()))
+ self.name = name
@property
def name(self):
@@ -27,7 +27,7 @@ class URLWrapper(object):
@name.setter
def name(self, name):
self._name = name
- self.slug = slugify(name)
+ self.slug = slugify(name, self.settings.get('SLUG_SUBSTITUTIONS', ()))
def as_dict(self):
d = self.__dict__
@@ -41,7 +41,8 @@ class URLWrapper(object):
return self.slug
def _normalize_key(self, key):
- return six.text_type(slugify(key))
+ subs = self.settings.get('SLUG_SUBSTITUTIONS', ())
+ return six.text_type(slugify(key, subs))
def __eq__(self, other):
return self._key() == self._normalize_key(other)
diff --git a/pelican/utils.py b/pelican/utils.py
index 2c70ae8c..b1524036 100644
--- a/pelican/utils.py
+++ b/pelican/utils.py
@@ -231,7 +231,7 @@ class pelican_open(object):
pass
-def slugify(value):
+def slugify(value, substitutions=()):
"""
Normalizes string, converts to lowercase, removes non-alpha characters,
and converts spaces to hyphens.
@@ -249,8 +249,10 @@ def slugify(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 = unicodedata.normalize('NFKD', value).lower()
+ for src, dst in substitutions:
+ value = value.replace(src.lower(), dst.lower())
+ value = re.sub('[^\w\s-]', '', value).strip()
value = re.sub('[-\s]+', '-', value)
# we want only ASCII chars
value = value.encode('ascii', 'ignore')
From 3da4c2e13e4146e1d0a58fd0e7267bb4ad957881 Mon Sep 17 00:00:00 2001
From: Stefan hr Berder
Date: Sun, 7 Jul 2013 12:44:21 +0200
Subject: [PATCH 056/160] add port option to pelican.server
---
pelican/server.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pelican/server.py b/pelican/server.py
index fd99b209..24f3ae04 100644
--- a/pelican/server.py
+++ b/pelican/server.py
@@ -10,7 +10,7 @@ try:
except ImportError:
import socketserver # NOQA
-PORT = 8000
+PORT = len(sys.argv) == 2 and int(sys.argv[1]) or 8000
Handler = srvmod.SimpleHTTPRequestHandler
@@ -26,4 +26,4 @@ try:
httpd.serve_forever()
except KeyboardInterrupt as e:
print("shutting down server")
- httpd.socket.close()
\ No newline at end of file
+ httpd.socket.close()
From 00a1cbb6b84d9faad2d7dde01b068ff113b0184e Mon Sep 17 00:00:00 2001
From: Lingzhu Xiang
Date: Sat, 4 May 2013 06:13:11 +0800
Subject: [PATCH 057/160] Support importing Tumblr
Try to integrate Tumblr's various post types without using
additonal templates.
---
docs/importer.rst | 14 ++++--
pelican/tools/pelican_import.py | 88 ++++++++++++++++++++++++++++++++-
2 files changed, 98 insertions(+), 4 deletions(-)
diff --git a/docs/importer.rst b/docs/importer.rst
index 9a0c513e..057fecd8 100644
--- a/docs/importer.rst
+++ b/docs/importer.rst
@@ -14,6 +14,7 @@ software to reStructuredText or Markdown. The supported import formats are:
- WordPress XML export
- Dotclear export
- Posterous API
+- Tumblr API
- RSS/Atom feed
The conversion from HTML to reStructuredText or Markdown relies on `Pandoc`_.
@@ -41,16 +42,17 @@ Usage
::
- pelican-import [-h] [--wpfile] [--dotclear] [--posterous] [--feed] [-o OUTPUT]
+ pelican-import [-h] [--wpfile] [--dotclear] [--posterous] [--tumblr] [--feed] [-o OUTPUT]
[-m MARKUP] [--dir-cat] [--dir-page] [--strip-raw] [--disable-slugs]
- [-e EMAIL] [-p PASSWORD]
- input|api_token
+ [-e EMAIL] [-p PASSWORD] [-b BLOGNAME]
+ input|api_token|api_key
Positional arguments
--------------------
input The input file to read
api_token [Posterous only] api_token can be obtained from http://posterous.com/api/
+ api_key [Tumblr only] api_key can be obtained from http://www.tumblr.com/oauth/apps
Optional arguments
------------------
@@ -59,6 +61,7 @@ Optional arguments
--wpfile WordPress XML export (default: False)
--dotclear Dotclear export (default: False)
--posterous Posterous API (default: False)
+ --tumblr Tumblr API (default: False)
--feed Feed to parse (default: False)
-o OUTPUT, --output OUTPUT
Output path (default: output)
@@ -80,6 +83,8 @@ Optional arguments
Email used to authenticate Posterous API
-p PASSWORD, --password=PASSWORD
Password used to authenticate Posterous API
+ -b BLOGNAME, --blogname=BLOGNAME
+ Blog name used in Tumblr API
Examples
@@ -97,6 +102,9 @@ for Posterous::
$ pelican-import --posterous -o ~/output --email= --password=
+For Tumblr::
+
+ $ pelican-import --tumblr -o ~/output --blogname=
Tests
=====
diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py
index 630142e7..5f637c73 100755
--- a/pelican/tools/pelican_import.py
+++ b/pelican/tools/pelican_import.py
@@ -326,6 +326,84 @@ def posterous2fields(api_token, email, password):
yield (post.get('title'), post.get('body_cleaned'), slug, date,
post.get('user').get('display_name'), [], tags, kind, "html")
+
+def tumblr2fields(api_key, blogname):
+ """ Imports Tumblr posts (API v2)"""
+ from time import strftime, localtime
+ try:
+ # py3k import
+ import json
+ except ImportError:
+ # py2 import
+ import simplejson as json
+
+ try:
+ # py3k import
+ import urllib.request as urllib_request
+ except ImportError:
+ # py2 import
+ import urllib2 as urllib_request
+
+ def get_tumblr_posts(api_key, blogname, offset=0):
+ url = "http://api.tumblr.com/v2/blog/%s.tumblr.com/posts?api_key=%s&offset=%d&filter=raw" % (blogname, api_key, offset)
+ request = urllib_request.Request(url)
+ handle = urllib_request.urlopen(request)
+ posts = json.loads(handle.read().decode('utf-8'))
+ return posts.get('response').get('posts')
+
+ offset = 0
+ posts = get_tumblr_posts(api_key, blogname, offset)
+ while len(posts) > 0:
+ for post in posts:
+ title = post.get('title') or post.get('source_title')
+ slug = post.get('slug') or slugify(title)
+ tags = post.get('tags')
+ timestamp = post.get('timestamp')
+ date = strftime("%Y-%m-%d %H:%M:%S", localtime(int(timestamp)))
+ slug = strftime("%Y-%m-%d-", localtime(int(timestamp))) + slug
+ format = post.get('format')
+ content = post.get('body')
+ type = post.get('type')
+ if type == 'photo':
+ if format == 'markdown':
+ fmtstr = ''
+ else:
+ fmtstr = ''
+ content = '\n'.join(fmtstr % (photo.get('caption'), photo.get('original_size').get('url')) for photo in post.get('photos'))
+ elif type == 'quote':
+ if format == 'markdown':
+ fmtstr = '\n\n— %s'
+ else:
+ fmtstr = '
— %s
'
+ content = post.get('text') + fmtstr % post.get('source')
+ elif type == 'link':
+ if format == 'markdown':
+ fmtstr = '[via](%s)\n\n'
+ else:
+ fmtstr = '
From f43742c3f0b6b3a260ff5c338d7c4309865b0b54 Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Mon, 15 Jul 2013 14:25:39 -0700
Subject: [PATCH 066/160] Add missing SITEURL variable to tag cloud docs
---
docs/settings.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/settings.rst b/docs/settings.rst
index 2c16ca83..eb0d028f 100644
--- a/docs/settings.rst
+++ b/docs/settings.rst
@@ -493,11 +493,11 @@ Setting name (default value) What does it do?
`TAG_CLOUD_MAX_ITEMS` (``100``) Maximum number of tags in the cloud.
================================================ =====================================================
-The default theme does not support tag clouds, but it is pretty easy to add::
+The default theme does not include a tag cloud, but it is pretty easy to add::
From c5008f61e0a480afb954a5258748eec576ee9a72 Mon Sep 17 00:00:00 2001
From: Jude N
Date: Tue, 16 Jul 2013 23:44:53 -0400
Subject: [PATCH 067/160] Adding a FEED_ALL_ATOM check in the "social" div.
The head section has a tests for FEED_ALL_ATOM when building the atom link. This diff add a similar test in the "social" div.
---
pelican/themes/notmyidea/templates/base.html | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pelican/themes/notmyidea/templates/base.html b/pelican/themes/notmyidea/templates/base.html
index 9bf4b12b..e44e20fd 100644
--- a/pelican/themes/notmyidea/templates/base.html
+++ b/pelican/themes/notmyidea/templates/base.html
@@ -53,7 +53,9 @@
{% endif %}
diff --git a/pelican/writers.py b/pelican/writers.py
index fe37b25d..1113a5ba 100644
--- a/pelican/writers.py
+++ b/pelican/writers.py
@@ -150,36 +150,37 @@ class Writer(object):
# check paginated
paginated = paginated or {}
if paginated:
+ name_root, ext = os.path.splitext(name)
+
# pagination needed, init paginators
paginators = {}
for key in paginated.keys():
object_list = paginated[key]
- if self.settings['DEFAULT_PAGINATION']:
- paginators[key] = Paginator(object_list,
- self.settings['DEFAULT_PAGINATION'],
- self.settings['DEFAULT_ORPHANS'])
- else:
- paginators[key] = Paginator(object_list, len(object_list))
+ paginators[key] = Paginator(
+ name_root,
+ object_list,
+ self.settings,
+ )
# generated pages, and write
- name_root, ext = os.path.splitext(name)
for page_num in range(list(paginators.values())[0].num_pages):
paginated_localcontext = localcontext.copy()
for key in paginators.keys():
paginator = paginators[key]
+ previous_page = paginator.page(page_num) \
+ if page_num > 0 else None
page = paginator.page(page_num + 1)
+ next_page = paginator.page(page_num + 2) \
+ if page_num + 1 < paginator.num_pages else None
paginated_localcontext.update(
{'%s_paginator' % key: paginator,
- '%s_page' % key: page})
- if page_num > 0:
- paginated_name = '%s%s%s' % (
- name_root, page_num + 1, ext)
- else:
- paginated_name = name
+ '%s_page' % key: page,
+ '%s_previous_page' % key: previous_page,
+ '%s_next_page' % key: next_page})
_write_file(template, paginated_localcontext, self.output_path,
- paginated_name)
+ page.save_as)
else:
# no pagination
_write_file(template, localcontext, self.output_path, name)
From e07b39dfcb4748066ade21ed75f41295ecd8ac7e Mon Sep 17 00:00:00 2001
From: Ross McFarland
Date: Sat, 29 Dec 2012 17:44:35 -0800
Subject: [PATCH 074/160] more robust PAGINATION_(URL|SAVE_AS) support
- add base_name and number_seperator to context to give more flexibility
when naming things
---
pelican/paginator.py | 9 ++++++++-
pelican/writers.py | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/pelican/paginator.py b/pelican/paginator.py
index 5fc6357e..6be64b39 100644
--- a/pelican/paginator.py
+++ b/pelican/paginator.py
@@ -4,6 +4,7 @@ from __future__ import unicode_literals, print_function
# From django.core.paginator
import functools
import logging
+import os
from math import ceil
@@ -114,10 +115,16 @@ class Page(object):
return value
else:
context = self.__dict__
+ context['base_name'] = os.path.dirname(self.name)
+ context['number_sep'] = '/'
if self.number == 1:
# no page numbers on the first page
context['number'] = ''
- return unicode(value).format(**context)
+ context['number_sep'] = ''
+ ret = unicode(value).format(**context)
+ if ret[0] == '/':
+ ret = ret[1:]
+ return ret
url = property(functools.partial(_from_settings, key='URL'))
save_as = property(functools.partial(_from_settings, key='SAVE_AS'))
diff --git a/pelican/writers.py b/pelican/writers.py
index 1113a5ba..25f49aeb 100644
--- a/pelican/writers.py
+++ b/pelican/writers.py
@@ -150,7 +150,7 @@ class Writer(object):
# check paginated
paginated = paginated or {}
if paginated:
- name_root, ext = os.path.splitext(name)
+ name_root = os.path.splitext(name)[0]
# pagination needed, init paginators
paginators = {}
From 0caa101ec73ef392cb2a38d3de0e732b7d544b55 Mon Sep 17 00:00:00 2001
From: Ross McFarland
Date: Sun, 31 Mar 2013 07:41:14 -0700
Subject: [PATCH 075/160] use six.string_types for python 3 compat
---
pelican/paginator.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pelican/paginator.py b/pelican/paginator.py
index 6be64b39..a03ef2af 100644
--- a/pelican/paginator.py
+++ b/pelican/paginator.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
+import six
# From django.core.paginator
import functools
@@ -110,7 +111,7 @@ class Page(object):
logic."""
setting = "%s_%s" % ('PAGINATION', key)
value = self.settings[setting]
- if not isinstance(value, basestring):
+ if not isinstance(value, six.string_types):
logger.warning(u'%s is set to %s' % (setting, value))
return value
else:
From 71e83635ea062c7b9cfdaca941f57e70628ba5ae Mon Sep 17 00:00:00 2001
From: Ross McFarland
Date: Sun, 12 May 2013 17:59:44 -0700
Subject: [PATCH 076/160] remove u prefix from string literal, using
unicode_literals
---
pelican/paginator.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pelican/paginator.py b/pelican/paginator.py
index a03ef2af..e29a32fe 100644
--- a/pelican/paginator.py
+++ b/pelican/paginator.py
@@ -112,7 +112,7 @@ class Page(object):
setting = "%s_%s" % ('PAGINATION', key)
value = self.settings[setting]
if not isinstance(value, six.string_types):
- logger.warning(u'%s is set to %s' % (setting, value))
+ logger.warning('%s is set to %s' % (setting, value))
return value
else:
context = self.__dict__
From 95890a2a611100a833ee727a4a39d5334b017ddf Mon Sep 17 00:00:00 2001
From: Nathan Yergler
Date: Mon, 29 Jul 2013 08:10:28 -0400
Subject: [PATCH 077/160] Allow definition of pagination rules by page index.
---
pelican/paginator.py | 20 ++++++++++++++++++--
pelican/settings.py | 15 +++++++++++++--
2 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/pelican/paginator.py b/pelican/paginator.py
index e29a32fe..b5db2d7d 100644
--- a/pelican/paginator.py
+++ b/pelican/paginator.py
@@ -3,6 +3,7 @@ from __future__ import unicode_literals, print_function
import six
# From django.core.paginator
+from collections import namedtuple
import functools
import logging
import os
@@ -11,6 +12,13 @@ from math import ceil
logger = logging.getLogger(__name__)
+
+PaginationRule = namedtuple(
+ 'PaginationRule',
+ 'min_page URL SAVE_AS',
+)
+
+
class Paginator(object):
def __init__(self, name, object_list, settings):
self.name = name
@@ -109,8 +117,16 @@ class Page(object):
"""Returns URL information as defined in settings. Similar to
URLWrapper._from_settings, but specialized to deal with pagination
logic."""
- setting = "%s_%s" % ('PAGINATION', key)
- value = self.settings[setting]
+
+ rule = None
+
+ # find the last matching pagination rule
+ for p in self.settings['PAGINATION_PATTERNS']:
+ if p.min_page <= self.number:
+ rule = p
+
+ value = getattr(rule, key)
+
if not isinstance(value, six.string_types):
logger.warning('%s is set to %s' % (setting, value))
return value
diff --git a/pelican/settings.py b/pelican/settings.py
index b65a6df7..ff5f4ce4 100644
--- a/pelican/settings.py
+++ b/pelican/settings.py
@@ -73,8 +73,9 @@ DEFAULT_CONFIG = {
'TAG_SAVE_AS': os.path.join('tag', '{slug}.html'),
'AUTHOR_URL': 'author/{slug}.html',
'AUTHOR_SAVE_AS': os.path.join('author', '{slug}.html'),
- 'PAGINATION_URL': '{name}{number}.html',
- 'PAGINATION_SAVE_AS': '{name}{number}.html',
+ 'PAGINATION_PATTERNS': [
+ (0, '{name}{number}.html', '{name}{number}.html'),
+ ],
'YEAR_ARCHIVE_SAVE_AS': False,
'MONTH_ARCHIVE_SAVE_AS': False,
'DAY_ARCHIVE_SAVE_AS': False,
@@ -238,6 +239,16 @@ def configure_settings(settings):
'http://docs.getpelican.com/en/latest/settings.html#timezone '
'for more information')
+ # fix up pagination rules
+ from pelican.paginator import PaginationRule
+ pagination_rules = [
+ PaginationRule(*r) for r in settings['PAGINATION_PATTERNS']
+ ]
+ settings['PAGINATION_PATTERNS'] = sorted(
+ pagination_rules,
+ key=lambda r: r[0],
+ )
+
# Save people from accidentally setting a string rather than a list
path_keys = (
'ARTICLE_EXCLUDES',
From 30192b2318b71cac718f8e116edc288611701085 Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Mon, 29 Jul 2013 11:03:14 -0700
Subject: [PATCH 078/160] Add fabfile generation to pelican-quickstart
This commit adds optional fabfile.py generation during the
pelican-quickstart process. Reasons include:
* "make" is cumbersome to install on Windows
* Fabric runs in any Python environment
* fabfile is just Python and thus more flexible and extensible
This is an initial implementation and does not currently provide as many
upload options as its Makefile counterpart.
Refs #584.
---
docs/getting_started.rst | 83 ++++++++++++++++++++++++---
pelican/tools/pelican_quickstart.py | 14 ++++-
pelican/tools/templates/fabfile.py.in | 47 +++++++++++++++
3 files changed, 133 insertions(+), 11 deletions(-)
create mode 100644 pelican/tools/templates/fabfile.py.in
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index 383acdc4..b8ffbf43 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -152,21 +152,87 @@ if you plan to create non-chronological content)::
│ └── (pages)
├── output
├── develop_server.sh
+ ├── fabfile.py
├── Makefile
├── pelicanconf.py # Main settings file
└── publishconf.py # Settings to use when ready to publish
The next step is to begin to adding content to the *content* folder that has
-been created for you. (See *Writing articles using Pelican* section below for
-more information about how to format your content.)
+been created for you. (See the **Writing content using Pelican** section below
+for more information about how to format your content.)
Once you have written some content to generate, you can use the ``pelican``
command to generate your site, which will be placed in the output folder.
-Alternatively, you can use automation tools that "wrap" the ``pelican`` command
-to simplify the process of generating, previewing, and uploading your site. One
-such tool is the ``Makefile`` that's automatically created for you when you use
-``pelican-quickstart`` to create a skeleton project. To use ``make`` to
-generate your site, run::
+
+Automation tools
+================
+
+While the ``pelican`` command is the canonical way to generate your site,
+automation tools can be used to streamline the generation and publication
+flow. One of the questions asked during the ``pelican-quickstart`` process
+described above pertains to whether you want to automate site generation and
+publication. If you answered "yes" to that question, a ``fabfile.py`` and
+``Makefile`` will be generated in the root of your project. These files,
+pre-populated with certain information gleaned from other answers provided
+during the ``pelican-quickstart`` process, are meant as a starting point and
+should be customized to fit your particular needs and usage patterns. If you
+find one or both of these automation tools to be of limited utility, these
+files can deleted at any time and will not affect usage of the canonical
+``pelican`` command.
+
+Following are automation tools that "wrap" the ``pelican`` command and can
+simplify the process of generating, previewing, and uploading your site.
+
+Fabric
+------
+
+The advantage of Fabric_ is that it is written in Python and thus can be used
+in a wide range of environments. The downside is that it must be installed
+separately. Use the following command to install Fabric, prefixing with
+``sudo`` if your environment requires it::
+
+ $ pip install Fabric
+
+Take a moment to open the ``fabfile.py`` file that was generated in your
+project root. You will see a number of commands, any one of which can be
+renamed, removed, and/or customized to your liking. Using the out-of-the-box
+configuration, you can generate your site via::
+
+ $ fab build
+
+If you'd prefer to have Pelican automatically regenerate your site every time a
+change is detected (which is handy when testing locally), use the following
+command instead::
+
+ $ fab regenerate
+
+To serve the generated site so it can be previewed in your browser at
+http://localhost:8000/::
+
+ $ fab serve
+
+If during the ``pelican-quickstart`` process you answered "yes" when asked
+whether you want to upload your site via SSH, you can use the following command
+to publish your site via rsync over SSH::
+
+ $ fab publish
+
+These are just a few of the commands available by default, so feel free to
+explore ``fabfile.py`` and see what other commands are available. More
+importantly, don't hesitate to customize ``fabfile.py`` to suit your specific
+needs and preferences.
+
+Make
+----
+
+A ``Makefile`` is also automatically created for you when you say "yes" to
+the relevant question during the ``pelican-quickstart`` process. The advantage
+of this method is that the ``make`` command is built into most POSIX systems
+and thus doesn't require installing anything else in order to use it. The
+downside is that non-POSIX systems (e.g., Windows) do not include ``make``,
+and installing it on those systems can be a non-trivial task.
+
+If you want to use ``make`` to generate your site, run::
$ make html
@@ -177,7 +243,7 @@ command instead::
$ make regenerate
To serve the generated site so it can be previewed in your browser at
-http://localhost:8000::
+http://localhost:8000/::
$ make serve
@@ -484,3 +550,4 @@ listed on the index page nor on any category page.
.. _virtualenv: http://www.virtualenv.org/
.. _W3C ISO 8601: http://www.w3.org/TR/NOTE-datetime
+.. _Fabric: http://fabfile.org/
diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py
index e62bc5ca..46ba1a82 100755
--- a/pelican/tools/pelican_quickstart.py
+++ b/pelican/tools/pelican_quickstart.py
@@ -193,10 +193,10 @@ needed by Pelican.
else:
CONF['default_pagination'] = False
- mkfile = ask('Do you want to generate a Makefile to easily manage your website?', bool, True)
+ automation = ask('Do you want to generate a Fabfile/Makefile to automate generation and publishing?', bool, True)
develop = ask('Do you want an auto-reload & simpleHTTP script to assist with theme and site development?', bool, True)
- if mkfile:
+ if automation:
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_compat, CONF['ftp_host'])
CONF['ftp_user'] = ask('What is your username on that server?', str_compat, CONF['ftp_user'])
@@ -243,7 +243,15 @@ needed by Pelican.
except OSError as e:
print('Error: {0}'.format(e))
- if mkfile:
+ if automation:
+ try:
+ with codecs.open(os.path.join(CONF['basedir'], 'fabfile.py'), 'w', 'utf-8') as fd:
+ for line in get_template('fabfile.py'):
+ template = string.Template(line)
+ fd.write(template.safe_substitute(CONF))
+ fd.close()
+ except OSError as e:
+ print('Error: {0}'.format(e))
try:
with codecs.open(os.path.join(CONF['basedir'], 'Makefile'), 'w', 'utf-8') as fd:
mkfile_template_name = 'Makefile'
diff --git a/pelican/tools/templates/fabfile.py.in b/pelican/tools/templates/fabfile.py.in
new file mode 100644
index 00000000..e991b763
--- /dev/null
+++ b/pelican/tools/templates/fabfile.py.in
@@ -0,0 +1,47 @@
+from fabric.api import *
+import fabric.contrib.project as project
+import os
+
+# Local path configuration (can be absolute or relative to fabfile)
+env.deploy_path = 'output'
+
+# Remote server configuration
+production = '$ssh_user@$ssh_host:$ssh_port'
+dest_path = '$ssh_target_dir'
+
+DEPLOY_PATH = env.deploy_path
+
+def clean():
+ if os.path.isdir(DEPLOY_PATH):
+ local('rm -rf {deploy_path}'.format(**env))
+ local('mkdir {deploy_path}'.format(**env))
+
+def build():
+ local('pelican -s pelicanconf.py')
+
+def rebuild():
+ clean()
+ build()
+
+def regenerate():
+ local('pelican -r -s pelicanconf.py')
+
+def serve():
+ local('cd {deploy_path} && python -m SimpleHTTPServer'.format(**env))
+
+def reserve():
+ build()
+ serve()
+
+def preview():
+ local('pelican -s publishconf.py')
+
+@hosts(production)
+def publish():
+ local('pelican -s publishconf.py')
+ project.rsync_project(
+ remote_dir=dest_path,
+ exclude=".DS_Store",
+ local_dir=DEPLOY_PATH.rstrip('/') + '/',
+ delete=True
+ )
From 0e0775b74a1e4131ffa2f38f501458210c365fa3 Mon Sep 17 00:00:00 2001
From: Philipp Klose
Date: Wed, 31 Jul 2013 22:43:02 +0200
Subject: [PATCH 079/160] Fix file endings for examples
reStructured should use reStructured for linked documents. Markdown should use Markdown for linked documents.
---
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 b8ffbf43..ee9e2d17 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -418,8 +418,8 @@ In this example, ``article1.rst`` could look like::
See below intra-site link examples in reStructuredText format.
- `a link relative to content root <|filename|/cat/article2.md>`_
- `a link relative to current file <|filename|cat/article2.md>`_
+ `a link relative to content root <|filename|/cat/article2.rst>`_
+ `a link relative to current file <|filename|cat/article2.rst>`_
and ``article2.md``::
@@ -428,8 +428,8 @@ and ``article2.md``::
See below intra-site link examples in Markdown format.
- [a link relative to content root](|filename|/article1.rst)
- [a link relative to current file](|filename|../article1.rst)
+ [a link relative to content root](|filename|/article1.md)
+ [a link relative to current file](|filename|../article1.md)
Embedding non-article or non-page content is slightly different in that the
directories need to be specified in ``pelicanconf.py`` file. The ``images``
From 51dc02f29836bebc3e809640aa5b3aa2d33ba8f9 Mon Sep 17 00:00:00 2001
From: Kyle Fuller
Date: Wed, 31 Jul 2013 23:08:42 +0100
Subject: [PATCH 080/160] Add documentation for WITH_FUTURE_DATES
Closes #952
---
docs/settings.rst | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docs/settings.rst b/docs/settings.rst
index eb0d028f..9a38d499 100644
--- a/docs/settings.rst
+++ b/docs/settings.rst
@@ -153,6 +153,8 @@ Setting name (default value) What doe
These templates need to use ``DIRECT_TEMPLATES`` setting.
`ASCIIDOC_OPTIONS` (``[]``) A list of options to pass to AsciiDoc. See the `manpage
`_
+`WITH_FUTURE_DATES` (``True``) If disabled, content with dates in the future will get a
+ default status of draft.
===================================================================== =====================================================================
.. [#] Default is the system locale.
From 9abc08ea9f6c8c58edae77a7c4cb9c8364b2729d Mon Sep 17 00:00:00 2001
From: Nathan Yergler
Date: Wed, 31 Jul 2013 18:57:21 -0700
Subject: [PATCH 081/160] Don't assume that PAGINATION_PATTERNS will always be
present.
---
pelican/settings.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pelican/settings.py b/pelican/settings.py
index ff5f4ce4..59f1354f 100644
--- a/pelican/settings.py
+++ b/pelican/settings.py
@@ -242,7 +242,7 @@ def configure_settings(settings):
# fix up pagination rules
from pelican.paginator import PaginationRule
pagination_rules = [
- PaginationRule(*r) for r in settings['PAGINATION_PATTERNS']
+ PaginationRule(*r) for r in settings.get('PAGINATION_PATTERNS', [])
]
settings['PAGINATION_PATTERNS'] = sorted(
pagination_rules,
From 89034f8b3f099fd00240548bb6f5a515ea298ecc Mon Sep 17 00:00:00 2001
From: Russ Webber
Date: Thu, 18 Jul 2013 10:36:44 +0800
Subject: [PATCH 082/160] added THEME_STATIC_DIR setting
The theme static output directory path is now customisable via settings.
i.e. you can now use 'assets' instead of 'theme'.
---
docs/settings.rst | 3 +++
pelican/generators.py | 3 ++-
pelican/settings.py | 1 +
pelican/themes/notmyidea/templates/base.html | 2 +-
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/docs/settings.rst b/docs/settings.rst
index 9a38d499..a4299be6 100644
--- a/docs/settings.rst
+++ b/docs/settings.rst
@@ -547,6 +547,9 @@ Setting name (default value) What does it do?
or absolute path to a theme folder, or the name of a
default theme or a theme installed via
``pelican-themes`` (see below).
+`THEME_STATIC_DIR` (``'theme'``) Destination directory in the output path where
+ Pelican will place the files collected from
+ `THEME_STATIC_PATHS`. Default is `theme`.
`THEME_STATIC_PATHS` (``['static']``) Static theme paths you want to copy. Default
value is `static`, but if your theme has
other static paths, you can put them here.
diff --git a/pelican/generators.py b/pelican/generators.py
index 0dc3667f..166ff616 100644
--- a/pelican/generators.py
+++ b/pelican/generators.py
@@ -564,7 +564,8 @@ class StaticGenerator(Generator):
def generate_output(self, writer):
self._copy_paths(self.settings['THEME_STATIC_PATHS'], self.theme,
- 'theme', self.output_path, os.curdir)
+ self.settings['THEME_STATIC_DIR'], self.output_path,
+ os.curdir)
# copy all Static files
for sc in self.staticfiles:
source_path = os.path.join(self.path, sc.source_path)
diff --git a/pelican/settings.py b/pelican/settings.py
index 01203504..e631fab3 100644
--- a/pelican/settings.py
+++ b/pelican/settings.py
@@ -35,6 +35,7 @@ DEFAULT_CONFIG = {
'OUTPUT_PATH': 'output',
'MARKUP': ('rst', 'md'),
'STATIC_PATHS': ['images', ],
+ 'THEME_STATIC_DIR': 'theme',
'THEME_STATIC_PATHS': ['static', ],
'FEED_ALL_ATOM': os.path.join('feeds', 'all.atom.xml'),
'CATEGORY_FEED_ATOM': os.path.join('feeds', '%s.atom.xml'),
diff --git a/pelican/themes/notmyidea/templates/base.html b/pelican/themes/notmyidea/templates/base.html
index 9bf4b12b..a9edad6d 100644
--- a/pelican/themes/notmyidea/templates/base.html
+++ b/pelican/themes/notmyidea/templates/base.html
@@ -3,7 +3,7 @@
{% block title %}{{ SITENAME }}{%endblock%}
-
+
{% if FEED_ALL_ATOM %}
{% endif %}
From 74c7c72fb3dbe481bd891f447eb1e4056bcbb9a4 Mon Sep 17 00:00:00 2001
From: Nathan Yergler
Date: Wed, 31 Jul 2013 21:31:08 -0700
Subject: [PATCH 083/160] Use six.u instead of unicode.
---
pelican/paginator.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pelican/paginator.py b/pelican/paginator.py
index b5db2d7d..39ea0e3a 100644
--- a/pelican/paginator.py
+++ b/pelican/paginator.py
@@ -138,7 +138,7 @@ class Page(object):
# no page numbers on the first page
context['number'] = ''
context['number_sep'] = ''
- ret = unicode(value).format(**context)
+ ret = six.u(value).format(**context)
if ret[0] == '/':
ret = ret[1:]
return ret
From 4fa9184b01642d1c2738db627f57353134ca65e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexis=20M=C3=A9taireau?=
Date: Thu, 1 Aug 2013 14:38:00 +0200
Subject: [PATCH 084/160] Start a section about plugin recipes in the docs
---
docs/plugins.rst | 66 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/docs/plugins.rst b/docs/plugins.rst
index 9bf08ff3..93307afb 100644
--- a/docs/plugins.rst
+++ b/docs/plugins.rst
@@ -123,3 +123,69 @@ request if you need them!
static_generate_context static_generator_context
static_generate_preread static_generator_preread
========================== ===========================
+
+Recipes
+=======
+
+We eventually realised some of the recipes to create plugins would be best
+shared in the documentation somewhere, so here they are!
+
+How to create a new reader
+--------------------------
+
+One thing you might want is to add the support for your very own input
+format. While it might make sense to add this feature in pelican core, we
+wisely chose to avoid this situation, and have the different readers defined in
+plugins.
+
+The rationale behind this choice is mainly that plugins are really easy to
+write and don't slow down pelican itself when they're not active.
+
+No more talking, here is the example::
+
+ from pelican import signals
+ from pelican.readers import EXTENSIONS, Reader
+
+ # Create a new reader class, inheriting from the pelican.reader.Reader
+ class NewReader(Reader):
+ enabled = True # Yeah, you probably want that :-)
+
+ # The list of extensions you want this reader to match with.
+ # In the case multiple readers use the same extensions, the latest will
+ # win (so the one you're defining here, most probably).
+ file_extensions = ['yeah']
+
+ # You need to have a read method, which takes a filename and returns
+ # some content and the associated metadata.
+ def read(self, filename):
+ metadata = {'title': 'Oh yeah',
+ 'category': 'Foo',
+ 'date': '2012-12-01'}
+
+ parsed = {}
+ for key, value in metadata.items():
+ parsed[key] = self.process_metadata(key, value)
+
+ return "Some content", parsed
+
+ def add_reader(arg):
+ EXTENSIONS['yeah'] = NewReader
+
+ # this is how pelican works.
+ def register():
+ signals.initialized.connect(add_reader)
+
+
+Adding a new generator
+----------------------
+
+Adding a new generator is also really easy. You might want to have a look at
+:doc:`internals` for more information on how to create your own generator.
+
+::
+
+ def get_generators(generators):
+ # define a new generator here if you need to
+ return generators
+
+ signals.get_generators.connect(get_generators)
From 4c1b5c342947a4fdbd63dcc99c2bb0d487c6b4ec Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Thu, 1 Aug 2013 15:13:32 -0700
Subject: [PATCH 085/160] Correct URL for pip install editable in docs
Refs # 975
---
docs/getting_started.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index ee9e2d17..d09e40c7 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -41,7 +41,7 @@ method::
If you have Git installed and prefer to install the latest bleeding-edge
version of Pelican rather than a stable release, use the following command::
- $ pip install -e git://github.com/getpelican/pelican#egg=pelican
+ $ pip install -e git+https://github.com/getpelican/pelican.git#egg=pelican
If you plan on using Markdown as a markup format, you'll need to install the
Markdown library as well::
From 03e9d0182d03779632d96bbce2e9f67d32e4eeaf Mon Sep 17 00:00:00 2001
From: karl
Date: Sat, 3 Aug 2013 00:31:43 -0400
Subject: [PATCH 086/160] Fixing documentation according to Issue #362.
The documentation as it is right now produces a CRITICAL: 'article' is
undefined
---
docs/faq.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/faq.rst b/docs/faq.rst
index a8043e07..8eafba3f 100644
--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -92,7 +92,7 @@ For reStructuredText, this metadata should of course be prefixed with a colon::
This metadata can then be accessed in the template::
- {% if article.modified %}
+ {% if article and article.modified %}
Last modified: {{ article.modified }}
{% endif %}
From 6a0d19ef5c22ad8434f70bc650944419dcd98f8f Mon Sep 17 00:00:00 2001
From: karl
Date: Sat, 3 Aug 2013 12:47:44 -0400
Subject: [PATCH 087/160] Adding context to the documentation for metadata
Giving a longer description Thanks to justin mayer for #995
---
docs/faq.rst | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/docs/faq.rst b/docs/faq.rst
index 8eafba3f..bb348d45 100644
--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -90,12 +90,16 @@ For reStructuredText, this metadata should of course be prefixed with a colon::
:Modified: 2012-08-08
-This metadata can then be accessed in the template::
+This metadata can then be accessed in templates such as `article.html` via::
- {% if article and article.modified %}
+ {% if article.modified %}
Last modified: {{ article.modified }}
{% endif %}
+If you want to include metadata in templates outside the article context (e.g., `base.html`), the `if` statement should instead be:
+
+ {% if article and article.modified %}
+
How do I assign custom templates on a per-page basis?
=====================================================
From 92f5c06ba63e06964ea8a444f606fdd7683bff0b Mon Sep 17 00:00:00 2001
From: Nicholas Kuechler
Date: Sat, 3 Aug 2013 14:58:52 -0500
Subject: [PATCH 088/160] Group PDF related settings together.
---
pelican/settings.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pelican/settings.py b/pelican/settings.py
index e631fab3..7a7f091a 100644
--- a/pelican/settings.py
+++ b/pelican/settings.py
@@ -45,7 +45,6 @@ DEFAULT_CONFIG = {
'SITENAME': 'A Pelican Blog',
'DISPLAY_PAGES_ON_MENU': True,
'DISPLAY_CATEGORIES_ON_MENU': True,
- 'PDF_GENERATOR': False,
'OUTPUT_SOURCES': False,
'OUTPUT_SOURCES_EXTENSION': '.text',
'USE_FOLDER_AS_CATEGORY': True,
@@ -66,6 +65,7 @@ DEFAULT_CONFIG = {
'PAGE_LANG_SAVE_AS': os.path.join('pages', '{slug}-{lang}.html'),
'STATIC_URL': '{path}',
'STATIC_SAVE_AS': '{path}',
+ 'PDF_GENERATOR': False,
'PDF_STYLE_PATH': '',
'PDF_STYLE': 'twelvepoint',
'CATEGORY_URL': 'category/{slug}.html',
From 5ffbf907decd2bea80b9b41803b2ac240267da62 Mon Sep 17 00:00:00 2001
From: Nathan Yergler
Date: Sat, 3 Aug 2013 13:49:43 -0700
Subject: [PATCH 089/160] Create new formatting context dict instead of using
self.__dict__
Using self.__dict__ is fine, but when its mutated it changes the
object's state. Creating a new dict avoids needing to think about
that, and doesn't introduce Python 3 issues (ie, where self.number is
accidentally set to '').
---
pelican/paginator.py | 44 ++++++++++++++++++++++++++++----------------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/pelican/paginator.py b/pelican/paginator.py
index 39ea0e3a..df8606ec 100644
--- a/pelican/paginator.py
+++ b/pelican/paginator.py
@@ -125,23 +125,35 @@ class Page(object):
if p.min_page <= self.number:
rule = p
- value = getattr(rule, key)
+ if not rule:
+ return ''
- if not isinstance(value, six.string_types):
- logger.warning('%s is set to %s' % (setting, value))
- return value
- else:
- context = self.__dict__
- context['base_name'] = os.path.dirname(self.name)
- context['number_sep'] = '/'
- if self.number == 1:
- # no page numbers on the first page
- context['number'] = ''
- context['number_sep'] = ''
- ret = six.u(value).format(**context)
- if ret[0] == '/':
- ret = ret[1:]
- return ret
+ prop_value = getattr(rule, key)
+
+ if not isinstance(prop_value, six.string_types):
+ logger.warning('%s is set to %s' % (key, prop_value))
+ return prop_value
+
+ # URL or SAVE_AS is a string, format it with a controlled context
+ context = {
+ 'name': self.name,
+ 'object_list': self.object_list,
+ 'number': self.number,
+ 'paginator': self.paginator,
+ 'settings': self.settings,
+ 'base_name': os.path.dirname(self.name),
+ 'number_sep': '/',
+ }
+
+ if self.number == 1:
+ # no page numbers on the first page
+ context['number'] = ''
+ context['number_sep'] = ''
+
+ ret = prop_value.format(**context)
+ if ret[0] == '/':
+ ret = ret[1:]
+ return ret
url = property(functools.partial(_from_settings, key='URL'))
save_as = property(functools.partial(_from_settings, key='SAVE_AS'))
From 50ff7ce89f7f68c9fe8e4de75f4a06334695794d Mon Sep 17 00:00:00 2001
From: Nathan Yergler
Date: Sat, 3 Aug 2013 14:04:58 -0700
Subject: [PATCH 090/160] Fall back to the default PAGINATION PATTERNS when
none specified.
---
pelican/settings.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pelican/settings.py b/pelican/settings.py
index 59f1354f..b8e634ca 100644
--- a/pelican/settings.py
+++ b/pelican/settings.py
@@ -242,7 +242,10 @@ def configure_settings(settings):
# fix up pagination rules
from pelican.paginator import PaginationRule
pagination_rules = [
- PaginationRule(*r) for r in settings.get('PAGINATION_PATTERNS', [])
+ PaginationRule(*r) for r in settings.get(
+ 'PAGINATION_PATTERNS',
+ DEFAULT_CONFIG['PAGINATION_PATTERNS'],
+ )
]
settings['PAGINATION_PATTERNS'] = sorted(
pagination_rules,
From d61ef0c66ce6f6db4568f34662f7fd00f8dae6d2 Mon Sep 17 00:00:00 2001
From: Nathan Yergler
Date: Sat, 3 Aug 2013 14:06:16 -0700
Subject: [PATCH 091/160] Adding basic documentation for PAGINATION_PATTERNS.
---
docs/settings.rst | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/docs/settings.rst b/docs/settings.rst
index eb0d028f..548e9cec 100644
--- a/docs/settings.rst
+++ b/docs/settings.rst
@@ -477,8 +477,32 @@ Setting name (default value) What does it do?
`DEFAULT_PAGINATION` (``False``) The maximum number of articles to include on a
page, not including orphans. False to disable
pagination.
+`PAGINATION_PATTERNS` A set of patterns that are used to determine advanced
+ pagination output.
================================================ =====================================================
+Using Pagination Patterns
+-------------------------
+
+The ``PAGINATION_PATTERNS`` setting can be used to configure where
+subsequent pages are created. The setting is a sequence of three
+element tuples, where each tuple consists of::
+
+ (minimum page, URL setting, SAVE_AS setting,)
+
+For example, if you wanted the first page to just be ``/``, and the
+second (and subsequent) pages to be ``/page/2/``, you would set
+``PAGINATION_PATTERNS`` as follows::
+
+ PAGINATION_PATTERNS = (
+ (1, '{base_name}/', '{base_name}/index.html'),
+ (2, '{base_name}/page/{number}/', '{base_name}/page/{number}/index.html'),
+ )
+
+This would cause the first page to be written to
+``{base_name}/index.html``, and subsequent ones would be written into
+``page/{number}`` directories.
+
Tag cloud
=========
From 76fa4576547cb01d4bfecbd7d40cd70dca7b44d2 Mon Sep 17 00:00:00 2001
From: Justin Mayer
Date: Sat, 3 Aug 2013 16:17:26 -0700
Subject: [PATCH 092/160] Normalize whitespace via lstrip Jinja parameter
This adds the lstrip_blocks Jinja parameter and removes unnecessary
whitespace from a few notmyidea templates.
Note: The lstrip_blocks parameter requires Jinja 2.7+, which has been
noted in Pelican's setup.py.
Credit for this commit goes entirely to Russ Webber, who has earned my
eternal thanks for discovering and applying this useful Jinja parameter.
Refs #969
---
pelican/generators.py | 1 +
.../basic/a-markdown-powered-article.html | 36 ++---
pelican/tests/output/basic/archives.html | 28 ++--
pelican/tests/output/basic/article-1.html | 36 ++---
pelican/tests/output/basic/article-2.html | 36 ++---
pelican/tests/output/basic/article-3.html | 36 ++---
.../output/basic/author/alexis-metaireau.html | 62 ++++---
pelican/tests/output/basic/categories.html | 28 ++--
pelican/tests/output/basic/category/bar.html | 46 +++---
pelican/tests/output/basic/category/cat1.html | 82 +++++-----
pelican/tests/output/basic/category/misc.html | 76 ++++-----
pelican/tests/output/basic/category/yeah.html | 46 +++---
.../basic/filename_metadata-example.html | 36 ++---
pelican/tests/output/basic/index.html | 152 ++++++++----------
pelican/tests/output/basic/oh-yeah.html | 38 ++---
.../tests/output/basic/override/index.html | 33 ++--
.../pages/this-is-a-test-hidden-page.html | 33 ++--
.../basic/pages/this-is-a-test-page.html | 33 ++--
.../tests/output/basic/second-article-fr.html | 42 ++---
.../tests/output/basic/second-article.html | 42 ++---
pelican/tests/output/basic/tag/bar.html | 80 +++++----
pelican/tests/output/basic/tag/baz.html | 50 +++---
pelican/tests/output/basic/tag/foo.html | 66 ++++----
pelican/tests/output/basic/tag/foobar.html | 46 +++---
pelican/tests/output/basic/tag/oh.html | 46 +++---
pelican/tests/output/basic/tag/yeah.html | 46 +++---
.../output/basic/this-is-a-super-article.html | 38 ++---
pelican/tests/output/basic/unbelievable.html | 36 ++---
.../custom/a-markdown-powered-article.html | 66 ++++----
pelican/tests/output/custom/archives.html | 54 +++----
pelican/tests/output/custom/article-1.html | 66 ++++----
pelican/tests/output/custom/article-2.html | 66 ++++----
pelican/tests/output/custom/article-3.html | 66 ++++----
.../custom/author/alexis-metaireau.html | 124 +++++++-------
.../custom/author/alexis-metaireau2.html | 139 ++++++++--------
.../custom/author/alexis-metaireau3.html | 83 +++++-----
pelican/tests/output/custom/categories.html | 54 +++----
pelican/tests/output/custom/category/bar.html | 84 +++++-----
.../tests/output/custom/category/cat1.html | 122 +++++++-------
.../tests/output/custom/category/misc.html | 114 +++++++------
.../tests/output/custom/category/yeah.html | 78 +++++----
.../output/custom/drafts/a-draft-article.html | 64 ++++----
.../custom/filename_metadata-example.html | 66 ++++----
pelican/tests/output/custom/index.html | 130 +++++++--------
pelican/tests/output/custom/index2.html | 133 +++++++--------
pelican/tests/output/custom/index3.html | 83 +++++-----
.../tests/output/custom/jinja2_template.html | 54 +++----
pelican/tests/output/custom/oh-yeah-fr.html | 72 ++++-----
pelican/tests/output/custom/oh-yeah.html | 72 ++++-----
.../tests/output/custom/override/index.html | 59 ++++---
.../pages/this-is-a-test-hidden-page.html | 59 ++++---
.../custom/pages/this-is-a-test-page.html | 59 ++++---
.../output/custom/second-article-fr.html | 72 ++++-----
.../tests/output/custom/second-article.html | 72 ++++-----
pelican/tests/output/custom/tag/bar.html | 120 +++++++-------
pelican/tests/output/custom/tag/baz.html | 84 +++++-----
pelican/tests/output/custom/tag/foo.html | 100 ++++++------
pelican/tests/output/custom/tag/foobar.html | 78 +++++----
pelican/tests/output/custom/tag/oh.html | 84 +++++-----
pelican/tests/output/custom/tag/yeah.html | 84 +++++-----
.../custom/this-is-a-super-article.html | 66 ++++----
pelican/tests/output/custom/unbelievable.html | 66 ++++----
pelican/themes/notmyidea/templates/index.html | 16 +-
pelican/themes/notmyidea/templates/page.html | 4 +-
.../notmyidea/templates/translations.html | 2 +-
setup.py | 2 +-
66 files changed, 2004 insertions(+), 2143 deletions(-)
diff --git a/pelican/generators.py b/pelican/generators.py
index 166ff616..13909743 100644
--- a/pelican/generators.py
+++ b/pelican/generators.py
@@ -56,6 +56,7 @@ class Generator(object):
"themes", "simple", "templates"))
self.env = Environment(
trim_blocks=True,
+ lstrip_blocks=True,
loader=ChoiceLoader([
FileSystemLoader(self._templates_path),
simple_loader, # implicit inheritance
diff --git a/pelican/tests/output/basic/a-markdown-powered-article.html b/pelican/tests/output/basic/a-markdown-powered-article.html
index 29c6d0d6..6f854ae4 100644
--- a/pelican/tests/output/basic/a-markdown-powered-article.html
+++ b/pelican/tests/output/basic/a-markdown-powered-article.html
@@ -4,8 +4,8 @@
A markdown powered article
-
-
+
+
@@ -15,46 +15,46 @@
Comments !
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Archives for Alexis' log
@@ -52,29 +52,29 @@
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Article 1
-In cat1.
+In cat1.
Article 1
Comments !
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Article 2
-In cat1.
+In cat1.
Article 2
Comments !
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Article 3
-In cat1.
+In cat1.
Article 3
Comments !
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+A markdown powered article
-A markdown powered article
+In cat1.
+In cat1.
You're mutually oblivious.
a root-relative link to unbelievable a file-relative link to unbelievable
There are comments.
Other articles
- - -
+
-
+
-
+
Thu 17 February 2011
-
+
By Alexis Métaireau
-
+
Article 1
In cat1.
+In cat1.
Article 1
read more -There are comments.
There are comments.
Article 2
In cat1.
+In cat1.
Article 2
read more -There are comments.
There are comments.
Article 3
In cat1.
+In cat1.
Article 3
read more -There are comments.
There are comments.
- Page 1 / 3 - » -
-+ Page 1 / 3 + » +
+ +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+-
+
-
+
-
+
Fri 30 November 2012
-
+
By Alexis Métaireau
-
+
FILENAME_METADATA example
In misc.
+In misc.
Some cool stuff!
read more -There are comments.
There are comments.
Oh yeah !
In bar.
-tags: ohbaryeah
Translations: - fr - +In bar.
+tags: ohbaryeah
Translations: + fr +Why not ?
After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! @@ -85,92 +80,88 @@ YEAH !
There are comments.
There are comments.
Second article
In misc.
-tags: foobarbaz
Translations: - fr - +In misc.
+tags: foobarbaz
Translations: + fr +This is some article, in english
read more -There are comments.
There are comments.
This is a super article !
In yeah.
+In yeah.
tags: foobarfoobar
Multi-line metadata should be supported as well as inline markup.
read more -There are comments.
There are comments.
- « - Page 2 / 3 - » -
-+ « + Page 2 / 3 + » +
+ +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+-
+
-
+
-
+
Fri 15 October 2010
-
+
By Alexis Métaireau
-
+
Unbelievable !
In misc.
+In misc.
Or completely awesome. Depends the needs.
a root-relative link to markdown-article a file-relative link to markdown-article
read more -There are comments.
There are comments.
- « - Page 3 / 3 -
-+ « + Page 3 / 3 +
+ +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
++- yeah
- misc
- cat1
- bar
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/category/bar.html b/pelican/tests/output/custom/category/bar.html
index 4198d868..71ca6213 100644
--- a/pelican/tests/output/custom/category/bar.html
+++ b/pelican/tests/output/custom/category/bar.html
@@ -4,9 +4,9 @@
Alexis' log - bar
-
-
-
+
+
+
@@ -19,32 +19,30 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
+
-
+
Wed 20 October 2010
-
+
By Alexis Métaireau
-
-
-
-
-
-
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/category/cat1.html b/pelican/tests/output/custom/category/cat1.html
index 50a7a80b..e91ff166 100644
--- a/pelican/tests/output/custom/category/cat1.html
+++ b/pelican/tests/output/custom/category/cat1.html
@@ -4,9 +4,9 @@
Alexis' log - cat1
-
-
-
+
+
+
@@ -19,142 +19,134 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
+
-
+
Wed 20 April 2011
-
+
By Alexis Métaireau
-
-
-
+
+
-
-
-
+
-
+
-
+
Thu 17 February 2011
-
+
By Alexis Métaireau
-
+
-
-
-
+
-
+
-
+
Thu 17 February 2011
-
+
By Alexis Métaireau
-
+
-
-
-
+
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/category/misc.html b/pelican/tests/output/custom/category/misc.html
index f2afbaeb..f87abede 100644
--- a/pelican/tests/output/custom/category/misc.html
+++ b/pelican/tests/output/custom/category/misc.html
@@ -4,9 +4,9 @@
Alexis' log - misc
-
-
-
+
+
+
@@ -19,120 +19,114 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
+
-
+
Fri 30 November 2012
-
+
By Alexis Métaireau
-
-
-
+
+
-
-
-
+
-
+
-
+
Fri 15 October 2010
-
+
By Alexis Métaireau
-
+
-
-
-
-
+
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/category/yeah.html b/pelican/tests/output/custom/category/yeah.html
index fa3e018f..1a5db423 100644
--- a/pelican/tests/output/custom/category/yeah.html
+++ b/pelican/tests/output/custom/category/yeah.html
@@ -4,9 +4,9 @@
Alexis' log - yeah
-
-
-
+
+
+
@@ -19,29 +19,27 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
+
-
+
Thu 02 December 2010
-
+
By Alexis Métaireau
-
@@ -56,36 +54,36 @@
-
-
-
-
-
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/drafts/a-draft-article.html b/pelican/tests/output/custom/drafts/a-draft-article.html
index 40854732..0bfbc1d6 100644
--- a/pelican/tests/output/custom/drafts/a-draft-article.html
+++ b/pelican/tests/output/custom/drafts/a-draft-article.html
@@ -4,9 +4,9 @@
A draft article
-
-
-
+
+
+
@@ -19,64 +19,64 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
+
+
-
+
Fri 02 March 2012
-
+
By Alexis Métaireau
-
-
+
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/filename_metadata-example.html b/pelican/tests/output/custom/filename_metadata-example.html
index db0e2b19..a9c0f5c1 100644
--- a/pelican/tests/output/custom/filename_metadata-example.html
+++ b/pelican/tests/output/custom/filename_metadata-example.html
@@ -4,9 +4,9 @@
FILENAME_METADATA example
-
-
-
+
+
+
@@ -19,37 +19,37 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
+
+
-
+
Fri 30 November 2012
-
+
By Alexis Métaireau
-
-
+
-
+
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/index.html b/pelican/tests/output/custom/index.html
index 68f51f06..92aef088 100644
--- a/pelican/tests/output/custom/index.html
+++ b/pelican/tests/output/custom/index.html
@@ -4,9 +4,9 @@
Alexis' log
-
-
-
+
+
+
@@ -19,145 +19,137 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
+
-
+
Fri 30 November 2012
-
+
By Alexis Métaireau
-
-
-
+
+
-
-
-
+
-
+
-
+
Wed 20 April 2011
-
+
By Alexis Métaireau
-
+
-
-
-
+
-
+
-
+
Thu 17 February 2011
-
+
By Alexis Métaireau
-
+
-
-
-
-
+
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/index2.html b/pelican/tests/output/custom/index2.html
index e85dd580..2355c7a1 100644
--- a/pelican/tests/output/custom/index2.html
+++ b/pelican/tests/output/custom/index2.html
@@ -4,9 +4,9 @@
Alexis' log
-
-
-
+
+
+
@@ -19,115 +19,106 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
-
+
-
-
-
+
-
+
-
+
Thu 17 February 2011
-
+
By Alexis Métaireau
-
+
-
-
-
+
-
+
-
+
Thu 02 December 2010
-
+
By Alexis Métaireau
-
+
-
-
-
+
-
+
-
+
Wed 20 October 2010
-
+
By Alexis Métaireau
-
read more
-
+
-
-
-
-
+
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/index3.html b/pelican/tests/output/custom/index3.html
index af973106..8121e987 100644
--- a/pelican/tests/output/custom/index3.html
+++ b/pelican/tests/output/custom/index3.html
@@ -4,9 +4,9 @@
Alexis' log
-
-
-
+
+
+
@@ -19,74 +19,71 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
-
+
-
-
-
-
+
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/jinja2_template.html b/pelican/tests/output/custom/jinja2_template.html
index fcd60de6..0f0eee83 100644
--- a/pelican/tests/output/custom/jinja2_template.html
+++ b/pelican/tests/output/custom/jinja2_template.html
@@ -4,9 +4,9 @@
Alexis' log
-
-
-
+
+
+
@@ -19,41 +19,41 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
+
Some text
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/oh-yeah-fr.html b/pelican/tests/output/custom/oh-yeah-fr.html
index f18d3f07..2590eb3b 100644
--- a/pelican/tests/output/custom/oh-yeah-fr.html
+++ b/pelican/tests/output/custom/oh-yeah-fr.html
@@ -4,9 +4,9 @@
Trop bien !
-
-
-
+
+
+
@@ -19,39 +19,39 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
+
+
-
+
Fri 02 March 2012
-
+
By Alexis Métaireau
-
-
+
-
+
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/oh-yeah.html b/pelican/tests/output/custom/oh-yeah.html
index c0e77d00..d1c70eeb 100644
--- a/pelican/tests/output/custom/oh-yeah.html
+++ b/pelican/tests/output/custom/oh-yeah.html
@@ -4,9 +4,9 @@
Oh yeah !
-
-
-
+
+
+
@@ -19,35 +19,35 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
+
+
-
+
Wed 20 October 2010
-
+
By Alexis Métaireau
-
-
+
-
+
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/override/index.html b/pelican/tests/output/custom/override/index.html
index ca8490d6..1042dbb0 100644
--- a/pelican/tests/output/custom/override/index.html
+++ b/pelican/tests/output/custom/override/index.html
@@ -4,9 +4,9 @@
Override url/save_as
-
-
-
+
+
+
@@ -19,46 +19,45 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
+
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/pages/this-is-a-test-hidden-page.html b/pelican/tests/output/custom/pages/this-is-a-test-hidden-page.html
index 89275001..d9b3851c 100644
--- a/pelican/tests/output/custom/pages/this-is-a-test-hidden-page.html
+++ b/pelican/tests/output/custom/pages/this-is-a-test-hidden-page.html
@@ -4,9 +4,9 @@
This is a test hidden page
-
-
-
+
+
+
@@ -19,46 +19,45 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
+
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/pages/this-is-a-test-page.html b/pelican/tests/output/custom/pages/this-is-a-test-page.html
index d969d152..d6dedd9a 100644
--- a/pelican/tests/output/custom/pages/this-is-a-test-page.html
+++ b/pelican/tests/output/custom/pages/this-is-a-test-page.html
@@ -4,9 +4,9 @@
This is a test page
-
-
-
+
+
+
@@ -19,46 +19,45 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
+
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/second-article-fr.html b/pelican/tests/output/custom/second-article-fr.html
index 16ca3cc9..0ac5c01c 100644
--- a/pelican/tests/output/custom/second-article-fr.html
+++ b/pelican/tests/output/custom/second-article-fr.html
@@ -4,9 +4,9 @@
Deuxième article
-
-
-
+
+
+
@@ -19,39 +19,39 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
+
+
-
+
Wed 29 February 2012
-
+
By Alexis Métaireau
-
-
+
-
+
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/second-article.html b/pelican/tests/output/custom/second-article.html
index 4740eded..289a6308 100644
--- a/pelican/tests/output/custom/second-article.html
+++ b/pelican/tests/output/custom/second-article.html
@@ -4,9 +4,9 @@
Second article
-
-
-
+
+
+
@@ -19,39 +19,39 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
+
+
-
+
Wed 29 February 2012
-
+
By Alexis Métaireau
-
-
+
-
+
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/tag/bar.html b/pelican/tests/output/custom/tag/bar.html
index 5f26883b..2f6a1016 100644
--- a/pelican/tests/output/custom/tag/bar.html
+++ b/pelican/tests/output/custom/tag/bar.html
@@ -4,9 +4,9 @@
Alexis' log - bar
-
-
-
+
+
+
@@ -19,87 +19,81 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
+
-
+
Wed 29 February 2012
-
+
By Alexis Métaireau
-
-
-
+
+
-
-
-
+
-
+
-
+
Wed 20 October 2010
-
+
By Alexis Métaireau
-
read more
-
+
-
-
-
-
+
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/tag/baz.html b/pelican/tests/output/custom/tag/baz.html
index 46aa6095..cf4fb3f6 100644
--- a/pelican/tests/output/custom/tag/baz.html
+++ b/pelican/tests/output/custom/tag/baz.html
@@ -4,9 +4,9 @@
Alexis' log - baz
-
-
-
+
+
+
@@ -19,64 +19,62 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
+
-
+
Wed 29 February 2012
-
+
By Alexis Métaireau
-
-
-
-
-
-
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/tag/foo.html b/pelican/tests/output/custom/tag/foo.html
index 04d37f1b..b6c741bd 100644
--- a/pelican/tests/output/custom/tag/foo.html
+++ b/pelican/tests/output/custom/tag/foo.html
@@ -4,9 +4,9 @@
Alexis' log - foo
-
-
-
+
+
+
@@ -19,94 +19,90 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
+
-
+
Wed 29 February 2012
-
+
By Alexis Métaireau
-
-
-
+
+
-
-
-
-
+
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/tag/foobar.html b/pelican/tests/output/custom/tag/foobar.html
index 961e381a..cdecccd7 100644
--- a/pelican/tests/output/custom/tag/foobar.html
+++ b/pelican/tests/output/custom/tag/foobar.html
@@ -4,9 +4,9 @@
Alexis' log - foobar
-
-
-
+
+
+
@@ -19,29 +19,27 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
+
-
+
Thu 02 December 2010
-
+
By Alexis Métaireau
-
@@ -56,36 +54,36 @@
-
-
-
-
-
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/tag/oh.html b/pelican/tests/output/custom/tag/oh.html
index 5452f4d3..d3bde1dc 100644
--- a/pelican/tests/output/custom/tag/oh.html
+++ b/pelican/tests/output/custom/tag/oh.html
@@ -4,9 +4,9 @@
Alexis' log - oh
-
-
-
+
+
+
@@ -19,32 +19,30 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
+
-
+
Wed 20 October 2010
-
+
By Alexis Métaireau
-
-
-
-
-
-
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/tag/yeah.html b/pelican/tests/output/custom/tag/yeah.html
index d71c8a37..ba6089f0 100644
--- a/pelican/tests/output/custom/tag/yeah.html
+++ b/pelican/tests/output/custom/tag/yeah.html
@@ -4,9 +4,9 @@
Alexis' log - yeah
-
-
-
+
+
+
@@ -19,32 +19,30 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
-
-
+
-
+
Wed 20 October 2010
-
+
By Alexis Métaireau
-
-
-
-
-
-
+
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/this-is-a-super-article.html b/pelican/tests/output/custom/this-is-a-super-article.html
index 8d9df71b..d1faa0ca 100644
--- a/pelican/tests/output/custom/this-is-a-super-article.html
+++ b/pelican/tests/output/custom/this-is-a-super-article.html
@@ -4,9 +4,9 @@
This is a super article !
-
-
-
+
+
+
@@ -19,32 +19,32 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
+
+
-
+
Thu 02 December 2010
-
+
By Alexis Métaireau
-
@@ -60,7 +60,7 @@
-
+
-
+
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/tests/output/custom/unbelievable.html b/pelican/tests/output/custom/unbelievable.html
index ee743526..efd049f0 100644
--- a/pelican/tests/output/custom/unbelievable.html
+++ b/pelican/tests/output/custom/unbelievable.html
@@ -4,9 +4,9 @@
Unbelievable !
-
-
-
+
+
+
@@ -19,39 +19,39 @@
- Override url/save_as
+ - This is a test page
+ - yeah
+ - misc
+ - cat1
+ - bar
+
-
+
+
-
+
Fri 15 October 2010
-
+
By Alexis Métaireau
-
-
+
-
+
-
+
- Biologeek
+ - Filyb
+ - Libert-fr
+ - N1k0
+ - Tarek Ziadé
+ - Zubin Mithra
+
-
+
- rss feed
+
+ - twitter
+ - lastfm
+ - github
+
-
+
diff --git a/pelican/themes/notmyidea/templates/index.html b/pelican/themes/notmyidea/templates/index.html
index 8752a6b6..2d45bb2a 100644
--- a/pelican/themes/notmyidea/templates/index.html
+++ b/pelican/themes/notmyidea/templates/index.html
@@ -1,14 +1,14 @@
{% extends "base.html" %}
{% block content_title %}{% endblock %}
-{% block content %}
+{% block content %}
{% if articles %}
- {% for article in articles_page.object_list %}
+ {% for article in articles_page.object_list %}
{# First item #}
{% if loop.first and not articles_page.has_previous() %}
-
{% if loop.length == 1 %}
@@ -22,17 +22,17 @@
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Oh yeah !
-Oh yeah !
+In bar.
-tags: ohbaryeah
Translations: - fr - +In bar.
+tags: ohbaryeah
Translations: + fr +Why not ?
After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! @@ -52,36 +50,36 @@ YEAH !
There are comments.
- Page 1 / 1 -
-+ Page 1 / 1 +
+ + + +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+A markdown powered article
-A markdown powered article
+In cat1.
+In cat1.
You're mutually oblivious.
a root-relative link to unbelievable a file-relative link to unbelievable
There are comments.
Other articles
- - -
+
-
+
-
+
Thu 17 February 2011
-
+
By Alexis Métaireau
-
+
Article 1
In cat1.
+In cat1.
Article 1
read more -There are comments.
There are comments.
Article 2
In cat1.
+In cat1.
Article 2
read more -There are comments.
There are comments.
Article 3
In cat1.
+In cat1.
Article 3
read more -There are comments.
There are comments.
- Page 1 / 1 -
- -+ Page 1 / 1 +
+ +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+FILENAME_METADATA example
-FILENAME_METADATA example
+In misc.
+In misc.
Some cool stuff!
There are comments.
Other articles
- - -
+
-
+
-
+
Wed 29 February 2012
-
+
By Alexis Métaireau
-
+
Second article
In misc.
-tags: foobarbaz
Translations: - fr - +In misc.
+tags: foobarbaz
Translations: + fr +This is some article, in english
read more -There are comments.
There are comments.
Unbelievable !
In misc.
+In misc.
Or completely awesome. Depends the needs.
a root-relative link to markdown-article a file-relative link to markdown-article
read more -There are comments.
There are comments.
- Page 1 / 1 -
-+ Page 1 / 1 +
+ +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+This is a super article !
-This is a super article !
+In yeah.
+In yeah.
tags: foobarfoobar
Some content here !
→ And now try with some utf8 hell: ééé
There are comments.
- Page 1 / 1 -
-+ Page 1 / 1 +
+ + + +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+A draft article
-In misc.
+In misc.
This is a draft article, it should live under the /drafts/ folder and not be listed anywhere else.
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+FILENAME_METADATA example
-In misc.
+In misc.
Some cool stuff!
Comments !
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+FILENAME_METADATA example
-FILENAME_METADATA example
+In misc.
+In misc.
Some cool stuff!
There are comments.
Other articles
- - -
+
-
+
-
+
Wed 29 February 2012
-
+
By Alexis Métaireau
-
+
Second article
In misc.
-tags: foobarbaz
Translations: - fr - +In misc.
+tags: foobarbaz
Translations: + fr +This is some article, in english
read more -There are comments.
There are comments.
A markdown powered article
In cat1.
+In cat1.
You're mutually oblivious.
a root-relative link to unbelievable a file-relative link to unbelievable
read more -There are comments.
There are comments.
Article 1
In cat1.
+In cat1.
Article 1
read more -There are comments.
There are comments.
- Page 1 / 3 - » -
-+ Page 1 / 3 + » +
+ +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+-
+
-
+
-
+
Thu 17 February 2011
-
+
By Alexis Métaireau
-
+
Article 2
In cat1.
+In cat1.
Article 2
read more -There are comments.
There are comments.
Article 3
In cat1.
+In cat1.
Article 3
read more -There are comments.
There are comments.
This is a super article !
In yeah.
+In yeah.
tags: foobarfoobar
Multi-line metadata should be supported as well as inline markup.
read more -There are comments.
There are comments.
Oh yeah !
In bar.
-tags: ohbaryeah
Translations: - fr - +In bar.
+tags: ohbaryeah
Translations: + fr +Why not ?
After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! @@ -136,39 +127,39 @@ YEAH !
There are comments.
There are comments.
- « - Page 2 / 3 - » -
-+ « + Page 2 / 3 + » +
+ +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+-
+
-
+
-
+
Fri 15 October 2010
-
+
By Alexis Métaireau
-
+
Unbelievable !
In misc.
+In misc.
Or completely awesome. Depends the needs.
a root-relative link to markdown-article a file-relative link to markdown-article
read more -There are comments.
There are comments.
- « - Page 3 / 3 -
-+ « + Page 3 / 3 +
+ +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Trop bien !
-In misc.
-Translations: - en - +In misc.
+Translations: + en +Et voila du contenu en français
Comments !
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Oh yeah !
-In bar.
-tags: ohbaryeah
Translations: - fr - +In bar.
+tags: ohbaryeah
Translations: + fr +Why not ?
After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! @@ -56,7 +56,7 @@ YEAH !
Comments !
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Override url/save_as
- -Test page which overrides save_as and url so that this page will be generated + +
Test page which overrides save_as and url so that this page will be generated at a custom location.
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+This is a test hidden page
- -This is great for things like error(404) pages + +
This is great for things like error(404) pages Anyone can see this page but it's not linked to anywhere!
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+This is a test page
- -Just an image.
+ +Just an image.
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Deuxième article
-In misc.
-tags: foobarbaz
Translations: - en - +In misc.
+tags: foobarbaz
Translations: + en +Ceci est un article, en français.
Comments !
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Second article
-In misc.
-tags: foobarbaz
Translations: - fr - +In misc.
+tags: foobarbaz
Translations: + fr +This is some article, in english
Comments !
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Second article
-Second article
+In misc.
-tags: foobarbaz
Translations: - fr - +In misc.
+tags: foobarbaz
Translations: + fr +This is some article, in english
There are comments.
Other articles
- - -
+
-
+
-
+
Thu 02 December 2010
-
+
By Alexis Métaireau
-
+
This is a super article !
In yeah.
+In yeah.
tags: foobarfoobar
Multi-line metadata should be supported as well as inline markup.
read more -There are comments.
There are comments.
Oh yeah !
In bar.
-tags: ohbaryeah
Translations: - fr - +In bar.
+tags: ohbaryeah
Translations: + fr +Why not ?
After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! @@ -108,37 +102,37 @@ YEAH !
There are comments.
There are comments.
- Page 1 / 1 -
-+ Page 1 / 1 +
+ +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Second article
-Second article
+In misc.
-tags: foobarbaz
Translations: - fr - +In misc.
+tags: foobarbaz
Translations: + fr +This is some article, in english
There are comments.
- Page 1 / 1 -
-+ Page 1 / 1 +
+ + + +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Second article
-Second article
+In misc.
-tags: foobarbaz
Translations: - fr - +In misc.
+tags: foobarbaz
Translations: + fr +This is some article, in english
There are comments.
Other articles
- - -
+
-
+
-
+
Thu 02 December 2010
-
+
By Alexis Métaireau
-
+
This is a super article !
In yeah.
+In yeah.
tags: foobarfoobar
Multi-line metadata should be supported as well as inline markup.
read more -There are comments.
There are comments.
- Page 1 / 1 -
-+ Page 1 / 1 +
+ +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+This is a super article !
-This is a super article !
+In yeah.
+In yeah.
tags: foobarfoobar
Some content here !
→ And now try with some utf8 hell: ééé
There are comments.
- Page 1 / 1 -
-+ Page 1 / 1 +
+ + + +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Oh yeah !
-Oh yeah !
+In bar.
-tags: ohbaryeah
Translations: - fr - +In bar.
+tags: ohbaryeah
Translations: + fr +Why not ?
After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! @@ -52,36 +50,36 @@ YEAH !
There are comments.
- Page 1 / 1 -
-+ Page 1 / 1 +
+ + + +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Oh yeah !
-Oh yeah !
+In bar.
-tags: ohbaryeah
Translations: - fr - +In bar.
+tags: ohbaryeah
Translations: + fr +Why not ?
After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! @@ -52,36 +50,36 @@ YEAH !
There are comments.
- Page 1 / 1 -
-+ Page 1 / 1 +
+ + + +blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+This is a super article !
-In yeah.
+In yeah.
tags: foobarfoobar
Some content here !
Comments !
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+Alexis' log
+Unbelievable !
-In misc.
+In misc.
Or completely awesome. Depends the needs.
a root-relative link to markdown-article a file-relative link to markdown-article
Comments !
blogroll
-- Biologeek
- - Filyb
- - Libert-fr
- - N1k0
- - Tarek Ziadé
- - Zubin Mithra
-
+social
- atom feed
- - rss feed
-
- - twitter
- - lastfm
- - github
-
+{{ article.title }}
+{{ article.title }}
{% include 'article_infos.html' %}{{ article.content }}{% include 'comments.html' %}{% endif %} {# other items #} - {% else %} + {% else %} {% if loop.first and articles_page.has_previous %}
{% endif %} -
+
-
+
{% include 'article_infos.html' %}
{{ article.summary }}
@@ -43,7 +43,7 @@
{% endif %}
{% if loop.last %}
- {% if loop.last and (articles_page.has_previous()
+ {% if loop.last and (articles_page.has_previous()
or not articles_page.has_previous() and loop.length > 1) %}
{% include 'pagination.html' %}
{% endif %}
@@ -51,7 +51,7 @@
{% endif %}
{% endfor %}
{% else %}
-
+
- {{ page.title }}
diff --git a/pelican/themes/notmyidea/templates/page.html b/pelican/themes/notmyidea/templates/page.html
index 60409d5c..5ac50b66 100644
--- a/pelican/themes/notmyidea/templates/page.html
+++ b/pelican/themes/notmyidea/templates/page.html
@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block title %}{{ page.title }}{% endblock %}
-{% block content %}
-
+{% block content %}
+
Date: Mon, 29 Apr 2013 20:57:05 -0700
Subject: [PATCH 093/160] sort author and category pages same way as tags
---
pelican/generators.py | 2 +
.../output/basic/author/alexis-metaireau.html | 78 ++++++------
.../custom/author/alexis-metaireau.html | 110 ++++++++---------
.../custom/author/alexis-metaireau2.html | 112 +++++++++---------
4 files changed, 157 insertions(+), 145 deletions(-)
diff --git a/pelican/generators.py b/pelican/generators.py
index 13909743..dea22e17 100644
--- a/pelican/generators.py
+++ b/pelican/generators.py
@@ -335,6 +335,7 @@ class ArticlesGenerator(Generator):
"""Generate category pages."""
category_template = self.get_template('category')
for cat, articles in self.categories:
+ articles.sort(key=attrgetter('date'), reverse=True)
dates = [article for article in self.dates if article in articles]
write(cat.save_as, category_template, self.context,
category=cat, articles=articles, dates=dates,
@@ -345,6 +346,7 @@ class ArticlesGenerator(Generator):
"""Generate Author pages."""
author_template = self.get_template('author')
for aut, articles in self.authors:
+ articles.sort(key=attrgetter('date'), reverse=True)
dates = [article for article in self.dates if article in articles]
write(aut.save_as, author_template, self.context,
author=aut, articles=articles, dates=dates,
diff --git a/pelican/tests/output/basic/author/alexis-metaireau.html b/pelican/tests/output/basic/author/alexis-metaireau.html
index 04a89930..fc253c2c 100644
--- a/pelican/tests/output/basic/author/alexis-metaireau.html
+++ b/pelican/tests/output/basic/author/alexis-metaireau.html
@@ -26,37 +26,7 @@
-
-
- Wed 20 October 2010
-
-
-
- By Alexis Métaireau
-
-
-
-
-
-
-
-
{{ article.title }}
Pages
{% for page in PAGES %}{{ page.title }}
{% import 'translations.html' as translations with context %} {{ translations.translations_for(page) }} diff --git a/pelican/themes/notmyidea/templates/translations.html b/pelican/themes/notmyidea/templates/translations.html index ca03a2c9..7894bb07 100644 --- a/pelican/themes/notmyidea/templates/translations.html +++ b/pelican/themes/notmyidea/templates/translations.html @@ -1,6 +1,6 @@ {% macro translations_for(article) %} {% if article.translations %} -Translations: +Translations: {% for translation in article.translations %} {{ translation.lang }} {% endfor %} diff --git a/setup.py b/setup.py index 83beb461..69f76b3c 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from setuptools import setup -requires = ['feedgenerator >= 1.6', 'jinja2 >= 2.6', 'pygments', 'docutils', +requires = ['feedgenerator >= 1.6', 'jinja2 >= 2.7', 'pygments', 'docutils', 'pytz', 'blinker', 'unidecode', 'six'] entry_points = { From 10dc5ef0b7d901d5718a35914ceae353ae87a903 Mon Sep 17 00:00:00 2001 From: Dane KnechtOh yeah !
-In bar.
-tags: ohbaryeah
-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 !
-Other articles
--
- -
-
-
-
-
+
Thu 02 December 2010
@@ -67,10 +37,50 @@ YEAH !
+
+
+
+
+
+
+
+
-
+
+ Fri 30 November 2012
+
+
+
+ By Alexis Métaireau
+
+
+
+
+
This is a super article !
-This is a super article !
In yeah.
tags: foobarfoobar
-Multi-line metadata should be supported -as well as inline markup.
+Some content here !
+This is a simple title
+And here comes the cool stuff.
+→ And now try with some utf8 hell: ééé
+Other articles
++
- read more +
+
+
+
+
+
+
+ Wed 20 October 2010
+
+
+
+ By Alexis Métaireau
+
+
+
+
+
+ read more
diff --git a/pelican/tests/output/custom/author/alexis-metaireau.html b/pelican/tests/output/custom/author/alexis-metaireau.html index e732fdcc..ded2e38d 100644 --- a/pelican/tests/output/custom/author/alexis-metaireau.html +++ b/pelican/tests/output/custom/author/alexis-metaireau.html @@ -30,7 +30,57 @@Oh yeah !
+In bar.
+tags: ohbaryeah
+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 !
+A markdown powered article
+FILENAME_METADATA example
+In misc.
+ +Some cool stuff!
+There are comments.
Other articles
++
+ +
+
+
+
+
+
+
+ Wed 29 February 2012
+
+
+
+ By Alexis Métaireau
+
+
+
+
+
+
+
+
+
Wed 20 April 2011
@@ -41,14 +91,12 @@
Second article
+In misc.
+tags: foobarbaz
Translations: + fr + +This is some article, in english
+ + read more +There are comments.
A markdown powered article
+In