From e0e1b3eecff7941324df065271af1f95af3855ad Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Tue, 30 Oct 2012 00:27:18 +0100 Subject: [PATCH] rename STATIC_PAGES to TEMPLATE_PAGES --- docs/settings.rst | 25 +++++++++++-------------- pelican/__init__.py | 6 +++--- pelican/generators.py | 7 ++++--- pelican/settings.py | 2 +- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 749e0431..bf9ac2ac 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -92,9 +92,8 @@ Setting name (default value) What doe will not be generated with properly-formed URLs. You should include ``http://`` and your domain, with no trailing slash at the end. Example: ``SITEURL = 'http://mydomain.com'`` -`STATIC_PAGES` (``None``) A mapping containing static pages that will - be rendered with the blog entries. See - :ref:`static_pages`. +`TEMPLATE_PAGES` (``None``) A mapping containing template pages that will be rendered with + the blog entries. See :ref:`template_pages`. `STATIC_PATHS` (``['images']``) The static paths you want to have accessible on the output path "static". By default, Pelican will copy the 'images' folder to the @@ -270,24 +269,22 @@ can get a list of available locales via the ``locale -a`` command; see manpage .. _locale(1): http://linux.die.net/man/1/locale -.. _static_pages: +.. _template_pages: -Static pages -============ +Template pages +============== -If you want to generate static pages besides your blog entries, you can point -any HTML or HTML template file with a path pointing to the file and the -URL it will match. +If you want to generate custom pages besides your blog entries, you can point +any Jinja2 template file with a path pointing to the file and the URL it will +match. -For instance, if you have a blog with four static pages, for a list of -books, your resume and a contact page, you could have:: +For instance, if you have a blog with four static pages, for a list of books, +your resume and a contact page, you could have:: - STATIC_PAGES = {'/books.html': 'static/books.html', + TEMPLATE_PAGES = {'/books.html': 'static/books.html', '/resume.html': 'static/resume.html', '/contact.html': 'static/contact.html'} - - Feed settings ============= diff --git a/pelican/__init__.py b/pelican/__init__.py index 64a61e0c..804fe5b4 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -10,7 +10,7 @@ from pelican import signals from pelican.generators import (ArticlesGenerator, PagesGenerator, StaticGenerator, PdfGenerator, LessCSSGenerator, SourceFileGenerator, - StaticPageGenerator) + TemplatePagesGenerator) from pelican.log import init from pelican.settings import read_settings from pelican.utils import (clean_output_dir, files_changed, file_changed, @@ -173,8 +173,8 @@ class Pelican(object): def get_generator_classes(self): generators = [StaticGenerator, ArticlesGenerator, PagesGenerator] - if self.settings['STATIC_PAGES']: - generators.append(StaticPageGenerator) + if self.settings['TEMPLATE_PAGES']: + generators.append(TemplatePagesGenerator) if self.settings['PDF_GENERATOR']: generators.append(PdfGenerator) if self.settings['LESS_GENERATOR']: # can be True or PATH to lessc diff --git a/pelican/generators.py b/pelican/generators.py index 81bcbc97..c7b29bab 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -126,15 +126,16 @@ class _FileLoader(BaseLoader): return source, path, lambda: mtime == getmtime(path) -class StaticPageGenerator(Generator): +class TemplatePagesGenerator(Generator): def generate_output(self, writer): - for urlpath, source in self.settings['STATIC_PAGES'].items(): + for urlpath, source in self.settings['TEMPLATE_PAGES'].items(): self.env.loader.loaders.insert(0, _FileLoader(source)) try: template = self.env.get_template(source) rurls = self.settings.get('RELATIVE_URLS') - writer.write_file(urlpath.strip('/'), template, self.context, rurls) + writer.write_file( + urlpath.strip('/'), template, self.context, rurls) finally: del self.env.loader.loaders[0] diff --git a/pelican/settings.py b/pelican/settings.py index a3f94e24..35752fee 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -80,7 +80,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'WEBASSETS': False, 'PLUGINS': [], 'MARKDOWN_EXTENSIONS': ['toc', ], - 'STATIC_PAGES': {} + 'TEMPLATE_PAGES': {} }