From 105b5c2863bfa4e578bcd92533e51595fcfd3495 Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Thu, 21 Apr 2011 17:10:00 +0200 Subject: [PATCH 001/278] Add subtitle --- pelican/readers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pelican/readers.py b/pelican/readers.py index 4e1d7b2e..6d0b6cea 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -49,9 +49,14 @@ class RstReader(Reader): rendered_content = core.publish_parts(text, writer_name='html', settings_overrides=extra_params) title = rendered_content.get('title') + subtitle = rendered_content.get('subtitle') or '' content = rendered_content.get('body') + if not metadatas.has_key('title'): metadatas['title'] = title + if not metadatas.has_key('subtitle'): + metadatas['subtitle'] = subtitle + return content, metadatas class MarkdownReader(Reader): From 98ed7338e6c360dd82f0220971851c39875d3cb3 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Thu, 21 Apr 2011 19:26:12 +0200 Subject: [PATCH 002/278] add a test metadata for #98 --- samples/content/another_super_article.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/content/another_super_article.rst b/samples/content/another_super_article.rst index abe8d26c..5ec1e2b8 100644 --- a/samples/content/another_super_article.rst +++ b/samples/content/another_super_article.rst @@ -6,6 +6,7 @@ Oh yeah ! :category: bar :author: Alexis Métaireau :slug: oh-yeah +:license: WTFPL Why not ? ========= From bb0d4bcc2f755e5ae27f41d402c158bba7496b6d Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sun, 24 Apr 2011 13:05:40 +0200 Subject: [PATCH 003/278] =?UTF-8?q?Add=20documentation=20about=20the=20REL?= =?UTF-8?q?ATIVE=5FURLS=20setting.=20Thanks=20to=20G=C3=BCnter=20Kolousek.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- THANKS | 1 + docs/settings.rst | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/THANKS b/THANKS index 078a67d1..4a8a52a5 100644 --- a/THANKS +++ b/THANKS @@ -14,3 +14,4 @@ bugs or giving ideas. Thanks to them ! - Laureline Guérin - Samuel Martin - Marcus Fredriksson +- Günter Kolousek diff --git a/docs/settings.rst b/docs/settings.rst index 67039832..e3f4a94e 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -63,11 +63,16 @@ Setting name what it does ? `PATH` path to look at for input files. `PDF_PROCESSOR` Put True if you want to have PDF versions of your documents. You will need to install `rst2pdf`. +`RELATIVE_URL` Defines if pelican should use relative urls or not. + It is set to True per default. `REVERSE_ARCHIVE_ORDER` Reverse the archives order. (True makes it in descending order: the newer first) `REVERSE_CATEGORY_ORDER` Reverse the category order. (True makes it in descending order, default is alphabetically) -`SITEURL` base URL of your website. +`SITEURL` base URL of your website. Note that this is not + a way to tell pelican to use relative urls or + static ones. You should rather use the `RELATIVE_URL` + setting for such use. `SITENAME` Your site name, `SKRIBIT_TYPE` The type of skribit widget (TAB or WIDGET). `SKRIBIT_TAB_COLOR` Tab color (#XXXXXX, default #333333). From 8de525fa281a8052a57c7f9f2fde41b48e3b5e07 Mon Sep 17 00:00:00 2001 From: Skami18 Date: Mon, 25 Apr 2011 12:13:44 +0200 Subject: [PATCH 004/278] Removed a bug (debug messages was not showed) and improved readability --- pelican/log.py | 98 ++++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 46 deletions(-) diff --git a/pelican/log.py b/pelican/log.py index b895ad66..72b7a017 100644 --- a/pelican/log.py +++ b/pelican/log.py @@ -1,46 +1,51 @@ -import logging +from logging import * import sys import os global ANSI ANSI = { - 'gray' : lambda(text) : '\033[1;30m' + unicode(text) + '\033[1;m', - 'red' : lambda(text) : '\033[1;31m' + unicode(text) + '\033[1;m', - 'green' : lambda(text) : '\033[1;32m' + unicode(text) + '\033[1;m', - 'yellow' : lambda(text) : '\033[1;33m' + unicode(text) + '\033[1;m', - 'blue' : lambda(text) : '\033[1;34m' + unicode(text) + '\033[1;m', - 'magenta' : lambda(text) : '\033[1;35m' + unicode(text) + '\033[1;m', - 'cyan' : lambda(text) : '\033[1;36m' + unicode(text) + '\033[1;m', - 'white' : lambda(text) : '\033[1;37m' + unicode(text) + '\033[1;m', - 'crimson' : lambda(text) : '\033[1;38m' + unicode(text) + '\033[1;m', - 'bgred' : lambda(text) : '\033[1;41m' + unicode(text) + '\033[1;m', - 'bggreen' : lambda(text) : '\033[1;42m' + unicode(text) + '\033[1;m', - 'bgbrown' : lambda(text) : '\033[1;43m' + unicode(text) + '\033[1;m', - 'bgblue' : lambda(text) : '\033[1;44m' + unicode(text) + '\033[1;m', - 'bgmagenta' : lambda(text) : '\033[1;45m' + unicode(text) + '\033[1;m', - 'bgcyan' : lambda(text) : '\033[1;46m' + unicode(text) + '\033[1;m', - 'bggray' : lambda(text) : '\033[1;47m' + unicode(text) + '\033[1;m', - 'bgcrimson' : lambda(text) : '\033[1;48m' + unicode(text) + '\033[1;m' + 'gray' : lambda(text) : u'\033[1;30m' + unicode(text) + u'\033[1;m', + 'red' : lambda(text) : u'\033[1;31m' + unicode(text) + u'\033[1;m', + 'green' : lambda(text) : u'\033[1;32m' + unicode(text) + u'\033[1;m', + 'yellow' : lambda(text) : u'\033[1;33m' + unicode(text) + u'\033[1;m', + 'blue' : lambda(text) : u'\033[1;34m' + unicode(text) + u'\033[1;m', + 'magenta' : lambda(text) : u'\033[1;35m' + unicode(text) + u'\033[1;m', + 'cyan' : lambda(text) : u'\033[1;36m' + unicode(text) + u'\033[1;m', + 'white' : lambda(text) : u'\033[1;37m' + unicode(text) + u'\033[1;m', + 'bgred' : lambda(text) : u'\033[1;41m' + unicode(text) + u'\033[1;m', + 'bggreen' : lambda(text) : u'\033[1;42m' + unicode(text) + u'\033[1;m', + 'bgbrown' : lambda(text) : u'\033[1;43m' + unicode(text) + u'\033[1;m', + 'bgblue' : lambda(text) : u'\033[1;44m' + unicode(text) + u'\033[1;m', + 'bgmagenta' : lambda(text) : u'\033[1;45m' + unicode(text) + u'\033[1;m', + 'bgcyan' : lambda(text) : u'\033[1;46m' + unicode(text) + u'\033[1;m', + 'bggray' : lambda(text) : u'\033[1;47m' + unicode(text) + u'\033[1;m', + 'bgyellow' : lambda(text) : u'\033[1;43m' + unicode(text) + u'\033[1;m', + 'bggrey' : lambda(text) : u'\033[1;100m' + unicode(text) + u'\033[1;m' } -class ANSIFormatter(logging.Formatter): + +class ANSIFormatter(Formatter): """ Convert a `logging.LogReport' object into colored text, using ANSI escape sequences. """ ## colors: def format(self, record): - if not record.levelname or record.levelname is 'INFO': - return ANSI['white'](record.msg) + if record.levelname is 'INFO': + return ANSI['cyan']('-> ') + unicode(record.msg) elif record.levelname is 'WARNING': - return ANSI['yellow'](record.levelname) + ': ' + record.msg + return ANSI['yellow'](record.levelname) + ': ' + unicode(record.msg) elif record.levelname is 'ERROR': - return ANSI['red'](record.levelname) + ': ' + record.msg + return ANSI['red'](record.levelname) + ': ' + unicode(record.msg) elif record.levelname is 'CRITICAL': - return ANSI['bgred'](record.levelname) + ': ' + record.msg + return ANSI['bgred'](record.levelname) + ': ' + unicode(record.msg) + elif record.levelname is 'DEBUG': + return ANSI['bggrey'](record.levelname) + ': ' + unicode(record.msg) + else: + return ANSI['white'](record.levelname) + ': ' + unicode(record.msg) -class TextFormatter(logging.Formatter): +class TextFormatter(Formatter): """ Convert a `logging.LogReport' object into text. """ @@ -52,7 +57,7 @@ class TextFormatter(logging.Formatter): return record.levelname + ': ' + record.msg -class Formatter(object): +class DummyFormatter(object): """ A dummy class. Return an instance of the appropriate formatter (ANSIFormatter if sys.stdout.isatty() is True, else TextFormatter) @@ -66,21 +71,10 @@ class Formatter(object): -# shortcuts -debug, info, warn, error, critical = (logging.debug, - logging.info, - logging.warn, - logging.error, - logging.critical) -DEBUG, INFO, WARN, ERROR, CRITICAL = (logging.DEBUG, - logging.INFO, - logging.WARN, - logging.ERROR, - logging.CRITICAL) -def init(level=None, logger=logging.getLogger(), handler=logging.StreamHandler()): - fmt = Formatter() +def init(level=None, logger=getLogger(), handler=StreamHandler()): + fmt = DummyFormatter() handler.setFormatter(fmt) logger.addHandler(handler) if level: @@ -88,11 +82,23 @@ def init(level=None, logger=logging.getLogger(), handler=logging.StreamHandler() if __name__ == '__main__': - init() - logging.basicConfig(filename='example.log',level=logging.DEBUG) - logging.debug('Logging test') - logging.info('info') - logging.warning('warning') - logging.error('error') - logging.critical('critical') + init(level=DEBUG) + debug('debug') + info('info') + warning('warning') + error('error') + critical('critical') + +__all__ = [ + "debug", + "info", + "warn", + "error", + "critical", + "DEBUG", + "INFO", + "WARN", + "ERROR", + "CRITICAL" +] From 764a135bb3a37d6be0fc08c3ddc67aaa7409314b Mon Sep 17 00:00:00 2001 From: Simon Liedtke Date: Sun, 24 Apr 2011 09:05:38 -0700 Subject: [PATCH 005/278] Pelican is an "it", not a "he" --- 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 d90e1fe8..fc2e171e 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -38,7 +38,7 @@ Writing articles using pelican Files metadata -------------- -Pelican tries to be smart enough to get the informations he needs from the +Pelican tries to be smart enough to get the informations it needs from the file system (for instance, about the category of your articles), but you need to provide by hand some of those informations in your files. From b6b7238519f6049c932d5c1e542bdc5483fb7327 Mon Sep 17 00:00:00 2001 From: Simon Liedtke Date: Sun, 24 Apr 2011 09:24:05 -0700 Subject: [PATCH 006/278] removed unused import --- pelican/__init__.py | 1 - 1 file changed, 1 deletion(-) mode change 100755 => 100644 pelican/__init__.py diff --git a/pelican/__init__.py b/pelican/__init__.py old mode 100755 new mode 100644 index 497e5d0d..195ada34 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -1,6 +1,5 @@ import argparse import os -from functools import partial from pelican.generators import (ArticlesGenerator, PagesGenerator, StaticGenerator, PdfGenerator) From ec9525a3e82a9c279b476c5bc6aeb0a0883f1804 Mon Sep 17 00:00:00 2001 From: derdon Date: Mon, 25 Apr 2011 00:33:55 +0200 Subject: [PATCH 007/278] include the default values of the settings in the 1st column in parens this way, it is much easier for the reader to see which variable has which default value. I also added some default values which could not be found in the documentation before. --- docs/settings.rst | 157 +++++++++++++++++++++++----------------------- 1 file changed, 79 insertions(+), 78 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index e3f4a94e..498f60cd 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -20,84 +20,85 @@ Here are the available settings. Please note that all the settings you put in this file will be passed to the templates as well. -======================== ======================================================= -Setting name what it does ? -======================== ======================================================= -`AUTHOR` Default author (put your name) -`CATEGORY_FEED` Where to put the atom categories feeds. default is - `feeds/%s.atom.xml`, where %s is the name of the - category. -`CATEGORY_FEED_RSS` Where to put the categories rss feeds. default is None - (no rss) -`CSS_FILE` To specify the CSS file you want to load, if it's not - the default one ('main.css') -`DATE_FORMATS` If you do manage multiple languages, you can set - the date formatting here. -`DEFAULT_CATEGORY` The default category to fallback on. `misc` by default. -`DEFAULT_DATE_FORMAT` The default date format you want to use. -`DEFAULT_LANG` The default language to use. Default is 'en'. -`DEFAULT_ORPHANS` The minimum number of articles allowed on the last - page, defaults to zero. Use this when you don't want - to have a last page with very few articles. -`DEFAULT_PAGINATION` The maximum number of articles to include on a page, - not including orphans. Default is 5. -`DISPLAY_PAGES_ON_MENU` Display or not the pages on the menu of the template. - Templates can follow or not this settings. -`FALLBACK_ON_FS_DATE` If True, pelican will use the file system dates infos - (mtime) if it can't get informations from the - metadata? -`FEED` relative url to output the atom feed. Default is - `feeds/all.atom.xml` -`FEED_RSS` relative url to output the rss feed. Default is - None (no rss) -`JINJA_EXTENSIONS` A list of any Jinja2 extensions you want to use. - Default is no extensions (the empty list). -`KEEP_OUTPUT_DIRECTORY` Keep the output directory and just update all the - generated files. -`LOCALE` Change the locale. Default is the system locale. - Default is to delete the output directory. -`MARKUP` A list of available markup languages you want to use. - For the moment, only available values are `rst` and `md`. -`OUTPUT_PATH` Where to output the generated files. Default to - "output" -`PATH` path to look at for input files. -`PDF_PROCESSOR` Put True if you want to have PDF versions of your - documents. You will need to install `rst2pdf`. -`RELATIVE_URL` Defines if pelican should use relative urls or not. - It is set to True per default. -`REVERSE_ARCHIVE_ORDER` Reverse the archives order. (True makes it in - descending order: the newer first) -`REVERSE_CATEGORY_ORDER` Reverse the category order. (True makes it in - descending order, default is alphabetically) -`SITEURL` base URL of your website. Note that this is not - a way to tell pelican to use relative urls or - static ones. You should rather use the `RELATIVE_URL` - setting for such use. -`SITENAME` Your site name, -`SKRIBIT_TYPE` The type of skribit widget (TAB or WIDGET). -`SKRIBIT_TAB_COLOR` Tab color (#XXXXXX, default #333333). -`SKRIBIT_TAB_HORIZ` Tab Distance from Left (% or distance, default Null). -`SKRIBIT_TAB_VERT` Tab Distance from Top (% or distance, default 20%). -`SKRIBIT_TAB_PLACEMENT` Tab placement (Top, Bottom, Left or Right, default - LEFT). -`SKRIBIT_TAB_SITENAME` Tab identifier (See Skribit part below). -`SKRIBIT_WIDGET_ID` Widget identifier (See Skribit part below). -`STATIC_PATHS` The static paths you want to have accessible on the - output path "static". By default, pelican will copy - the 'images' folder to the output folder. -`STATIC_THEME_PATHS` Static theme paths you want to copy. Default values - is `static`, but if your theme have others static paths, - you can put them here. -`TAG_CLOUD_STEPS` Count of different font sizes in the tag cloud. -`TAG_CLOUD_MAX_ITEMS` Maximum tags count in the cloud. -`THEME` theme to use to product the output. can be the - complete static path to a theme folder, or chosen - between the list of default themes (see below) -`TRANSLATION_FEED` Where to put the RSS feed for translations. Default - is feeds/all-%s.atom.xml where %s is the name of the - lang. -`WITH_PAGINATION` Activate pagination. Default is False. -======================== ======================================================= +================================================ ===================================================== +Setting name (default value) what does it do? +================================================ ===================================================== +`AUTHOR` Default author (put your name) +`CATEGORY_FEED` ('feeds/%s.atom.xml'[1]_) Where to put the atom categories feeds. +`CATEGORY_FEED_RSS` (``None``, i.e. no RSS) Where to put the categories rss feeds. +`CSS_FILE` (``'main.css'``) specify the CSS file you want to load +`DATE_FORMATS` (``{}``) If you do manage multiple languages, you can + set the date formatting here. +`DEFAULT_CATEGORY` (``'misc'``) The default category to fallback on. +`DEFAULT_DATE_FORMAT` (``'%a %d %B %Y'``) The default date format you want to use. +`DEFAULT_LANG` (``'en'``) The default language to use. +`DEFAULT_ORPHANS` (0) The minimum number of articles allowed on the + last page. Use this when you don't want to + have a last page with very few articles. +`DEFAULT_PAGINATION` (5) The maximum number of articles to include on a + page, not including orphans. +`DISPLAY_PAGES_ON_MENU` (``True``) Display or not the pages on the menu of the + template. Templates can follow or not this + settings. +`FALLBACK_ON_FS_DATE` (``True``) If True, pelican will use the file system + dates infos (mtime) if it can't get + informations from the metadata? +`FEED` (``'feeds/all.atom.xml'``) relative url to output the atom feed. +`FEED_RSS` (``None``, i.e. no RSS) relative url to output the rss feed. +`JINJA_EXTENSIONS` (``[]``) A list of any Jinja2 extensions you want to use. +`KEEP_OUTPUT_DIRECTORY` (``False``) Keep the output directory and just update all + the generated files. +`LOCALE` (''[2]_) Change the locale. +`MARKUP` (``('rst', 'md')``) A list of available markup languages you want + to use. For the moment, only available values + are `rst` and `md`. +`OUTPUT_PATH` (``'output/'``) Where to output the generated files. +`PATH` (``None``) path to look at for input files. +`PDF_PROCESSOR` (``False``) Set to True if you want to have PDF versions + of your documents. You will need to install + `rst2pdf`. +`RELATIVE_URL` (``True``) Defines if pelican should use relative urls or + not. +`REVERSE_ARCHIVE_ORDER` (``False``) Reverse the archives order. (True makes it in + descending order: the newer first) +`REVERSE_CATEGORY_ORDER` (``False``) Reverse the category order. (True makes it in + descending order, default is alphabetically) +`SITEURL` base URL of your website. Note that this is + not a way to tell pelican to use relative urls + or static ones. You should rather use the + `RELATIVE_URL` setting for such use. +`SITENAME` (``'A Pelican Blog'``) Your site name, +`SKRIBIT_TYPE` The type of skribit widget (TAB or WIDGET). +`SKRIBIT_TAB_COLOR` Tab color (#XXXXXX, default #333333). +`SKRIBIT_TAB_HORIZ` Tab Distance from Left (% or distance, default Null). +`SKRIBIT_TAB_VERT` Tab Distance from Top (% or distance, default 20%). +`SKRIBIT_TAB_PLACEMENT` Tab placement (Top, Bottom, Left or Right, + default LEFT). +`SKRIBIT_TAB_SITENAME` Tab identifier (See Skribit part below). +`SKRIBIT_WIDGET_ID` Widget identifier (See Skribit part below). +`STATIC_PATHS` The static paths you want to have accessible +(``['images']``) on the output path "static". By default, + pelican will copy the 'images' folder to the + output folder. +`STATIC_THEME_PATHS` (``['static']``) Static theme paths you want to copy. Default + values is `static`, but if your theme have + others static paths, you can put them here. +`TAG_CLOUD_STEPS` (4) Count of different font sizes in the tag + cloud. +`TAG_CLOUD_MAX_ITEMS` (100) Maximum tags count in the cloud. +`THEME` theme to use to product the output. can be the + complete static path to a theme folder, or + chosen between the list of default themes (see + below) +`TRANSLATION_FEED` ('feeds/all-%s.atom.xml'[3]_) Where to put the RSS feed for translations. +`WITH_PAGINATION` (``False``) Activate pagination. +================================================ ===================================================== + +.. [1] %s is the name of the category. + +.. [2] Default is the system locale. Default is to delete the output directory. + +.. [3] %s is the language Skribit ======= From c8d20a70648debb1148a0e9bdd616652929a5a57 Mon Sep 17 00:00:00 2001 From: derdon Date: Mon, 25 Apr 2011 00:36:15 +0200 Subject: [PATCH 008/278] fixed the writings of two variable names in the settings table --- docs/settings.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 498f60cd..66152a3e 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -54,7 +54,7 @@ Setting name (default value) what does it do? are `rst` and `md`. `OUTPUT_PATH` (``'output/'``) Where to output the generated files. `PATH` (``None``) path to look at for input files. -`PDF_PROCESSOR` (``False``) Set to True if you want to have PDF versions +`PDF_GENERATOR` (``False``) Set to True if you want to have PDF versions of your documents. You will need to install `rst2pdf`. `RELATIVE_URL` (``True``) Defines if pelican should use relative urls or @@ -80,7 +80,7 @@ Setting name (default value) what does it do? (``['images']``) on the output path "static". By default, pelican will copy the 'images' folder to the output folder. -`STATIC_THEME_PATHS` (``['static']``) Static theme paths you want to copy. Default +`THEME_STATIC_PATHS` (``['static']``) Static theme paths you want to copy. Default values is `static`, but if your theme have others static paths, you can put them here. `TAG_CLOUD_STEPS` (4) Count of different font sizes in the tag From 1ef913cb6434240640b2308cc1a2e220b056ce70 Mon Sep 17 00:00:00 2001 From: derdon Date: Mon, 25 Apr 2011 00:38:15 +0200 Subject: [PATCH 009/278] various grammar fixes --- docs/settings.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 66152a3e..064bc64e 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -81,12 +81,12 @@ Setting name (default value) what does it do? pelican will copy the 'images' folder to the output folder. `THEME_STATIC_PATHS` (``['static']``) Static theme paths you want to copy. Default - values is `static`, but if your theme have - others static paths, you can put them here. + values is `static`, but if your theme has + other static paths, you can put them here. `TAG_CLOUD_STEPS` (4) Count of different font sizes in the tag cloud. `TAG_CLOUD_MAX_ITEMS` (100) Maximum tags count in the cloud. -`THEME` theme to use to product the output. can be the +`THEME` theme to use to produce the output. can be the complete static path to a theme folder, or chosen between the list of default themes (see below) From 6b62ed867379b6b6c4a513aaacaccc27113547a8 Mon Sep 17 00:00:00 2001 From: derdon Date: Mon, 25 Apr 2011 00:39:21 +0200 Subject: [PATCH 010/278] removed a useless comma --- docs/settings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index 064bc64e..a40ebbb9 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -67,7 +67,7 @@ Setting name (default value) what does it do? not a way to tell pelican to use relative urls or static ones. You should rather use the `RELATIVE_URL` setting for such use. -`SITENAME` (``'A Pelican Blog'``) Your site name, +`SITENAME` (``'A Pelican Blog'``) Your site name `SKRIBIT_TYPE` The type of skribit widget (TAB or WIDGET). `SKRIBIT_TAB_COLOR` Tab color (#XXXXXX, default #333333). `SKRIBIT_TAB_HORIZ` Tab Distance from Left (% or distance, default Null). From 60807d1958eca0d46d77870e0353d0b3215436e1 Mon Sep 17 00:00:00 2001 From: derdon Date: Mon, 25 Apr 2011 00:40:42 +0200 Subject: [PATCH 011/278] removed a confusing question mark --- docs/settings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index a40ebbb9..795f220c 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -42,7 +42,7 @@ Setting name (default value) what does it do? settings. `FALLBACK_ON_FS_DATE` (``True``) If True, pelican will use the file system dates infos (mtime) if it can't get - informations from the metadata? + informations from the metadata `FEED` (``'feeds/all.atom.xml'``) relative url to output the atom feed. `FEED_RSS` (``None``, i.e. no RSS) relative url to output the rss feed. `JINJA_EXTENSIONS` (``[]``) A list of any Jinja2 extensions you want to use. From 51f760edc2ab4a2ab18c1e5916eb30a7270849f1 Mon Sep 17 00:00:00 2001 From: derdon Date: Tue, 26 Apr 2011 00:39:31 +0200 Subject: [PATCH 012/278] move a default value to the table cell it belongs to --- docs/settings.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 795f220c..d4340006 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -76,8 +76,8 @@ Setting name (default value) what does it do? default LEFT). `SKRIBIT_TAB_SITENAME` Tab identifier (See Skribit part below). `SKRIBIT_WIDGET_ID` Widget identifier (See Skribit part below). -`STATIC_PATHS` The static paths you want to have accessible -(``['images']``) on the output path "static". By default, +`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 output folder. `THEME_STATIC_PATHS` (``['static']``) Static theme paths you want to copy. Default From bb24c05b903d338b4f5ca9b79dcd0295bcb5c39f Mon Sep 17 00:00:00 2001 From: derdon Date: Tue, 26 Apr 2011 02:37:56 +0200 Subject: [PATCH 013/278] added missing whitespace in the CLI help --- pelican/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 195ada34..08ddc716 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -91,8 +91,8 @@ def main(): parser.add_argument(dest='path', nargs='?', help='Path where to find the content files') parser.add_argument('-t', '--theme-path', dest='theme', - help='Path where to find the theme templates. If not specified, it will' - 'use the default one included with pelican.') + help='Path where to find the theme templates. If not specified, it' + 'will use the default one included with pelican.') parser.add_argument('-o', '--output', dest='output', help='Where to output the generated files. If not specified, a directory' ' will be created, named "output" in the current path.') From f9819e0c712ad7cb2e06c1b5158d46314b9a70ee Mon Sep 17 00:00:00 2001 From: derdon Date: Tue, 26 Apr 2011 02:39:57 +0200 Subject: [PATCH 014/278] another whitespace mistake in the CLI help --- pelican/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 08ddc716..12d12210 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -97,8 +97,8 @@ def main(): help='Where to output the generated files. If not specified, a directory' ' will be created, named "output" in the current path.') parser.add_argument('-m', '--markup', default=None, dest='markup', - help='the list of markup language to use (rst or md). Please indicate them' - 'separated by commas') + help='the list of markup language to use (rst or md). Please indicate ' + 'them separated by commas') parser.add_argument('-s', '--settings', dest='settings', help='the settings of the application. Default to None.') parser.add_argument('-k', '--keep-output-directory', dest='keep', From deb5b8a98f56bf73ced4a1e14227767aa008cd29 Mon Sep 17 00:00:00 2001 From: derdon Date: Tue, 26 Apr 2011 02:49:00 +0200 Subject: [PATCH 015/278] typos, grammar mistakes, minor whitespace issues --- docs/themes.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/themes.rst b/docs/themes.rst index 9f8b8765..301e090e 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -32,17 +32,17 @@ To make your own theme, you must follow the following structure:: just examples. Put what you need here. * `templates` contains all the templates that will be used to generate the content. - I've just put the mandatory templates here, you can define your own if it helps + I've just put the mandatory templates here, you can define your own if it helps you to organize yourself while doing the theme. Templates and variables ======================= It's using a simple syntax, that you can embbed into your html pages. -This document describes which templates should exists on a theme, and which +This document describes which templates should exist on a theme, and which variables will be passed to each template, while generating it. -All templates will receive the variables defined in your settings file, if they +All templates will receive the variables defined in your settings file, if they are in caps. You can access them directly. Common variables @@ -114,7 +114,7 @@ page_name 'category/`category_name`'. Useful for pagination article.html ------------- -This template will be processed for each article. .html files will be outputed +This template will be processed for each article. .html files will be output in output/`article_name`.html. Here are the specific variables it gets. ============= =================================================== @@ -152,8 +152,8 @@ page_name 'tag/`tag_name`'. Useful for pagination links. Include skribit script ====================== -In order to support skribit scripts in your themes, you must following these -actions : +In order to support skribit scripts in your themes, you must perform these +actions: * Copy `skribit_tab_script.html` and `skribit_widget_script.html` in your templates directory. From d2bb85ab6ce534b92457f08ad0333c2a4e90358b Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Mon, 25 Apr 2011 23:29:45 +0100 Subject: [PATCH 016/278] Thanks Simon Liedtke --- THANKS | 1 + 1 file changed, 1 insertion(+) diff --git a/THANKS b/THANKS index 4a8a52a5..39f54e61 100644 --- a/THANKS +++ b/THANKS @@ -15,3 +15,4 @@ bugs or giving ideas. Thanks to them ! - Samuel Martin - Marcus Fredriksson - Günter Kolousek +- Simon Liedtke From 15de7d45c9c0402f3669169ab0605b999d89726e Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Mon, 25 Apr 2011 23:33:13 +0100 Subject: [PATCH 017/278] Little doc fix --- docs/settings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index d4340006..363ffc87 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -167,7 +167,7 @@ The `notmyidea` theme can make good use of the following settings. I recommend to use them too in your themes. ======================= ======================================================= -Setting name what it does ? +Setting name what does it do ? ======================= ======================================================= `DISQUS_SITENAME` Pelican can handle disqus comments, specify the sitename you've filled in on disqus From ca2030f62c652b8c62ef8c45800634379ab6717a Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Tue, 26 Apr 2011 00:34:03 +0100 Subject: [PATCH 018/278] theme switch --- docs/_themes/LICENSE | 37 -- docs/_themes/README | 31 -- docs/_themes/flask/layout.html | 16 - docs/_themes/flask/relations.html | 19 - docs/_themes/flask/static/flasky.css_t | 387 ------------------ docs/_themes/flask/static/small_flask.css | 70 ---- docs/_themes/flask/theme.conf | 7 - docs/_themes/flask_small/static/flasky.css_t | 287 ------------- docs/_themes/flask_theme_support.py | 86 ---- .../{flask_small => pelican}/layout.html | 0 docs/_themes/pelican/static/pelican.css_t | 247 +++++++++++ .../{flask_small => pelican}/theme.conf | 4 +- docs/conf.py | 4 +- 13 files changed, 251 insertions(+), 944 deletions(-) delete mode 100644 docs/_themes/LICENSE delete mode 100644 docs/_themes/README delete mode 100644 docs/_themes/flask/layout.html delete mode 100644 docs/_themes/flask/relations.html delete mode 100644 docs/_themes/flask/static/flasky.css_t delete mode 100644 docs/_themes/flask/static/small_flask.css delete mode 100644 docs/_themes/flask/theme.conf delete mode 100644 docs/_themes/flask_small/static/flasky.css_t delete mode 100644 docs/_themes/flask_theme_support.py rename docs/_themes/{flask_small => pelican}/layout.html (100%) create mode 100644 docs/_themes/pelican/static/pelican.css_t rename docs/_themes/{flask_small => pelican}/theme.conf (58%) diff --git a/docs/_themes/LICENSE b/docs/_themes/LICENSE deleted file mode 100644 index 8daab7ee..00000000 --- a/docs/_themes/LICENSE +++ /dev/null @@ -1,37 +0,0 @@ -Copyright (c) 2010 by Armin Ronacher. - -Some rights reserved. - -Redistribution and use in source and binary forms of the theme, with or -without modification, are permitted provided that the following conditions -are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - -* The names of the contributors may not be used to endorse or - promote products derived from this software without specific - prior written permission. - -We kindly ask you to only use these themes in an unmodified manner just -for Flask and Flask-related products, not for unrelated projects. If you -like the visual style and want to use it for your own projects, please -consider making some larger changes to the themes (such as changing -font faces, sizes, colors or margins). - -THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/docs/_themes/README b/docs/_themes/README deleted file mode 100644 index b3292bdf..00000000 --- a/docs/_themes/README +++ /dev/null @@ -1,31 +0,0 @@ -Flask Sphinx Styles -=================== - -This repository contains sphinx styles for Flask and Flask related -projects. To use this style in your Sphinx documentation, follow -this guide: - -1. put this folder as _themes into your docs folder. Alternatively - you can also use git submodules to check out the contents there. -2. add this to your conf.py: - - sys.path.append(os.path.abspath('_themes')) - html_theme_path = ['_themes'] - html_theme = 'flask' - -The following themes exist: - -- 'flask' - the standard flask documentation theme for large - projects -- 'flask_small' - small one-page theme. Intended to be used by - very small addon libraries for flask. - -The following options exist for the flask_small theme: - - [options] - index_logo = '' filename of a picture in _static - to be used as replacement for the - h1 in the index.rst file. - index_logo_height = 120px height of the index logo - github_fork = '' repository name on github for the - "fork me" badge diff --git a/docs/_themes/flask/layout.html b/docs/_themes/flask/layout.html deleted file mode 100644 index d7c87927..00000000 --- a/docs/_themes/flask/layout.html +++ /dev/null @@ -1,16 +0,0 @@ -{%- extends "basic/layout.html" %} -{%- block extrahead %} - {{ super() }} - {% if theme_touch_icon %} - - {% endif %} - -{% endblock %} -{%- block relbar2 %}{% endblock %} -{%- block footer %} - -{%- endblock %} diff --git a/docs/_themes/flask/relations.html b/docs/_themes/flask/relations.html deleted file mode 100644 index 3bbcde85..00000000 --- a/docs/_themes/flask/relations.html +++ /dev/null @@ -1,19 +0,0 @@ -

Related Topics

- diff --git a/docs/_themes/flask/static/flasky.css_t b/docs/_themes/flask/static/flasky.css_t deleted file mode 100644 index 0de60eee..00000000 --- a/docs/_themes/flask/static/flasky.css_t +++ /dev/null @@ -1,387 +0,0 @@ -/* - * flasky.css_t - * ~~~~~~~~~~~~ - * - * :copyright: Copyright 2010 by Armin Ronacher. - * :license: Flask Design License, see LICENSE for details. - */ - -{% set page_width = '940px' %} -{% set sidebar_width = '220px' %} - -@import url("basic.css"); - -/* -- page layout ----------------------------------------------------------- */ - -body { - font-family: 'Georgia', serif; - font-size: 17px; - background-color: white; - color: #000; - margin: 0; - padding: 0; -} - -div.document { - width: {{ page_width }}; - margin: 30px auto 0 auto; -} - -div.documentwrapper { - float: left; - width: 100%; -} - -div.bodywrapper { - margin: 0 0 0 {{ sidebar_width }}; -} - -div.sphinxsidebar { - width: {{ sidebar_width }}; -} - -hr { - border: 1px solid #B1B4B6; -} - -div.body { - background-color: #ffffff; - color: #3E4349; - padding: 0 30px 0 30px; -} - -img.floatingflask { - padding: 0 0 10px 10px; - float: right; -} - -div.footer { - width: {{ page_width }}; - margin: 20px auto 30px auto; - font-size: 14px; - color: #888; - text-align: right; -} - -div.footer a { - color: #888; -} - -div.related { - display: none; -} - -div.sphinxsidebar a { - color: #444; - text-decoration: none; - border-bottom: 1px dotted #999; -} - -div.sphinxsidebar a:hover { - border-bottom: 1px solid #999; -} - -div.sphinxsidebar { - font-size: 14px; - line-height: 1.5; -} - -div.sphinxsidebarwrapper { - padding: 18px 10px; -} - -div.sphinxsidebarwrapper p.logo { - padding: 0 0 20px 0; - margin: 0; - text-align: center; -} - -div.sphinxsidebar h3, -div.sphinxsidebar h4 { - font-family: 'Garamond', 'Georgia', serif; - color: #444; - font-size: 24px; - font-weight: normal; - margin: 0 0 5px 0; - padding: 0; -} - -div.sphinxsidebar h4 { - font-size: 20px; -} - -div.sphinxsidebar h3 a { - color: #444; -} - -div.sphinxsidebar p.logo a, -div.sphinxsidebar h3 a, -div.sphinxsidebar p.logo a:hover, -div.sphinxsidebar h3 a:hover { - border: none; -} - -div.sphinxsidebar p { - color: #555; - margin: 10px 0; -} - -div.sphinxsidebar ul { - margin: 10px 0; - padding: 0; - color: #000; -} - -div.sphinxsidebar input { - border: 1px solid #ccc; - font-family: 'Georgia', serif; - font-size: 1em; -} - -/* -- body styles ----------------------------------------------------------- */ - -a { - color: #004B6B; - text-decoration: underline; -} - -a:hover { - color: #6D4100; - text-decoration: underline; -} - -div.body h1, -div.body h2, -div.body h3, -div.body h4, -div.body h5, -div.body h6 { - font-family: 'Garamond', 'Georgia', serif; - font-weight: normal; - margin: 30px 0px 10px 0px; - padding: 0; -} - -div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } -div.body h2 { font-size: 180%; } -div.body h3 { font-size: 150%; } -div.body h4 { font-size: 130%; } -div.body h5 { font-size: 100%; } -div.body h6 { font-size: 100%; } - -a.headerlink { - color: #ddd; - padding: 0 4px; - text-decoration: none; -} - -a.headerlink:hover { - color: #444; - background: #eaeaea; -} - -div.body p, div.body dd, div.body li { - line-height: 1.4em; -} - -div.admonition { - background: #fafafa; - margin: 20px -30px; - padding: 10px 30px; - border-top: 1px solid #ccc; - border-bottom: 1px solid #ccc; -} - -div.admonition tt.xref, div.admonition a tt { - border-bottom: 1px solid #fafafa; -} - -dd div.admonition { - margin-left: -60px; - padding-left: 60px; -} - -div.admonition p.admonition-title { - font-family: 'Garamond', 'Georgia', serif; - font-weight: normal; - font-size: 24px; - margin: 0 0 10px 0; - padding: 0; - line-height: 1; -} - -div.admonition p.last { - margin-bottom: 0; -} - -div.highlight { - background-color: white; -} - -dt:target, .highlight { - background: #FAF3E8; -} - -div.note { - background-color: #eee; - border: 1px solid #ccc; -} - -div.seealso { - background-color: #ffc; - border: 1px solid #ff6; -} - -div.topic { - background-color: #eee; -} - -p.admonition-title { - display: inline; -} - -p.admonition-title:after { - content: ":"; -} - -pre, tt { - font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; - font-size: 0.9em; -} - -img.screenshot { -} - -tt.descname, tt.descclassname { - font-size: 0.95em; -} - -tt.descname { - padding-right: 0.08em; -} - -img.screenshot { - -moz-box-shadow: 2px 2px 4px #eee; - -webkit-box-shadow: 2px 2px 4px #eee; - box-shadow: 2px 2px 4px #eee; -} - -table.docutils { - border: 1px solid #888; - -moz-box-shadow: 2px 2px 4px #eee; - -webkit-box-shadow: 2px 2px 4px #eee; - box-shadow: 2px 2px 4px #eee; -} - -table.docutils td, table.docutils th { - border: 1px solid #888; - padding: 0.25em 0.7em; -} - -table.field-list, table.footnote { - border: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - box-shadow: none; -} - -table.footnote { - margin: 15px 0; - width: 100%; - border: 1px solid #eee; - background: #fdfdfd; - font-size: 0.9em; -} - -table.footnote + table.footnote { - margin-top: -15px; - border-top: none; -} - -table.field-list th { - padding: 0 0.8em 0 0; -} - -table.field-list td { - padding: 0; -} - -table.footnote td.label { - width: 0px; - padding: 0.3em 0 0.3em 0.5em; -} - -table.footnote td { - padding: 0.3em 0.5em; -} - -dl { - margin: 0; - padding: 0; -} - -dl dd { - margin-left: 30px; -} - -blockquote { - margin: 0 0 0 30px; - padding: 0; -} - -ul, ol { - margin: 10px 0 10px 30px; - padding: 0; -} - -pre { - background: #eee; - padding: 7px 30px; - margin: 15px -30px; - line-height: 1.3em; -} - -dl pre, blockquote pre, li pre { - margin-left: -60px; - padding-left: 60px; -} - -dl dl pre { - margin-left: -90px; - padding-left: 90px; -} - -tt { - background-color: #ecf0f3; - color: #222; - /* padding: 1px 2px; */ -} - -tt.xref, a tt { - background-color: #FBFBFB; - border-bottom: 1px solid white; -} - -a.reference { - text-decoration: none; - border-bottom: 1px dotted #004B6B; -} - -a.reference:hover { - border-bottom: 1px solid #6D4100; -} - -a.footnote-reference { - text-decoration: none; - font-size: 0.7em; - vertical-align: top; - border-bottom: 1px dotted #004B6B; -} - -a.footnote-reference:hover { - border-bottom: 1px solid #6D4100; -} - -a:hover tt { - background: #EEE; -} diff --git a/docs/_themes/flask/static/small_flask.css b/docs/_themes/flask/static/small_flask.css deleted file mode 100644 index 1c6df309..00000000 --- a/docs/_themes/flask/static/small_flask.css +++ /dev/null @@ -1,70 +0,0 @@ -/* - * small_flask.css_t - * ~~~~~~~~~~~~~~~~~ - * - * :copyright: Copyright 2010 by Armin Ronacher. - * :license: Flask Design License, see LICENSE for details. - */ - -body { - margin: 0; - padding: 20px 30px; -} - -div.documentwrapper { - float: none; - background: white; -} - -div.sphinxsidebar { - display: block; - float: none; - width: 102.5%; - margin: 50px -30px -20px -30px; - padding: 10px 20px; - background: #333; - color: white; -} - -div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, -div.sphinxsidebar h3 a { - color: white; -} - -div.sphinxsidebar a { - color: #aaa; -} - -div.sphinxsidebar p.logo { - display: none; -} - -div.document { - width: 100%; - margin: 0; -} - -div.related { - display: block; - margin: 0; - padding: 10px 0 20px 0; -} - -div.related ul, -div.related ul li { - margin: 0; - padding: 0; -} - -div.footer { - display: none; -} - -div.bodywrapper { - margin: 0; -} - -div.body { - min-height: 0; - padding: 0; -} diff --git a/docs/_themes/flask/theme.conf b/docs/_themes/flask/theme.conf deleted file mode 100644 index 307a1f0d..00000000 --- a/docs/_themes/flask/theme.conf +++ /dev/null @@ -1,7 +0,0 @@ -[theme] -inherit = basic -stylesheet = flasky.css -pygments_style = flask_theme_support.FlaskyStyle - -[options] -touch_icon = diff --git a/docs/_themes/flask_small/static/flasky.css_t b/docs/_themes/flask_small/static/flasky.css_t deleted file mode 100644 index fe2141c5..00000000 --- a/docs/_themes/flask_small/static/flasky.css_t +++ /dev/null @@ -1,287 +0,0 @@ -/* - * flasky.css_t - * ~~~~~~~~~~~~ - * - * Sphinx stylesheet -- flasky theme based on nature theme. - * - * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * - */ - -@import url("basic.css"); - -/* -- page layout ----------------------------------------------------------- */ - -body { - font-family: 'Georgia', serif; - font-size: 17px; - color: #000; - background: white; - margin: 0; - padding: 0; -} - -div.documentwrapper { - float: left; - width: 100%; -} - -div.bodywrapper { - margin: 40px auto 0 auto; - width: 700px; -} - -hr { - border: 1px solid #B1B4B6; -} - -div.body { - background-color: #ffffff; - color: #3E4349; - padding: 0 30px 30px 30px; -} - -img.floatingflask { - padding: 0 0 10px 10px; - float: right; -} - -div.footer { - text-align: right; - color: #888; - padding: 10px; - font-size: 14px; - width: 650px; - margin: 0 auto 40px auto; -} - -div.footer a { - color: #888; - text-decoration: underline; -} - -div.related { - line-height: 32px; - color: #888; -} - -div.related ul { - padding: 0 0 0 10px; -} - -div.related a { - color: #444; -} - -/* -- body styles ----------------------------------------------------------- */ - -a { - color: #004B6B; - text-decoration: underline; -} - -a:hover { - color: #6D4100; - text-decoration: underline; -} - -div.body { - padding-bottom: 40px; /* saved for footer */ -} - -div.body h1, -div.body h2, -div.body h3, -div.body h4, -div.body h5, -div.body h6 { - font-family: 'Garamond', 'Georgia', serif; - font-weight: normal; - margin: 30px 0px 10px 0px; - padding: 0; -} - -{% if theme_index_logo %} -div.indexwrapper h1 { - text-indent: -999999px; - background: url({{ theme_index_logo }}) no-repeat center center; - height: {{ theme_index_logo_height }}; -} -{% endif %} - -div.body h2 { font-size: 180%; } -div.body h3 { font-size: 150%; } -div.body h4 { font-size: 130%; } -div.body h5 { font-size: 100%; } -div.body h6 { font-size: 100%; } - -a.headerlink { - color: white; - padding: 0 4px; - text-decoration: none; -} - -a.headerlink:hover { - color: #444; - background: #eaeaea; -} - -div.body p, div.body dd, div.body li { - line-height: 1.4em; -} - -div.admonition { - background: #fafafa; - margin: 20px -30px; - padding: 10px 30px; - border-top: 1px solid #ccc; - border-bottom: 1px solid #ccc; -} - -div.admonition p.admonition-title { - font-family: 'Garamond', 'Georgia', serif; - font-weight: normal; - font-size: 24px; - margin: 0 0 10px 0; - padding: 0; - line-height: 1; -} - -div.admonition p.last { - margin-bottom: 0; -} - -div.highlight{ - background-color: white; -} - -dt:target, .highlight { - background: #FAF3E8; -} - -div.note { - background-color: #eee; - border: 1px solid #ccc; -} - -div.seealso { - background-color: #ffc; - border: 1px solid #ff6; -} - -div.topic { - background-color: #eee; -} - -div.warning { - background-color: #ffe4e4; - border: 1px solid #f66; -} - -p.admonition-title { - display: inline; -} - -p.admonition-title:after { - content: ":"; -} - -pre, tt { - font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; - font-size: 0.85em; -} - -img.screenshot { -} - -tt.descname, tt.descclassname { - font-size: 0.95em; -} - -tt.descname { - padding-right: 0.08em; -} - -img.screenshot { - -moz-box-shadow: 2px 2px 4px #eee; - -webkit-box-shadow: 2px 2px 4px #eee; - box-shadow: 2px 2px 4px #eee; -} - -table.docutils { - border: 1px solid #888; - -moz-box-shadow: 2px 2px 4px #eee; - -webkit-box-shadow: 2px 2px 4px #eee; - box-shadow: 2px 2px 4px #eee; -} - -table.docutils td, table.docutils th { - border: 1px solid #888; - padding: 0.25em 0.7em; -} - -table.field-list, table.footnote { - border: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - box-shadow: none; -} - -table.footnote { - margin: 15px 0; - width: 100%; - border: 1px solid #eee; -} - -table.field-list th { - padding: 0 0.8em 0 0; -} - -table.field-list td { - padding: 0; -} - -table.footnote td { - padding: 0.5em; -} - -dl { - margin: 0; - padding: 0; -} - -dl dd { - margin-left: 30px; -} - -pre { - padding: 0; - margin: 15px -30px; - padding: 8px; - line-height: 1.3em; - padding: 7px 30px; - background: #eee; - border-radius: 2px; - -moz-border-radius: 2px; - -webkit-border-radius: 2px; -} - -dl pre { - margin-left: -60px; - padding-left: 60px; -} - -tt { - background-color: #ecf0f3; - color: #222; - /* padding: 1px 2px; */ -} - -tt.xref, a tt { - background-color: #FBFBFB; -} - -a:hover tt { - background: #EEE; -} diff --git a/docs/_themes/flask_theme_support.py b/docs/_themes/flask_theme_support.py deleted file mode 100644 index 33f47449..00000000 --- a/docs/_themes/flask_theme_support.py +++ /dev/null @@ -1,86 +0,0 @@ -# flasky extensions. flasky pygments style based on tango style -from pygments.style import Style -from pygments.token import Keyword, Name, Comment, String, Error, \ - Number, Operator, Generic, Whitespace, Punctuation, Other, Literal - - -class FlaskyStyle(Style): - background_color = "#f8f8f8" - default_style = "" - - styles = { - # No corresponding class for the following: - #Text: "", # class: '' - Whitespace: "underline #f8f8f8", # class: 'w' - Error: "#a40000 border:#ef2929", # class: 'err' - Other: "#000000", # class 'x' - - Comment: "italic #8f5902", # class: 'c' - Comment.Preproc: "noitalic", # class: 'cp' - - Keyword: "bold #004461", # class: 'k' - Keyword.Constant: "bold #004461", # class: 'kc' - Keyword.Declaration: "bold #004461", # class: 'kd' - Keyword.Namespace: "bold #004461", # class: 'kn' - Keyword.Pseudo: "bold #004461", # class: 'kp' - Keyword.Reserved: "bold #004461", # class: 'kr' - Keyword.Type: "bold #004461", # class: 'kt' - - Operator: "#582800", # class: 'o' - Operator.Word: "bold #004461", # class: 'ow' - like keywords - - Punctuation: "bold #000000", # class: 'p' - - # because special names such as Name.Class, Name.Function, etc. - # are not recognized as such later in the parsing, we choose them - # to look the same as ordinary variables. - Name: "#000000", # class: 'n' - Name.Attribute: "#c4a000", # class: 'na' - to be revised - Name.Builtin: "#004461", # class: 'nb' - Name.Builtin.Pseudo: "#3465a4", # class: 'bp' - Name.Class: "#000000", # class: 'nc' - to be revised - Name.Constant: "#000000", # class: 'no' - to be revised - Name.Decorator: "#888", # class: 'nd' - to be revised - Name.Entity: "#ce5c00", # class: 'ni' - Name.Exception: "bold #cc0000", # class: 'ne' - Name.Function: "#000000", # class: 'nf' - Name.Property: "#000000", # class: 'py' - Name.Label: "#f57900", # class: 'nl' - Name.Namespace: "#000000", # class: 'nn' - to be revised - Name.Other: "#000000", # class: 'nx' - Name.Tag: "bold #004461", # class: 'nt' - like a keyword - Name.Variable: "#000000", # class: 'nv' - to be revised - Name.Variable.Class: "#000000", # class: 'vc' - to be revised - Name.Variable.Global: "#000000", # class: 'vg' - to be revised - Name.Variable.Instance: "#000000", # class: 'vi' - to be revised - - Number: "#990000", # class: 'm' - - Literal: "#000000", # class: 'l' - Literal.Date: "#000000", # class: 'ld' - - String: "#4e9a06", # class: 's' - String.Backtick: "#4e9a06", # class: 'sb' - String.Char: "#4e9a06", # class: 'sc' - String.Doc: "italic #8f5902", # class: 'sd' - like a comment - String.Double: "#4e9a06", # class: 's2' - String.Escape: "#4e9a06", # class: 'se' - String.Heredoc: "#4e9a06", # class: 'sh' - String.Interpol: "#4e9a06", # class: 'si' - String.Other: "#4e9a06", # class: 'sx' - String.Regex: "#4e9a06", # class: 'sr' - String.Single: "#4e9a06", # class: 's1' - String.Symbol: "#4e9a06", # class: 'ss' - - Generic: "#000000", # class: 'g' - Generic.Deleted: "#a40000", # class: 'gd' - Generic.Emph: "italic #000000", # class: 'ge' - Generic.Error: "#ef2929", # class: 'gr' - Generic.Heading: "bold #000080", # class: 'gh' - Generic.Inserted: "#00A000", # class: 'gi' - Generic.Output: "#888", # class: 'go' - Generic.Prompt: "#745334", # class: 'gp' - Generic.Strong: "bold #000000", # class: 'gs' - Generic.Subheading: "bold #800080", # class: 'gu' - Generic.Traceback: "bold #a40000", # class: 'gt' - } diff --git a/docs/_themes/flask_small/layout.html b/docs/_themes/pelican/layout.html similarity index 100% rename from docs/_themes/flask_small/layout.html rename to docs/_themes/pelican/layout.html diff --git a/docs/_themes/pelican/static/pelican.css_t b/docs/_themes/pelican/static/pelican.css_t new file mode 100644 index 00000000..164073e1 --- /dev/null +++ b/docs/_themes/pelican/static/pelican.css_t @@ -0,0 +1,247 @@ +/* + * pelican.css_t + * ~~~~~~~~~~~~ + * + * Sphinx stylesheet -- pelican theme, based on the nature theme + * + * :copyright: Copyright 2011 by Alexis Metaireau. + */ + +@import url("basic.css"); + +/* -- page layout ----------------------------------------------------------- */ + +body { + font-family: Arial, sans-serif; + font-size: 100%; + background-color: white; + color: #555; + margin: 0; + padding: 0; +} + +div.documentwrapper { + width: 70%; + margin: auto; +} + +div.bodywrapper { + margin: 0 0 0 230px; +} + +hr { + border: 1px solid #B1B4B6; +} + +div.document { + background-color: #eee; +} + +div.body { + background-color: #ffffff; + color: #3E4349; + padding: 0 30px 30px 30px; + font-size: 0.9em; +} + +div.footer { + color: #555; + width: 100%; + padding: 13px 0; + text-align: center; + font-size: 75%; +} + +div.footer a { + color: #444; + text-decoration: underline; +} + +div.related { + background-color: #6BA81E; + line-height: 32px; + color: #fff; + text-shadow: 0px 1px 0 #444; + font-size: 0.9em; +} + +div.related a { + color: #E2F3CC; +} + +div.sphinxsidebar { + font-size: 0.75em; + line-height: 1.5em; +} + +div.sphinxsidebarwrapper{ + padding: 20px 0; +} + +div.sphinxsidebar h3, +div.sphinxsidebar h4 { + font-family: Arial, sans-serif; + color: #222; + font-size: 1.2em; + font-weight: normal; + margin: 0; + padding: 5px 10px; + background-color: #ddd; + text-shadow: 1px 1px 0 white +} + +div.sphinxsidebar h4{ + font-size: 1.1em; +} + +div.sphinxsidebar h3 a { + color: #444; +} + + +div.sphinxsidebar p { + color: #888; + padding: 5px 20px; +} + +div.sphinxsidebar p.topless { +} + +div.sphinxsidebar ul { + margin: 10px 20px; + padding: 0; + color: #000; +} + +div.sphinxsidebar a { + color: #444; +} + +div.sphinxsidebar input { + border: 1px solid #ccc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar input[type=text]{ + margin-left: 20px; +} + +/* -- body styles ----------------------------------------------------------- */ + +a { + color: #005B81; + text-decoration: none; +} + +a:hover { + color: #E32E00; + text-decoration: underline; +} + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: Arial, sans-serif; + font-weight: normal; + color: #212224; + margin: 30px 0px 10px 0px; + padding: 5px 0 5px 10px; + text-shadow: 0px 1px 0 white +} + +div.body h1 { + border-top: 20px solid white; + margin-top: 0; + font-size: 250%; + text-align: center; +} +div.body h2 { font-size: 150%; background-color: #C8D5E3; } +div.body h3 { font-size: 120%; background-color: #D8DEE3; } +div.body h4 { font-size: 110%; background-color: #D8DEE3; } +div.body h5 { font-size: 100%; background-color: #D8DEE3; } +div.body h6 { font-size: 100%; background-color: #D8DEE3; } + +a.headerlink { + color: #c60f0f; + font-size: 0.8em; + padding: 0 4px 0 4px; + text-decoration: none; +} + +a.headerlink:hover { + background-color: #c60f0f; + color: white; +} + +div.body p, div.body dd, div.body li { + line-height: 1.5em; +} + +div.admonition p.admonition-title + p { + display: inline; +} + +div.highlight{ + background-color: #111; +} + +div.note { + background-color: #eee; + border: 1px solid #ccc; +} + +div.seealso { + background-color: #ffc; + border: 1px solid #ff6; +} + +div.topic { + background-color: #eee; +} + +div.warning { + background-color: #ffe4e4; + border: 1px solid #f66; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +pre { + padding: 10px; + background-color: #111; + color: #fff; + line-height: 1.2em; + border: 1px solid #C6C9CB; + font-size: 1.1em; + margin: 1.5em 0 1.5em 0; + -webkit-box-shadow: 1px 1px 1px #d8d8d8; + -moz-box-shadow: 1px 1px 1px #d8d8d8; +} + +tt { + background-color: #ecf0f3; + color: #222; + /* padding: 1px 2px; */ + font-size: 1.1em; + font-family: monospace; +} + +.viewcode-back { + font-family: Arial, sans-serif; +} + +div.viewcode-block:target { + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; +} diff --git a/docs/_themes/flask_small/theme.conf b/docs/_themes/pelican/theme.conf similarity index 58% rename from docs/_themes/flask_small/theme.conf rename to docs/_themes/pelican/theme.conf index 07036d14..ffbb7945 100644 --- a/docs/_themes/flask_small/theme.conf +++ b/docs/_themes/pelican/theme.conf @@ -1,8 +1,8 @@ [theme] inherit = basic -stylesheet = flasky.css +stylesheet = pelican.css nosidebar = true -pygments_style = flask_theme_support.FlaskyStyle +pygments_style = fruity [options] index_logo_height = 120px diff --git a/docs/conf.py b/docs/conf.py index 507e30a3..76167eaf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,7 +14,6 @@ master_doc = 'index' project = u'Pelican' copyright = u'2010, Alexis Metaireau and contributors' exclude_patterns = ['_build'] -pygments_style = 'sphinx' version = "2" release = version @@ -24,12 +23,13 @@ release = version # a list of builtin themes. sys.path.append(os.path.abspath('_themes')) html_theme_path = ['_themes'] -html_theme = 'flask_small' +html_theme = 'pelican' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. html_theme_options = { + 'nosidebar': True, 'index_logo': 'pelican.png', 'github_fork': 'ametaireau/pelican', } From 3d2ae33799fc334aaa24f6be7cf9557c1d3e2811 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Tue, 26 Apr 2011 00:40:16 +0100 Subject: [PATCH 019/278] update the theme (logo) --- docs/_themes/pelican/static/pelican.css_t | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/_themes/pelican/static/pelican.css_t b/docs/_themes/pelican/static/pelican.css_t index 164073e1..3cb2a3c1 100644 --- a/docs/_themes/pelican/static/pelican.css_t +++ b/docs/_themes/pelican/static/pelican.css_t @@ -34,7 +34,6 @@ hr { } div.document { - background-color: #eee; } div.body { @@ -153,12 +152,20 @@ div.body h6 { text-shadow: 0px 1px 0 white } +{% if theme_index_logo %} +div.indexwrapper h1 { + text-indent: -999999px; + background: url({{ theme_index_logo }}) no-repeat center center; + height: {{ theme_index_logo_height }}; +} +{% endif %} div.body h1 { border-top: 20px solid white; margin-top: 0; font-size: 250%; text-align: center; } + div.body h2 { font-size: 150%; background-color: #C8D5E3; } div.body h3 { font-size: 120%; background-color: #D8DEE3; } div.body h4 { font-size: 110%; background-color: #D8DEE3; } From 91cb42d7d887d1899617dd5bcf76685ba8f67865 Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Tue, 26 Apr 2011 12:23:45 +0200 Subject: [PATCH 020/278] add a KISS plugin system --- pelican/__init__.py | 25 +++++++++++++++++++++++-- pelican/settings.py | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 12d12210..cf99295e 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -1,5 +1,8 @@ import argparse import os +import pkgutil + +from blinker import signal from pelican.generators import (ArticlesGenerator, PagesGenerator, StaticGenerator, PdfGenerator) @@ -13,7 +16,7 @@ VERSION = "2.6.0" class Pelican(object): def __init__(self, settings=None, path=None, theme=None, output_path=None, - markup=None, keep=False): + markup=None, keep=False, plugins_path=None): """Read the settings, and performs some checks on the environment before doing anything else. """ @@ -41,6 +44,15 @@ class Pelican(object): self.theme = theme_path else: raise Exception("Impossible to find the theme %s" % theme) + + plugins_path = plugins_path or settings['PLUGINS_PATH'] + if plugins_path: + plugins_path = os.path.abspath(plugins_path) + self.load_plugins(plugins_path) + else: + self.plugins = None + + signal('pelican_initialized').send(self) def run(self): """Run the generators and return""" @@ -81,6 +93,13 @@ class Pelican(object): def get_writer(self): return Writer(self.output_path, settings=self.settings) + + def load_plugins(self,path): + loaded = [] + for module_loader, name, ispkg in pkgutil.walk_packages(path=[path,]): + loaded.append( module_loader.find_module(name).load_module(name) ) + self.plugins = loaded + @@ -116,6 +135,8 @@ def main(): parser.add_argument('-r', '--autoreload', dest='autoreload', action='store_true', help="Relaunch pelican each time a modification occurs on the content" "files") + parser.add_argument('-p', '--plugins', default=None, dest='plugins_path', + help='the path of plugins to use') args = parser.parse_args() log.init(args.verbosity) @@ -134,7 +155,7 @@ def main(): cls = getattr(module, cls_name) try: - pelican = cls(settings, args.path, args.theme, args.output, markup, args.keep) + pelican = cls(settings, args.path, args.theme, args.output, markup, args.keep, args.plugins_path) if args.autoreload: while True: try: diff --git a/pelican/settings.py b/pelican/settings.py index 6c0918a0..3786b7f5 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -37,6 +37,7 @@ _DEFAULT_CONFIG = {'PATH': None, 'WITH_PAGINATION': False, 'DEFAULT_PAGINATION': 5, 'DEFAULT_ORPHANS': 0, + 'PLUGINS_PATH': None, } def read_settings(filename): From 4fb5d2b31e755d346e1ff5b7f6d188e0f3ef8b09 Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Tue, 26 Apr 2011 12:26:56 +0200 Subject: [PATCH 021/278] add plugin sample --- plugins_samples/initialized.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins_samples/initialized.py diff --git a/plugins_samples/initialized.py b/plugins_samples/initialized.py new file mode 100644 index 00000000..f104c275 --- /dev/null +++ b/plugins_samples/initialized.py @@ -0,0 +1,7 @@ +from blinker import signal + + +def test(sender): + print "%s initialized !!" % sender + +signal('pelican_initialized').connect(test) From dfe4d4e1320d3652fcf11bfd4983df4bf7fdc8e1 Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Tue, 26 Apr 2011 13:16:09 +0200 Subject: [PATCH 022/278] add gravatar plugin and pelican_generate_context signal --- pelican/generators.py | 5 +++++ plugins_samples/gravatar.py | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 plugins_samples/gravatar.py diff --git a/pelican/generators.py b/pelican/generators.py index 569d5f50..02131532 100755 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -8,6 +8,8 @@ import os import math import random +from blinker import signal + from jinja2 import Environment, FileSystemLoader from jinja2.exceptions import TemplateNotFound @@ -92,6 +94,7 @@ class ArticlesGenerator(Generator): self.dates = {} self.tags = defaultdict(list) self.categories = defaultdict(list) + self.signal = {'pelican_generate_context' : signal('pelican_generate_context')} super(ArticlesGenerator, self).__init__(*args, **kwargs) def generate_feeds(self, writer): @@ -200,6 +203,8 @@ class ArticlesGenerator(Generator): and self.settings['FALLBACK_ON_FS_DATE']: metadatas['date'] = datetime.fromtimestamp(os.stat(f).st_ctime) + self.signal['pelican_generate_context'].send(self, metadatas=metadatas) + article = Article(content, metadatas, settings=self.settings, filename=f) if not is_valid_content(article, f): diff --git a/plugins_samples/gravatar.py b/plugins_samples/gravatar.py new file mode 100644 index 00000000..ca08984c --- /dev/null +++ b/plugins_samples/gravatar.py @@ -0,0 +1,20 @@ +import hashlib + +from blinker import signal + + +def add_gravatar(generator, metadatas): + + #first check email + if 'email' not in metadatas.keys()\ + and 'AUTHOR_EMAIL' in generator.settings.keys(): + metadatas['email'] = generator.settings['AUTHOR_EMAIL'] + + #then add gravatar url + if 'email' in metadatas.keys(): + gravatar_url = "http://www.gravatar.com/avatar/" + \ + hashlib.md5(metadatas['email'].lower()).hexdigest() + metadatas["author_gravatar"] = gravatar_url + + +signal('pelican_generate_context').connect(add_gravatar) From eef5fc8f9969da8a32a5371dea4c1be897141ca0 Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Tue, 26 Apr 2011 19:44:40 +0200 Subject: [PATCH 023/278] rename signal --- pelican/generators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index 02131532..38826a49 100755 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -94,7 +94,7 @@ class ArticlesGenerator(Generator): self.dates = {} self.tags = defaultdict(list) self.categories = defaultdict(list) - self.signal = {'pelican_generate_context' : signal('pelican_generate_context')} + self.signal = {'pelican_article_generate_context' : signal('pelican_article_generate_context')} super(ArticlesGenerator, self).__init__(*args, **kwargs) def generate_feeds(self, writer): @@ -203,7 +203,7 @@ class ArticlesGenerator(Generator): and self.settings['FALLBACK_ON_FS_DATE']: metadatas['date'] = datetime.fromtimestamp(os.stat(f).st_ctime) - self.signal['pelican_generate_context'].send(self, metadatas=metadatas) + self.signal['pelican_article_generate_context'].send(self, metadatas=metadatas) article = Article(content, metadatas, settings=self.settings, filename=f) From 91831eb5259757c3b1da586cb95080f6b719b99a Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Tue, 26 Apr 2011 19:44:55 +0200 Subject: [PATCH 024/278] add doc --- plugins_samples/gravatar.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/plugins_samples/gravatar.py b/plugins_samples/gravatar.py index ca08984c..9887e97e 100644 --- a/plugins_samples/gravatar.py +++ b/plugins_samples/gravatar.py @@ -1,7 +1,26 @@ import hashlib from blinker import signal +""" +Gravata plugin for Pelican +========================== +Simply add author_gravatar variable in article's context, which contain +the gravatar url. + +Settings: +--------- + +Add AUTHOR_EMAIL to your settings file to define default author email + +Article metadatas: +------------------ + +:email: article's author email + +If one of them are defined the author_gravatar variable is added to +article's context. +""" def add_gravatar(generator, metadatas): @@ -17,4 +36,4 @@ def add_gravatar(generator, metadatas): metadatas["author_gravatar"] = gravatar_url -signal('pelican_generate_context').connect(add_gravatar) +signal('pelican_article_generate_context').connect(add_gravatar) From 09567fa99ea0cb27ab4f1ca146c909cdacda814c Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Tue, 26 Apr 2011 20:02:05 +0200 Subject: [PATCH 025/278] add global license capabability as a plugin --- plugins_samples/global_license.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 plugins_samples/global_license.py diff --git a/plugins_samples/global_license.py b/plugins_samples/global_license.py new file mode 100644 index 00000000..feae64e2 --- /dev/null +++ b/plugins_samples/global_license.py @@ -0,0 +1,23 @@ +from blinker import signal + +""" +License plugin for Pelican +========================== + +Simply add license variable in article's context, which contain +the license text. + +Settings: +--------- + +Add LICENSE to your settings file to define default license. + +""" + +def add_license(generator, metadatas): + if 'license' not in metadatas.keys()\ + and 'LICENSE' in self.settings.keys(): + metadatas['license'] = self.settings['LICENSE'] + + +signal('pelican_article_generate_context').connect(add_license) From f4b2b628744efbda99f9b0c43035f1d49c8cecb0 Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Tue, 26 Apr 2011 20:04:44 +0200 Subject: [PATCH 026/278] fix mistake --- plugins_samples/global_license.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins_samples/global_license.py b/plugins_samples/global_license.py index feae64e2..eeb20965 100644 --- a/plugins_samples/global_license.py +++ b/plugins_samples/global_license.py @@ -16,8 +16,8 @@ Add LICENSE to your settings file to define default license. def add_license(generator, metadatas): if 'license' not in metadatas.keys()\ - and 'LICENSE' in self.settings.keys(): - metadatas['license'] = self.settings['LICENSE'] + and 'LICENSE' in generator.settings.keys(): + metadatas['license'] = generator.settings['LICENSE'] signal('pelican_article_generate_context').connect(add_license) From 07edd96088f0ac7e4d39f86853eacc64fc8623e5 Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Tue, 26 Apr 2011 23:13:28 +0200 Subject: [PATCH 027/278] add blinker to requires --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 936a3171..4744d0fb 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import sys VERSION = "2.6.0" # find a better way to do so. -requires = ['feedgenerator', 'jinja2', 'pygments', 'docutils', 'Markdown'] +requires = ['feedgenerator', 'jinja2', 'pygments', 'docutils', 'Markdown', 'blinker'] if sys.version_info < (2,7): requires.append('argparse') From 20b0d1d4ae3aff83b49d542652dd44c7ab9872bb Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Wed, 27 Apr 2011 18:09:55 +0200 Subject: [PATCH 028/278] Fix little bug when declaring plugins path in config file --- pelican/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index cf99295e..1a618b45 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -47,7 +47,7 @@ class Pelican(object): plugins_path = plugins_path or settings['PLUGINS_PATH'] if plugins_path: - plugins_path = os.path.abspath(plugins_path) + plugins_path = os.path.abspath(os.path.expanduser(plugins_path)) self.load_plugins(plugins_path) else: self.plugins = None From c5a63c953a0f9e068a2563a9c5ab11045eaf4c1e Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Fri, 17 Jun 2011 23:37:08 +0200 Subject: [PATCH 029/278] Remove the dependency to pkgutil for the plugins --- pelican/__init__.py | 29 +++++++------------ pelican/generators.py | 4 +-- pelican/plugins/__init__.py | 0 .../plugins}/global_license.py | 6 ++-- .../plugins}/gravatar.py | 19 ++++++------ .../plugins}/initialized.py | 3 +- 6 files changed, 28 insertions(+), 33 deletions(-) create mode 100644 pelican/plugins/__init__.py rename {plugins_samples => pelican/plugins}/global_license.py (72%) rename {plugins_samples => pelican/plugins}/gravatar.py (60%) rename {plugins_samples => pelican/plugins}/initialized.py (57%) diff --git a/pelican/__init__.py b/pelican/__init__.py index 846e2554..515434cc 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -1,7 +1,6 @@ import argparse import os import time -import pkgutil from blinker import signal @@ -46,15 +45,18 @@ class Pelican(object): else: raise Exception("Impossible to find the theme %s" % theme) - plugins_path = plugins_path or settings['PLUGINS_PATH'] - if plugins_path: - plugins_path = os.path.abspath(os.path.expanduser(plugins_path)) - self.load_plugins(plugins_path) - else: - self.plugins = None - + self.init_plugins() signal('pelican_initialized').send(self) + def init_plugins(self): + self.plugins = self.settings['PLUGINS'] + for plugin in self.plugins: + # if it's a string, then import it + if isinstance(plugin, str): + plugin = __import__(plugin, globals(), locals(), 'module') + + plugin.register() + def run(self): """Run the generators and return""" @@ -97,13 +99,6 @@ class Pelican(object): def get_writer(self): return Writer(self.output_path, settings=self.settings) - def load_plugins(self, path): - loaded = [] - for module_loader, name, ispkg in pkgutil.walk_packages(path=[path,]): - loaded.append(module_loader.find_module(name).load_module(name)) - self.plugins = loaded - - def main(): @@ -136,8 +131,6 @@ def main(): parser.add_argument('-r', '--autoreload', dest='autoreload', action='store_true', help="Relaunch pelican each time a modification occurs on the content" "files") - parser.add_argument('-p', '--plugins', default=None, dest='plugins_path', - help='the path of plugins to use') args = parser.parse_args() log.init(args.verbosity) @@ -155,7 +148,7 @@ def main(): try: pelican = cls(settings, args.path, args.theme, args.output, markup, - args.delete_outputdir, args.plugins_path) + args.delete_outputdir) if args.autoreload: while True: try: diff --git a/pelican/generators.py b/pelican/generators.py index b6619d0e..eb74aff9 100755 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -13,7 +13,7 @@ from blinker import signal from jinja2 import Environment, FileSystemLoader from jinja2.exceptions import TemplateNotFound -from pelican.utils import copytree, get_relative_path, process_translations, open +from pelican.utils import copy, get_relative_path, process_translations, open from pelican.contents import Article, Page, is_valid_content from pelican.readers import read_file from pelican.log import * @@ -214,7 +214,7 @@ class ArticlesGenerator(Generator): and self.settings['FALLBACK_ON_FS_DATE']: metadata['date'] = datetime.fromtimestamp(os.stat(f).st_ctime) - self.signal['pelican_article_generate_context'].send(self, metadatas=metadatas) + self.signal['pelican_article_generate_context'].send(self, metadata=metadata) article = Article(content, metadata, settings=self.settings, filename=f) if not is_valid_content(article, f): diff --git a/pelican/plugins/__init__.py b/pelican/plugins/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/plugins_samples/global_license.py b/pelican/plugins/global_license.py similarity index 72% rename from plugins_samples/global_license.py rename to pelican/plugins/global_license.py index eeb20965..b6913831 100644 --- a/plugins_samples/global_license.py +++ b/pelican/plugins/global_license.py @@ -14,10 +14,10 @@ Add LICENSE to your settings file to define default license. """ -def add_license(generator, metadatas): - if 'license' not in metadatas.keys()\ +def add_license(generator, metadata): + if 'license' not in metadata.keys()\ and 'LICENSE' in generator.settings.keys(): - metadatas['license'] = generator.settings['LICENSE'] + metadata['license'] = generator.settings['LICENSE'] signal('pelican_article_generate_context').connect(add_license) diff --git a/plugins_samples/gravatar.py b/pelican/plugins/gravatar.py similarity index 60% rename from plugins_samples/gravatar.py rename to pelican/plugins/gravatar.py index 9887e97e..2601ada0 100644 --- a/plugins_samples/gravatar.py +++ b/pelican/plugins/gravatar.py @@ -13,7 +13,7 @@ Settings: Add AUTHOR_EMAIL to your settings file to define default author email -Article metadatas: +Article metadata: ------------------ :email: article's author email @@ -22,18 +22,19 @@ If one of them are defined the author_gravatar variable is added to article's context. """ -def add_gravatar(generator, metadatas): +def add_gravatar(generator, metadata): #first check email - if 'email' not in metadatas.keys()\ + if 'email' not in metadata.keys()\ and 'AUTHOR_EMAIL' in generator.settings.keys(): - metadatas['email'] = generator.settings['AUTHOR_EMAIL'] + metadata['email'] = generator.settings['AUTHOR_EMAIL'] #then add gravatar url - if 'email' in metadatas.keys(): + if 'email' in metadata.keys(): gravatar_url = "http://www.gravatar.com/avatar/" + \ - hashlib.md5(metadatas['email'].lower()).hexdigest() - metadatas["author_gravatar"] = gravatar_url + hashlib.md5(metadata['email'].lower()).hexdigest() + metadata["author_gravatar"] = gravatar_url - -signal('pelican_article_generate_context').connect(add_gravatar) + +def register(): + signal('pelican_article_generate_context').connect(add_gravatar) diff --git a/plugins_samples/initialized.py b/pelican/plugins/initialized.py similarity index 57% rename from plugins_samples/initialized.py rename to pelican/plugins/initialized.py index f104c275..076ba06d 100644 --- a/plugins_samples/initialized.py +++ b/pelican/plugins/initialized.py @@ -4,4 +4,5 @@ from blinker import signal def test(sender): print "%s initialized !!" % sender -signal('pelican_initialized').connect(test) +def register(): + signal('pelican_initialized').connect(test) From 28c0644eb60200e333a9f21f9e8ada5e16307df7 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sat, 18 Jun 2011 01:03:53 +0200 Subject: [PATCH 030/278] Plugins doc + minor design changes. --- docs/index.rst | 2 + docs/plugins.rst | 75 +++++++++++++++++++++++++++++++ docs/settings.rst | 5 ++- pelican/__init__.py | 4 +- pelican/generators.py | 8 ++-- pelican/plugins/global_license.py | 6 +-- pelican/plugins/gravatar.py | 4 +- pelican/plugins/initialized.py | 5 +-- pelican/settings.py | 2 +- pelican/signals.py | 4 ++ 10 files changed, 97 insertions(+), 18 deletions(-) create mode 100644 docs/plugins.rst create mode 100644 pelican/signals.py diff --git a/docs/index.rst b/docs/index.rst index 2897bc63..0e6ba583 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -55,6 +55,8 @@ A french version of the documentation is available at :doc:`fr/index`. getting_started settings themes + pelican-themes + plugins internals faq contribute diff --git a/docs/plugins.rst b/docs/plugins.rst new file mode 100644 index 00000000..6763f5ef --- /dev/null +++ b/docs/plugins.rst @@ -0,0 +1,75 @@ +.. _plugins: + +Plugins +####### + +Since version 2.8, pelican manages plugins. Plugins are a way to add feature to +pelican without having to directly hack pelican code. + +Pelican is shipped with a set of core plugins, but you can easily implement +your own (and this page describes how) + +How to use plugins? +==================== + +To load plugins, you have to specify a them in your settings file. You have two +ways to do so: by specifying strings with the path to the callables: :: + + PLUGINS = ['pelican.plugins.gravatar',] + +Or by importing them and adding them to the list:: + + from pelican.plugins import gravatar + PLUGINS = [gravatar, ] + +If your plugins are not in an importable path, you can specify a `PLUGIN_PATH` +in the settings:: + + PLUGIN_PATH = "plugins" + PLUGINS = ["list", "of", "plugins"] + +How to create plugins? +====================== + +Plugins are based on the concept of signals. Pelican sends signals and plugins +subscribe to those signals. The list of signals are defined in a following +section. + +The only rule to follow for plugins is to define a `register` callable, in +which you map the signals to your plugin logic. Let's take a simple exemple:: + + from pelican import signals + + def test(sender): + print "%s initialized !!" % sender + + def register(): + signals.initialized.connect(test) + + +List of signals +=============== + +Here is the list of currently implemented signals: + +========================= ============================ ===================== +Signal Arguments Description +========================= ============================ ===================== +initialized pelican object +article_generate_context article_generator, metadata +========================= ============================ ===================== + +The list is currently small, don't hesitate to add signals and make a pull +request if you need them! + +List of plugins +=============== + +Not all the list are described here, but a few of them have been extracted from +pelican core and provided in pelican.plugins. They are described here: + +Tag cloud +--------- + +Translation +----------- diff --git a/docs/settings.rst b/docs/settings.rst index 9c596da3..9287facd 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -51,6 +51,7 @@ Setting name (default value) what does it do? `PDF_GENERATOR` (``False``) Set to True if you want to have PDF versions of your documents. You will need to install `rst2pdf`. +`PLUGINS` (``[]``) The list of plugins to load. See :ref:`plugins`. `RELATIVE_URL` (``True``) Defines if pelican should use relative urls or not. `SITEURL` base URL of your website. Note that this is @@ -208,14 +209,14 @@ Setting name what does it do ? `GITHUB_URL` Your github URL (if you have one), it will then use it to create a github ribbon. `GOOGLE_ANALYTICS` 'UA-XXXX-YYYY' to activate google analytics. +`LINKS` A list of tuples (Title, Url) for links to appear on + the header. `PIWIK_URL` URL to your Piwik server - without 'http://' at the beginning. `PIWIK_SSL_URL` If the SSL-URL differs from the normal Piwik-URL you have to include this setting too. (optional) `PIWIK_SITE_ID` ID for the monitored website. You can find the ID in the Piwik admin interface > settings > websites. -`LINKS` A list of tuples (Title, Url) for links to appear on - the header. `SOCIAL` A list of tuples (Title, Url) to appear in the "social" section. `TWITTER_USERNAME` Allows to add a button on the articles to tweet about diff --git a/pelican/__init__.py b/pelican/__init__.py index 515434cc..7121318e 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -2,7 +2,7 @@ import argparse import os import time -from blinker import signal +from pelican import signals from pelican.generators import (ArticlesGenerator, PagesGenerator, StaticGenerator, PdfGenerator) @@ -46,7 +46,7 @@ class Pelican(object): raise Exception("Impossible to find the theme %s" % theme) self.init_plugins() - signal('pelican_initialized').send(self) + signals.initialized.send(self) def init_plugins(self): self.plugins = self.settings['PLUGINS'] diff --git a/pelican/generators.py b/pelican/generators.py index eb74aff9..38fa9da7 100755 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -8,8 +8,6 @@ import os import math import random -from blinker import signal - from jinja2 import Environment, FileSystemLoader from jinja2.exceptions import TemplateNotFound @@ -17,6 +15,7 @@ from pelican.utils import copy, get_relative_path, process_translations, open from pelican.contents import Article, Page, is_valid_content from pelican.readers import read_file from pelican.log import * +from pelican import signals class Generator(object): @@ -100,7 +99,6 @@ class ArticlesGenerator(Generator): self.dates = {} self.tags = defaultdict(list) self.categories = defaultdict(list) - self.signal = {'pelican_article_generate_context' : signal('pelican_article_generate_context')} super(ArticlesGenerator, self).__init__(*args, **kwargs) self.drafts = [] @@ -214,7 +212,7 @@ class ArticlesGenerator(Generator): and self.settings['FALLBACK_ON_FS_DATE']: metadata['date'] = datetime.fromtimestamp(os.stat(f).st_ctime) - self.signal['pelican_article_generate_context'].send(self, metadata=metadata) + signals.article_generate_context.send(self, metadata=metadata) article = Article(content, metadata, settings=self.settings, filename=f) if not is_valid_content(article, f): @@ -318,7 +316,7 @@ class StaticGenerator(Generator): final_path=None): """Copy all the paths from source to destination""" for path in paths: - copy(path, source, os.path.join(output_path, destination), final_path, + copy(path, source, os.path.join(output_path, destination), final_path, overwrite=True) def generate_output(self, writer): diff --git a/pelican/plugins/global_license.py b/pelican/plugins/global_license.py index b6913831..463a93b3 100644 --- a/pelican/plugins/global_license.py +++ b/pelican/plugins/global_license.py @@ -1,4 +1,4 @@ -from blinker import signal +from pelican import signals """ License plugin for Pelican @@ -19,5 +19,5 @@ def add_license(generator, metadata): and 'LICENSE' in generator.settings.keys(): metadata['license'] = generator.settings['LICENSE'] - -signal('pelican_article_generate_context').connect(add_license) +def register(): + signals.article_generate_context.connect(add_license) diff --git a/pelican/plugins/gravatar.py b/pelican/plugins/gravatar.py index 2601ada0..200bb5a5 100644 --- a/pelican/plugins/gravatar.py +++ b/pelican/plugins/gravatar.py @@ -1,6 +1,6 @@ import hashlib -from blinker import signal +from pelican import signals """ Gravata plugin for Pelican ========================== @@ -37,4 +37,4 @@ def add_gravatar(generator, metadata): def register(): - signal('pelican_article_generate_context').connect(add_gravatar) + signals.article_generate_context.connect(add_gravatar) diff --git a/pelican/plugins/initialized.py b/pelican/plugins/initialized.py index 076ba06d..5e4cf174 100644 --- a/pelican/plugins/initialized.py +++ b/pelican/plugins/initialized.py @@ -1,8 +1,7 @@ -from blinker import signal - +from pelican import signals def test(sender): print "%s initialized !!" % sender def register(): - signal('pelican_initialized').connect(test) + signals.initialized.connect(test) diff --git a/pelican/settings.py b/pelican/settings.py index 3cc4157a..c1f15b2d 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -42,7 +42,7 @@ _DEFAULT_CONFIG = {'PATH': None, 'DEFAULT_METADATA': (), 'FILES_TO_COPY': (), 'DEFAULT_STATUS': 'published', - 'PLUGINS_PATH': None, + 'PLUGINS': [], } def read_settings(filename): diff --git a/pelican/signals.py b/pelican/signals.py new file mode 100644 index 00000000..f2bf4547 --- /dev/null +++ b/pelican/signals.py @@ -0,0 +1,4 @@ +from blinker import signal + +initialized = signal('pelican_initialized') +article_generate_context = signal('article_generate_context') From c6c0ee76c2d47017a56ef8442d8616e2dd2fb9d7 Mon Sep 17 00:00:00 2001 From: Marco Milanesi Date: Tue, 6 Sep 2011 18:54:41 +0200 Subject: [PATCH 031/278] implemented github activity plugin --- pelican/plugins/github_activity.py | 27 +++++++++++++++++++++++++++ pelican/signals.py | 1 + pelican/utils.py | 12 ++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 pelican/plugins/github_activity.py diff --git a/pelican/plugins/github_activity.py b/pelican/plugins/github_activity.py new file mode 100644 index 00000000..d279e616 --- /dev/null +++ b/pelican/plugins/github_activity.py @@ -0,0 +1,27 @@ +from pelican import signals +from pelican.utils import singleton + +@singleton +class GitHubActivity(): + def __init__(self, generator): + try: + import feedparser + self.ga = feedparser.parse( + generator.settings['GITHUB_ACTIVITY_FEED']) + except ImportError: + raise Exception("unable to find feedparser") + + def fetch(self): + return [activity['content'][0]['value'].strip() + for activity in self.ga['entries']] + +def add_github_activity(generator, metadata): + if 'GITHUB_ACTIVITY_FEED' in generator.settings.keys(): + + ga = GitHubActivity(generator) + + ga_html_snippets = ga.fetch() + generator.context['github_activity'] = ga_html_snippets + +def register(): + signals.article_generate_context.connect(add_github_activity) diff --git a/pelican/signals.py b/pelican/signals.py index f2bf4547..fb50252f 100644 --- a/pelican/signals.py +++ b/pelican/signals.py @@ -2,3 +2,4 @@ from blinker import signal initialized = signal('pelican_initialized') article_generate_context = signal('article_generate_context') +github_activity = signal('github_activity') diff --git a/pelican/utils.py b/pelican/utils.py index 8e48c2e9..a67836ca 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -222,3 +222,15 @@ def files_changed(path, extensions): LAST_MTIME = mtime return True return False + +def singleton(cls): + """ + Singleton decorator for multiple calls inside plugins + for an example see pelican/plugins/github_activity.py + """ + instances = {} + def getinstance(*args, **kwargs): + if cls not in instances: + instances[cls] = cls(*args, **kwargs) + return instances[cls] + return getinstance From 3743617d27f5ec5216432636433dc566a7f802c1 Mon Sep 17 00:00:00 2001 From: Marco Milanesi Date: Tue, 6 Sep 2011 18:56:44 +0200 Subject: [PATCH 032/278] removed spurious signal --- pelican/signals.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pelican/signals.py b/pelican/signals.py index fb50252f..f2bf4547 100644 --- a/pelican/signals.py +++ b/pelican/signals.py @@ -2,4 +2,3 @@ from blinker import signal initialized = signal('pelican_initialized') article_generate_context = signal('article_generate_context') -github_activity = signal('github_activity') From 575905ac53f1af696045f68e0ac469ecd2a2ba9a Mon Sep 17 00:00:00 2001 From: Marco Milanesi Date: Tue, 6 Sep 2011 19:14:21 +0200 Subject: [PATCH 033/278] some commentary copyright infos some instructions on how to use the plugin --- pelican/plugins/github_activity.py | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/pelican/plugins/github_activity.py b/pelican/plugins/github_activity.py index d279e616..bbce2759 100644 --- a/pelican/plugins/github_activity.py +++ b/pelican/plugins/github_activity.py @@ -1,8 +1,32 @@ +# -*- coding: utf-8 -*- +""" + Copyright (c) Marco Milanesi + + A plugin to list your Github Activity + To enable it set in your pelican config file the GITHUB_ACTIVITY_FEED + parameter pointing to your github activity feed. + + for example my personal activity feed is: + + https://github.com/kpanic.atom + + in your template just write a for in jinja2 syntax against the + github_activity variable. + + github_activity is a list containing raw html from github so you can + include it directly in your template + +""" + from pelican import signals from pelican.utils import singleton + @singleton class GitHubActivity(): + """ + A class created to fetch github activity with feedparser + """ def __init__(self, generator): try: import feedparser @@ -12,10 +36,17 @@ class GitHubActivity(): raise Exception("unable to find feedparser") def fetch(self): + """ + returns a list of html snippets fetched from github actitivy feed + """ return [activity['content'][0]['value'].strip() for activity in self.ga['entries']] + def add_github_activity(generator, metadata): + """ + registered handler for the github activity plugin + """ if 'GITHUB_ACTIVITY_FEED' in generator.settings.keys(): ga = GitHubActivity(generator) @@ -23,5 +54,9 @@ def add_github_activity(generator, metadata): ga_html_snippets = ga.fetch() generator.context['github_activity'] = ga_html_snippets + def register(): + """ + Plugin registration + """ signals.article_generate_context.connect(add_github_activity) From 48d7df72f1a0d9c405cac85b662a70c6c14dc238 Mon Sep 17 00:00:00 2001 From: Marco Milanesi Date: Wed, 7 Sep 2011 17:08:28 +0200 Subject: [PATCH 034/278] refactored code and introduced a new signal in ArticlesGenerator __init__ --- pelican/generators.py | 1 + pelican/plugins/github_activity.py | 26 ++++++++++++++++---------- pelican/signals.py | 1 + pelican/utils.py | 12 ------------ 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index 38fa9da7..9baf240e 100755 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -101,6 +101,7 @@ class ArticlesGenerator(Generator): self.categories = defaultdict(list) super(ArticlesGenerator, self).__init__(*args, **kwargs) self.drafts = [] + signals.article_generator_init.send(self) def generate_feeds(self, writer): """Generate the feeds from the current context, and output files.""" diff --git a/pelican/plugins/github_activity.py b/pelican/plugins/github_activity.py index bbce2759..ba6cd70f 100644 --- a/pelican/plugins/github_activity.py +++ b/pelican/plugins/github_activity.py @@ -19,10 +19,8 @@ """ from pelican import signals -from pelican.utils import singleton -@singleton class GitHubActivity(): """ A class created to fetch github activity with feedparser @@ -30,7 +28,7 @@ class GitHubActivity(): def __init__(self, generator): try: import feedparser - self.ga = feedparser.parse( + self.activities = feedparser.parse( generator.settings['GITHUB_ACTIVITY_FEED']) except ImportError: raise Exception("unable to find feedparser") @@ -40,23 +38,31 @@ class GitHubActivity(): returns a list of html snippets fetched from github actitivy feed """ return [activity['content'][0]['value'].strip() - for activity in self.ga['entries']] + for activity in self.activities['entries']] -def add_github_activity(generator, metadata): +def fetch_github_activity(gen, metadata): """ registered handler for the github activity plugin + it puts in generator.context the html needed to be displayed on a + template """ - if 'GITHUB_ACTIVITY_FEED' in generator.settings.keys(): - ga = GitHubActivity(generator) + if 'GITHUB_ACTIVITY_FEED' in gen.settings.keys(): + gen.context['github_activity'] = gen.plugin_instance.fetch() - ga_html_snippets = ga.fetch() - generator.context['github_activity'] = ga_html_snippets + +def feed_parser_initialization(generator): + """ + Initialization of feed parser + """ + + generator.plugin_instance = GitHubActivity(generator) def register(): """ Plugin registration """ - signals.article_generate_context.connect(add_github_activity) + signals.article_generator_init.connect(feed_parser_initialization) + signals.article_generate_context.connect(fetch_github_activity) diff --git a/pelican/signals.py b/pelican/signals.py index f2bf4547..b1c35794 100644 --- a/pelican/signals.py +++ b/pelican/signals.py @@ -2,3 +2,4 @@ from blinker import signal initialized = signal('pelican_initialized') article_generate_context = signal('article_generate_context') +article_generator_init = signal('article_generator_init') diff --git a/pelican/utils.py b/pelican/utils.py index a67836ca..8e48c2e9 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -222,15 +222,3 @@ def files_changed(path, extensions): LAST_MTIME = mtime return True return False - -def singleton(cls): - """ - Singleton decorator for multiple calls inside plugins - for an example see pelican/plugins/github_activity.py - """ - instances = {} - def getinstance(*args, **kwargs): - if cls not in instances: - instances[cls] = cls(*args, **kwargs) - return instances[cls] - return getinstance From 948ef452ca7d6a02175674b1169fa9c700f72c28 Mon Sep 17 00:00:00 2001 From: Marco Milanesi Date: Wed, 7 Sep 2011 18:55:37 +0200 Subject: [PATCH 035/278] documentation for the github activity plugin --- docs/plugins.rst | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 6763f5ef..42ecd656 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -52,12 +52,13 @@ List of signals Here is the list of currently implemented signals: -========================= ============================ ===================== +========================= ============================ ========================================= Signal Arguments Description -========================= ============================ ===================== +========================= ============================ ========================================= initialized pelican object article_generate_context article_generator, metadata -========================= ============================ ===================== +article_generator_init article_generator invoked in the ArticlesGenerator.__init__ +========================= ============================ ========================================= The list is currently small, don't hesitate to add signals and make a pull request if you need them! @@ -73,3 +74,41 @@ Tag cloud Translation ----------- + +Github Activity +_______________ + +This plugins introduces a new depencency, you have to install feedparser +if you want to use it, these are some ways to do it:: + + apt-get install python-feedparser # on debian based distributions like ubuntu + sudo easy_install feedparser + sudo pip install feedparser + +To enable it set in your pelican config file the GITHUB_ACTIVITY_FEED +parameter pointing to your github activity feed. + +for example my personal activity feed is:: + + https://github.com/kpanic.atom + +and the config line could be:: + + GITHUB_ACTIVITY_FEED = 'https://github.com/kpanic.atom' + +in your template just write a for in jinja2 syntax against the +github_activity variable, like for example:: + + {% if GITHUB_ACTIVITY_FEED %} + + {% endif %} + + +github_activity is a list containing raw html from github so you can include it +directly in your (for example base.html) template and style it in a way that +your prefer using your css skills From 83d59d6b93a9300572c5f1adddca524baba5cb43 Mon Sep 17 00:00:00 2001 From: Marco Milanesi Date: Tue, 18 Oct 2011 22:21:43 +0200 Subject: [PATCH 036/278] revised github activity to adapt it to new github atom feed changes --- pelican/plugins/github_activity.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/pelican/plugins/github_activity.py b/pelican/plugins/github_activity.py index ba6cd70f..f2ba1da7 100644 --- a/pelican/plugins/github_activity.py +++ b/pelican/plugins/github_activity.py @@ -13,9 +13,20 @@ in your template just write a for in jinja2 syntax against the github_activity variable. - github_activity is a list containing raw html from github so you can - include it directly in your template + i.e. + + + github_activity is a list containing a list. The first element is the title + and the second element is the raw html from github """ from pelican import signals @@ -31,14 +42,20 @@ class GitHubActivity(): self.activities = feedparser.parse( generator.settings['GITHUB_ACTIVITY_FEED']) except ImportError: - raise Exception("unable to find feedparser") + raise Exception("Unable to find feedparser") def fetch(self): """ returns a list of html snippets fetched from github actitivy feed """ - return [activity['content'][0]['value'].strip() - for activity in self.activities['entries']] + + entries = [] + for activity in self.activities['entries']: + entries.append( + [element for element in [activity['title'], + activity['content'][0]['value']]]) + + return entries def fetch_github_activity(gen, metadata): From 462e637e69e46318411b53eac6d237c8ef498542 Mon Sep 17 00:00:00 2001 From: Marco Milanesi Date: Wed, 19 Oct 2011 11:57:37 +0200 Subject: [PATCH 037/278] updated doc --- docs/plugins.rst | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 42ecd656..3bf7c532 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -100,15 +100,20 @@ in your template just write a for in jinja2 syntax against the github_activity variable, like for example:: {% if GITHUB_ACTIVITY_FEED %} - + {% endif %} -github_activity is a list containing raw html from github so you can include it -directly in your (for example base.html) template and style it in a way that -your prefer using your css skills + +github_activity is a list containing a list. The first element is the title and +the second element is the raw html from github so you can include it directly +in your (for example base.html) template and style it in a way that your prefer +using your css skills From f248a811076bdf5facfbf75de49e52fef0d6315a Mon Sep 17 00:00:00 2001 From: Skami18 Date: Sat, 29 Oct 2011 18:04:59 +0200 Subject: [PATCH 038/278] Plugins are now installed by setuptools --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 18db914f..071d3523 100755 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( author_email = 'alexis@notmyidea.org', description = "A tool to generate a static blog, with restructured text (or markdown) input files.", long_description=open('README.rst').read(), - packages = ['pelican'], + packages = ['pelican', 'pelican.plugins'], include_package_data = True, install_requires = requires, scripts = ['bin/pelican', 'tools/pelican-themes'], From b735f5fa49643bbf87aa58dca53b2e2830bbc0d7 Mon Sep 17 00:00:00 2001 From: Skami18 Date: Sun, 30 Oct 2011 14:10:50 +0100 Subject: [PATCH 039/278] Plugin loading is logged in debug mode (-D) --- pelican/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pelican/__init__.py b/pelican/__init__.py index 7121318e..5b84685d 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -53,8 +53,10 @@ class Pelican(object): for plugin in self.plugins: # if it's a string, then import it if isinstance(plugin, str): + log.debug("Loading plugin `{0}' ...".format(plugin)) plugin = __import__(plugin, globals(), locals(), 'module') + log.debug("Registering plugin `{0}' ...".format(plugin.__name__)) plugin.register() def run(self): From c522ce7fbcb37a8ca141c6b2604ba85bfef00125 Mon Sep 17 00:00:00 2001 From: Skami18 Date: Sun, 30 Oct 2011 14:14:10 +0100 Subject: [PATCH 040/278] New plugin that provides an ..html:: directive for reStructuredText --- pelican/plugins/html_rst_directive.py | 63 +++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 pelican/plugins/html_rst_directive.py diff --git a/pelican/plugins/html_rst_directive.py b/pelican/plugins/html_rst_directive.py new file mode 100644 index 00000000..d14000a0 --- /dev/null +++ b/pelican/plugins/html_rst_directive.py @@ -0,0 +1,63 @@ +from docutils import nodes +from docutils.parsers.rst import directives, Directive +from pelican import log + +""" +HTML tags for reStructuredText +============================== + +Directives +---------- + +.. html:: + + (HTML code) + + +Example +------- + +A search engine: + +.. html:: +
+ + + +
+ + +A contact form: + +.. html:: + +
+

+ +
+ +
+ +

+
+ +""" + + +class RawHtml(Directive): + required_arguments = 0 + optional_arguments = 0 + final_argument_whitespace = True + has_content = True + + def run(self): + html = u' '.join(self.content) + node = nodes.raw('', html, format='html') + return [node] + + + +def register(): + directives.register_directive('html', RawHtml) + From 229ebbbcbf5f6ccb1b3c193fb992ab0539c4ac1f Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Tue, 20 Mar 2012 01:26:26 +0100 Subject: [PATCH 041/278] plugins branch is planned to be merged for 3.0 --- docs/plugins.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 3bf7c532..f788b32a 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -3,7 +3,7 @@ Plugins ####### -Since version 2.8, pelican manages plugins. Plugins are a way to add feature to +Since version 3.0, pelican manages plugins. Plugins are a way to add feature to pelican without having to directly hack pelican code. Pelican is shipped with a set of core plugins, but you can easily implement From 67f7fcba264eaa122d86286636531247935eca71 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Tue, 20 Mar 2012 01:39:52 +0100 Subject: [PATCH 042/278] remove duplicated pelican-themes entry from the toctree --- docs/index.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 202bdbd9..7dbac168 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -60,7 +60,6 @@ A French version of the documentation is available at :doc:`fr/index`. getting_started settings themes - pelican-themes plugins internals pelican-themes From 7cd4d28bb2e57e0154a3cb8b1546b669abdf715f Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Tue, 20 Mar 2012 23:31:04 +0100 Subject: [PATCH 043/278] better plugins doc --- docs/plugins.rst | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index f788b32a..db5a4bfc 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -3,17 +3,18 @@ Plugins ####### -Since version 3.0, pelican manages plugins. Plugins are a way to add feature to -pelican without having to directly hack pelican code. +Since version 3.0, pelican manages plugins. Plugins are a way to add features +to pelican without having to directly hack pelican code. Pelican is shipped with a set of core plugins, but you can easily implement -your own (and this page describes how) +your own (and this page describes how). How to use plugins? ==================== -To load plugins, you have to specify a them in your settings file. You have two -ways to do so: by specifying strings with the path to the callables: :: +To load plugins, you have to specify them in your settings file. You have two +ways to do so. +Either by specifying strings with the path to the callables:: PLUGINS = ['pelican.plugins.gravatar',] @@ -76,28 +77,18 @@ Translation ----------- Github Activity -_______________ +--------------- -This plugins introduces a new depencency, you have to install feedparser -if you want to use it, these are some ways to do it:: +This plugin makes use of the ``feedparser`` library that you'll need to +install. - apt-get install python-feedparser # on debian based distributions like ubuntu - sudo easy_install feedparser - sudo pip install feedparser - -To enable it set in your pelican config file the GITHUB_ACTIVITY_FEED -parameter pointing to your github activity feed. - -for example my personal activity feed is:: - - https://github.com/kpanic.atom - -and the config line could be:: +Set the GITHUB_ACTIVITY_FEED parameter to your github activity feed. +For example, my setting would look like:: GITHUB_ACTIVITY_FEED = 'https://github.com/kpanic.atom' -in your template just write a for in jinja2 syntax against the -github_activity variable, like for example:: +On the templates side, you just have to iterate over the ``github_activity`` +variable, as in the example:: {% if GITHUB_ACTIVITY_FEED %} diff --git a/tests/output/custom/categories.html b/tests/output/custom/categories.html index a1a44e5b..92830754 100644 --- a/tests/output/custom/categories.html +++ b/tests/output/custom/categories.html @@ -39,27 +39,27 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • +
    diff --git a/tests/output/custom/category/bar.html b/tests/output/custom/category/bar.html index 809a2bdf..53af38da 100644 --- a/tests/output/custom/category/bar.html +++ b/tests/output/custom/category/bar.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/category/cat1.html b/tests/output/custom/category/cat1.html index fa6c6556..94bb74a7 100644 --- a/tests/output/custom/category/cat1.html +++ b/tests/output/custom/category/cat1.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/category/content.html b/tests/output/custom/category/content.html index 16651436..7645d430 100644 --- a/tests/output/custom/category/content.html +++ b/tests/output/custom/category/content.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/category/yeah.html b/tests/output/custom/category/yeah.html index 3c9af4e2..dc20affb 100644 --- a/tests/output/custom/category/yeah.html +++ b/tests/output/custom/category/yeah.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/drafts/a-draft-article.html b/tests/output/custom/drafts/a-draft-article.html index 99f5ad68..e12e5bd7 100644 --- a/tests/output/custom/drafts/a-draft-article.html +++ b/tests/output/custom/drafts/a-draft-article.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/feeds/all-en.atom.xml b/tests/output/custom/feeds/all-en.atom.xml index 7356cb17..1b18c1bd 100644 --- a/tests/output/custom/feeds/all-en.atom.xml +++ b/tests/output/custom/feeds/all-en.atom.xml @@ -1,9 +1,9 @@ -Alexis' loghttp://blog.notmyidea.org2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-3.html<p>Article 3</p> -This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> +This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> +Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/all-fr.atom.xml b/tests/output/custom/feeds/all-fr.atom.xml index 27949d80..1d42bb6e 100644 --- a/tests/output/custom/feeds/all-fr.atom.xml +++ b/tests/output/custom/feeds/all-fr.atom.xml @@ -1,4 +1,4 @@ -Alexis' loghttp://blog.notmyidea.org2012-03-02T14:01:01+01:00Trop bien !2012-03-02T14:01:01+01:00Alexis Métaireauhttp://blog.notmyidea.org/oh-yeah-fr.html<p>Et voila du contenu en français</p> -Deuxième article2012-02-29T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/second-article-fr.html<p>Ceci est un article, en français.</p> +Alexis' loghttp://blog.notmyidea.org/2012-03-02T14:01:01+01:00Trop bien !2012-03-02T14:01:01+01:00Alexis Métaireautag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> +Deuxième article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/all.atom.xml b/tests/output/custom/feeds/all.atom.xml index ef6dbf52..9090f431 100644 --- a/tests/output/custom/feeds/all.atom.xml +++ b/tests/output/custom/feeds/all.atom.xml @@ -1,9 +1,9 @@ -Alexis' loghttp://blog.notmyidea.org2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-3.html<p>Article 3</p> -This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> +This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> +Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/all.rss.xml b/tests/output/custom/feeds/all.rss.xml index a3f7eff9..b726e2d1 100644 --- a/tests/output/custom/feeds/all.rss.xml +++ b/tests/output/custom/feeds/all.rss.xml @@ -1,9 +1,9 @@ -Alexis' loghttp://blog.notmyidea.orgWed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> -Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100http://blog.notmyidea.org/second-article.htmlfoobarbazA markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200http://blog.notmyidea.org/a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.org/article-1.html<p>Article 1</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-1.htmlArticle 2http://blog.notmyidea.org/article-2.html<p>Article 2</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-2.htmlArticle 3http://blog.notmyidea.org/article-3.html<p>Article 3</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-3.htmlThis is a super article !http://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.orgsecond-article.html<p>This is some article, in english</p> +Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazA markdown powered articlehttp://blog.notmyidea.orga-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.orgarticle-1.html<p>Article 1</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-1.htmlArticle 2http://blog.notmyidea.orgarticle-2.html<p>Article 2</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-2.htmlArticle 3http://blog.notmyidea.orgarticle-3.html<p>Article 3</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-3.htmlThis is a super article !http://blog.notmyidea.orgthis-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -15,11 +15,11 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Alexis MétaireauThu, 02 Dec 2010 10:14:00 +0100http://blog.notmyidea.org/this-is-a-super-article.htmlfoobarfoobarOh yeah !http://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> +Alexis MétaireauThu, 02 Dec 2010 10:14:00 +0100tag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.htmlfoobarfoobarOh yeah !http://blog.notmyidea.orgoh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200http://blog.notmyidea.org/oh-yeah.htmlohbaryeahUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> -Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200http://blog.notmyidea.org/unbelievable.html \ No newline at end of file +Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200tag:blog.notmyidea.org,2010-10-20:oh-yeah.htmlohbaryeahUnbelievable !http://blog.notmyidea.orgunbelievable.html<p>Or completely awesome. Depends the needs.</p> +Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.html \ No newline at end of file diff --git a/tests/output/custom/feeds/bar.atom.xml b/tests/output/custom/feeds/bar.atom.xml index 84ac9cda..93961545 100644 --- a/tests/output/custom/feeds/bar.atom.xml +++ b/tests/output/custom/feeds/bar.atom.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org2010-10-20T10:14:00+02:00Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> +Alexis' loghttp://blog.notmyidea.org/2010-10-20T10:14:00+02:00Oh yeah !2010-10-20T10:14:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-20:oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> diff --git a/tests/output/custom/feeds/bar.rss.xml b/tests/output/custom/feeds/bar.rss.xml index bb5cb2b4..0a9d0f9d 100644 --- a/tests/output/custom/feeds/bar.rss.xml +++ b/tests/output/custom/feeds/bar.rss.xml @@ -1,8 +1,8 @@ -Alexis' loghttp://blog.notmyidea.orgWed, 20 Oct 2010 10:14:00 +0200Oh yeah !http://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> +Alexis' loghttp://blog.notmyidea.org/Wed, 20 Oct 2010 10:14:00 +0200Oh yeah !http://blog.notmyidea.orgoh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200http://blog.notmyidea.org/oh-yeah.htmlohbaryeah \ No newline at end of file +Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200tag:blog.notmyidea.org,2010-10-20:oh-yeah.htmlohbaryeah \ No newline at end of file diff --git a/tests/output/custom/feeds/cat1.atom.xml b/tests/output/custom/feeds/cat1.atom.xml index e0f01780..4fce560d 100644 --- a/tests/output/custom/feeds/cat1.atom.xml +++ b/tests/output/custom/feeds/cat1.atom.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org2011-04-20T00:00:00+02:00A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/article-3.html<p>Article 3</p> +Alexis' loghttp://blog.notmyidea.org/2011-04-20T00:00:00+02:00A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/cat1.rss.xml b/tests/output/custom/feeds/cat1.rss.xml index 0043b2fb..d322572b 100644 --- a/tests/output/custom/feeds/cat1.rss.xml +++ b/tests/output/custom/feeds/cat1.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.orgWed, 20 Apr 2011 00:00:00 +0200A markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200http://blog.notmyidea.org/a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.org/article-1.html<p>Article 1</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-1.htmlArticle 2http://blog.notmyidea.org/article-2.html<p>Article 2</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-2.htmlArticle 3http://blog.notmyidea.org/article-3.html<p>Article 3</p> -Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100http://blog.notmyidea.org/article-3.html \ No newline at end of file +Alexis' loghttp://blog.notmyidea.org/Wed, 20 Apr 2011 00:00:00 +0200A markdown powered articlehttp://blog.notmyidea.orga-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.orgarticle-1.html<p>Article 1</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-1.htmlArticle 2http://blog.notmyidea.orgarticle-2.html<p>Article 2</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-2.htmlArticle 3http://blog.notmyidea.orgarticle-3.html<p>Article 3</p> +Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-3.html \ No newline at end of file diff --git a/tests/output/custom/feeds/content.atom.xml b/tests/output/custom/feeds/content.atom.xml index c141a0aa..6f93c8f4 100644 --- a/tests/output/custom/feeds/content.atom.xml +++ b/tests/output/custom/feeds/content.atom.xml @@ -1,4 +1,4 @@ -Alexis' loghttp://blog.notmyidea.org2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> -Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireauhttp://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/content.rss.xml b/tests/output/custom/feeds/content.rss.xml index 9f36c97e..74a322e7 100644 --- a/tests/output/custom/feeds/content.rss.xml +++ b/tests/output/custom/feeds/content.rss.xml @@ -1,4 +1,4 @@ -Alexis' loghttp://blog.notmyidea.orgWed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> -Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100http://blog.notmyidea.org/second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> -Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200http://blog.notmyidea.org/unbelievable.html \ No newline at end of file +Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.orgsecond-article.html<p>This is some article, in english</p> +Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.orgunbelievable.html<p>Or completely awesome. Depends the needs.</p> +Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.html \ No newline at end of file diff --git a/tests/output/custom/feeds/yeah.atom.xml b/tests/output/custom/feeds/yeah.atom.xml index 4c6eed49..9a95fa03 100644 --- a/tests/output/custom/feeds/yeah.atom.xml +++ b/tests/output/custom/feeds/yeah.atom.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org2010-12-02T10:14:00+01:00This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireauhttp://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/2010-12-02T10:14:00+01:00This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> diff --git a/tests/output/custom/feeds/yeah.rss.xml b/tests/output/custom/feeds/yeah.rss.xml index c4f5512e..1c5884a2 100644 --- a/tests/output/custom/feeds/yeah.rss.xml +++ b/tests/output/custom/feeds/yeah.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.orgThu, 02 Dec 2010 10:14:00 +0100This is a super article !http://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/Thu, 02 Dec 2010 10:14:00 +0100This is a super article !http://blog.notmyidea.orgthis-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> @@ -11,4 +11,4 @@ </pre> <p>→ And now try with some utf8 hell: ééé</p> </div> -Alexis MétaireauThu, 02 Dec 2010 10:14:00 +0100http://blog.notmyidea.org/this-is-a-super-article.htmlfoobarfoobar \ No newline at end of file +Alexis MétaireauThu, 02 Dec 2010 10:14:00 +0100tag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.htmlfoobarfoobar \ No newline at end of file diff --git a/tests/output/custom/index.html b/tests/output/custom/index.html index 466a4db4..ae77c625 100644 --- a/tests/output/custom/index.html +++ b/tests/output/custom/index.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + diff --git a/tests/output/custom/index2.html b/tests/output/custom/index2.html index 9262d717..797217ad 100644 --- a/tests/output/custom/index2.html +++ b/tests/output/custom/index2.html @@ -39,14 +39,14 @@ -
  • cat1
  • - -
  • bar
  • -
  • yeah
  • content
  • +
  • cat1
  • + +
  • bar
  • + @@ -115,8 +115,9 @@ - Multi-line metadata should be supported -as well as inline markup. +

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

    + read more

    There are comments.

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

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

    + read more

    There are comments.

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

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

    + read more

    There are comments.

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

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

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

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

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

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

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

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

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

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

      In cat1.

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

      In cat1.

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

      In cat1.

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

      In cat1.

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

      In cat1.

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

      In cat1.

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

      In cat1.

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

      In cat1.

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

      In content.

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

      In content.

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

      In cat1.

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

      In cat1.

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

      In cat1.

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

      In cat1.

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

      In content.

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

      In content.

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

      In content.

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

      In content.

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

      In cat1.

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

      In cat1.

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

      In cat1.

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

      In cat1.

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

      - By bruno + By Dummy Author

      In content.

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

      In content.

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

      In content.

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

      In content.

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

      In content.

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

      In content.

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

      In content.

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

      In content.

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

      In content.

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

      In content.

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

      In content.

      From 03fdefb158cd495c960c6637bf7f7deb99a9f1de Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 4 Apr 2012 23:18:11 +0200 Subject: [PATCH 054/278] add instructions to regenerate the output of functional tests --- docs/contribute.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/contribute.rst b/docs/contribute.rst index fcf8d5c0..e33f8ab4 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -39,6 +39,14 @@ The tests live in "pelican/tests" and you can run them using the $ unit2 discover +If you have made changes that affect the output of a pelican generated weblog, +then you should update the output used by functional tests. +To do so, you can use the 2 following commands:: + + $ pelican -o tests/output/custom/ -s samples/pelican.conf.py \ + samples/content/ + $ pelican -o tests/output/basic/ samples/content/ + Coding standards ================ From cfebb37c6464d42432da0694eb6665004b7efedb Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Apr 2012 06:47:15 +0200 Subject: [PATCH 055/278] fix command to regenerate the output of basic functional test the command needs to be prefixed by USER="Dummy Author" which is the author name value mocked in the corresponding functional test. --- docs/contribute.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contribute.rst b/docs/contribute.rst index e33f8ab4..3960b3f9 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -45,7 +45,7 @@ To do so, you can use the 2 following commands:: $ pelican -o tests/output/custom/ -s samples/pelican.conf.py \ samples/content/ - $ pelican -o tests/output/basic/ samples/content/ + $ USER="Dummy Author" pelican -o tests/output/basic/ samples/content/ Coding standards ================ From 1efda9eb74701ca2e56f082327f1970da154ce33 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Mon, 23 Apr 2012 23:29:00 +0200 Subject: [PATCH 056/278] test that categories are ordered as expected --- tests/test_generators.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_generators.py b/tests/test_generators.py index bc5c8b73..dd27d97f 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -46,3 +46,7 @@ class TestArticlesGenerator(unittest.TestCase): elif relfilepath == "article_without_category.rst": self.assertEquals(article.category.name, 'Default') + categories = [cat.name for cat, _ in generator.categories] + # assert that the categories are ordered as expected + self.assertEquals( + categories, ['Default', 'TestCategory', 'Yeah', 'yeah']) From a6788f83c2304bd5e551cb9e8dd2daf998e5c48b Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 7 May 2012 17:11:57 +0200 Subject: [PATCH 057/278] integrate webassets --- pelican/__init__.py | 5 ++++- pelican/generators.py | 21 +++++++++++++++++---- pelican/settings.py | 9 +++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 6b3d12fb..97e21ccd 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -126,12 +126,15 @@ class Pelican(object): writer = self.get_writer() + generators[1].env.assets_environment = generators[0].assets_env + generators[2].env.assets_environment = generators[0].assets_env + for p in generators: if hasattr(p, 'generate_output'): p.generate_output(writer) def get_generator_classes(self): - generators = [ArticlesGenerator, PagesGenerator, StaticGenerator] + generators = [StaticGenerator, ArticlesGenerator, PagesGenerator] 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 9647d397..00701116 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -42,7 +42,7 @@ class Generator(object): simple_loader = FileSystemLoader(os.path.join(theme_path, "themes", "simple", "templates")) - self._env = Environment( + self.env = Environment( loader=ChoiceLoader([ FileSystemLoader(self._templates_path), simple_loader, # implicit inheritance @@ -51,11 +51,11 @@ class Generator(object): extensions=self.settings.get('JINJA_EXTENSIONS', []), ) - logger.debug('template list: {0}'.format(self._env.list_templates())) + logger.debug('template list: {0}'.format(self.env.list_templates())) # get custom Jinja filters from user settings custom_filters = self.settings.get('JINJA_FILTERS', {}) - self._env.filters.update(custom_filters) + self.env.filters.update(custom_filters) def get_template(self, name): """Return the template by name. @@ -64,7 +64,7 @@ class Generator(object): """ if name not in self._templates: try: - self._templates[name] = self._env.get_template(name + '.html') + self._templates[name] = self.env.get_template(name + '.html') except TemplateNotFound: raise Exception('[templates] unable to load %s.html from %s' \ % (name, self._templates_path)) @@ -364,7 +364,20 @@ class StaticGenerator(Generator): copy(path, source, os.path.join(output_path, destination), final_path, overwrite=True) + def generate_context(self): + + if self.settings['WEBASSETS']: + from webassets import Environment as AssetsEnvironment + + assets_url = self.settings['SITEURL'] + '/theme/' + assets_src = os.path.join(self.output_path, 'theme') + self.assets_env = AssetsEnvironment(assets_src, assets_url) + + if logging.getLevelName(logger.getEffectiveLevel()) == "DEBUG": + self.assets_env.debug = True + def generate_output(self, writer): + self._copy_paths(self.settings['STATIC_PATHS'], self.path, 'static', self.output_path) self._copy_paths(self.settings['THEME_STATIC_PATHS'], self.theme, diff --git a/pelican/settings.py b/pelican/settings.py index 4da66989..647d3e93 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -68,6 +68,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'ARTICLE_PERMALINK_STRUCTURE': '', 'TYPOGRIFY': False, 'LESS_GENERATOR': False, + 'WEBASSETS': False, } @@ -150,4 +151,12 @@ def configure_settings(settings, default_settings=None, filename=None): "http://docs.notmyidea.org/alexis/pelican/settings.html#timezone " "for more information") + if settings['WEBASSETS']: + try: + from webassets.ext.jinja2 import AssetsExtension + settings['JINJA_EXTENSIONS'].append(AssetsExtension) + except ImportError: + logger.warn("You must install the webassets module to use WEBASSETS.") + settings['WEBASSETS'] = False + return settings From 252d00834fe81f9954df4ebc78b26edb0dbea2a2 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 7 May 2012 13:05:33 +0200 Subject: [PATCH 058/278] strip tags for feed titles --- pelican/writers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pelican/writers.py b/pelican/writers.py index 593879e2..75971ee9 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -8,8 +8,8 @@ import logging from codecs import open from functools import partial - from feedgenerator import Atom1Feed, Rss201rev2Feed +from jinja2 import Markup from pelican.paginator import Paginator from pelican.utils import get_relative_path, set_date_tzinfo @@ -25,8 +25,9 @@ class Writer(object): def _create_new_feed(self, feed_type, context): feed_class = Rss201rev2Feed if feed_type == 'rss' else Atom1Feed + sitename = Markup(context['SITENAME']).striptags() feed = feed_class( - title=context['SITENAME'], + title=sitename, link=(self.site_url + '/'), feed_url=self.feed_url, description=context.get('SITESUBTITLE', '')) @@ -34,8 +35,9 @@ class Writer(object): def _add_item_to_the_feed(self, feed, item): + title = Markup(item.title).striptags() feed.add_item( - title=item.title, + title=title, link='%s/%s' % (self.site_url, item.url), unique_id='tag:%s,%s:%s' % (self.site_url.replace('http://', ''), item.date.date(), item.url), From ec707930ce247f762d7c1a580e3ef6ac974cb0de Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 7 May 2012 17:11:57 +0200 Subject: [PATCH 059/278] integrate webassets --- pelican/__init__.py | 5 ++++- pelican/generators.py | 21 +++++++++++++++++---- pelican/settings.py | 9 +++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 6b3d12fb..97e21ccd 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -126,12 +126,15 @@ class Pelican(object): writer = self.get_writer() + generators[1].env.assets_environment = generators[0].assets_env + generators[2].env.assets_environment = generators[0].assets_env + for p in generators: if hasattr(p, 'generate_output'): p.generate_output(writer) def get_generator_classes(self): - generators = [ArticlesGenerator, PagesGenerator, StaticGenerator] + generators = [StaticGenerator, ArticlesGenerator, PagesGenerator] 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 9647d397..00701116 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -42,7 +42,7 @@ class Generator(object): simple_loader = FileSystemLoader(os.path.join(theme_path, "themes", "simple", "templates")) - self._env = Environment( + self.env = Environment( loader=ChoiceLoader([ FileSystemLoader(self._templates_path), simple_loader, # implicit inheritance @@ -51,11 +51,11 @@ class Generator(object): extensions=self.settings.get('JINJA_EXTENSIONS', []), ) - logger.debug('template list: {0}'.format(self._env.list_templates())) + logger.debug('template list: {0}'.format(self.env.list_templates())) # get custom Jinja filters from user settings custom_filters = self.settings.get('JINJA_FILTERS', {}) - self._env.filters.update(custom_filters) + self.env.filters.update(custom_filters) def get_template(self, name): """Return the template by name. @@ -64,7 +64,7 @@ class Generator(object): """ if name not in self._templates: try: - self._templates[name] = self._env.get_template(name + '.html') + self._templates[name] = self.env.get_template(name + '.html') except TemplateNotFound: raise Exception('[templates] unable to load %s.html from %s' \ % (name, self._templates_path)) @@ -364,7 +364,20 @@ class StaticGenerator(Generator): copy(path, source, os.path.join(output_path, destination), final_path, overwrite=True) + def generate_context(self): + + if self.settings['WEBASSETS']: + from webassets import Environment as AssetsEnvironment + + assets_url = self.settings['SITEURL'] + '/theme/' + assets_src = os.path.join(self.output_path, 'theme') + self.assets_env = AssetsEnvironment(assets_src, assets_url) + + if logging.getLevelName(logger.getEffectiveLevel()) == "DEBUG": + self.assets_env.debug = True + def generate_output(self, writer): + self._copy_paths(self.settings['STATIC_PATHS'], self.path, 'static', self.output_path) self._copy_paths(self.settings['THEME_STATIC_PATHS'], self.theme, diff --git a/pelican/settings.py b/pelican/settings.py index 4da66989..647d3e93 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -68,6 +68,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'ARTICLE_PERMALINK_STRUCTURE': '', 'TYPOGRIFY': False, 'LESS_GENERATOR': False, + 'WEBASSETS': False, } @@ -150,4 +151,12 @@ def configure_settings(settings, default_settings=None, filename=None): "http://docs.notmyidea.org/alexis/pelican/settings.html#timezone " "for more information") + if settings['WEBASSETS']: + try: + from webassets.ext.jinja2 import AssetsExtension + settings['JINJA_EXTENSIONS'].append(AssetsExtension) + except ImportError: + logger.warn("You must install the webassets module to use WEBASSETS.") + settings['WEBASSETS'] = False + return settings From e6448567a0a98d9c005c1ab955c45a657b814428 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 11 May 2012 22:19:03 +0200 Subject: [PATCH 060/278] add some doc in the code --- pelican/__init__.py | 6 ++++-- pelican/generators.py | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 97e21ccd..7e546b29 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -126,8 +126,10 @@ class Pelican(object): writer = self.get_writer() - generators[1].env.assets_environment = generators[0].assets_env - generators[2].env.assets_environment = generators[0].assets_env + # pass the assets environment to the generators + if self.settings['WEBASSETS']: + generators[1].env.assets_environment = generators[0].assets_env + generators[2].env.assets_environment = generators[0].assets_env for p in generators: if hasattr(p, 'generate_output'): diff --git a/pelican/generators.py b/pelican/generators.py index 30a463b4..f15db15d 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -394,6 +394,9 @@ class StaticGenerator(Generator): if self.settings['WEBASSETS']: from webassets import Environment as AssetsEnvironment + # Define the assets environment that will be passed to the + # generators. The StaticGenerator must then be run first to have + # the assets in the output_path before generating the templates. assets_url = self.settings['SITEURL'] + '/theme/' assets_src = os.path.join(self.output_path, 'theme') self.assets_env = AssetsEnvironment(assets_src, assets_url) From b7e6d3d98d0a131e1cd93eb95a586fd1ec3d7da5 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 12 May 2012 01:07:17 +0200 Subject: [PATCH 061/278] update functional tests output --- .../basic/a-markdown-powered-article.html | 27 +++++---- tests/output/basic/archives.html | 16 +++--- tests/output/basic/article-1.html | 27 +++++---- tests/output/basic/article-2.html | 27 +++++---- tests/output/basic/article-3.html | 27 +++++---- tests/output/basic/categories.html | 8 +-- .../output/basic/drafts/a-draft-article.html | 27 +++++---- tests/output/basic/feeds/all-en.atom.xml | 14 ++--- tests/output/basic/feeds/all-fr.atom.xml | 4 +- tests/output/basic/feeds/all.atom.xml | 14 ++--- tests/output/basic/feeds/bar.atom.xml | 2 +- tests/output/basic/feeds/cat1.atom.xml | 6 +- tests/output/basic/feeds/content.atom.xml | 4 +- tests/output/basic/feeds/yeah.atom.xml | 2 +- tests/output/basic/oh-yeah-fr.html | 27 +++++---- tests/output/basic/oh-yeah.html | 27 +++++---- tests/output/basic/second-article-fr.html | 27 +++++---- tests/output/basic/second-article.html | 27 +++++---- tests/output/basic/theme/css/wide.css | 15 +++-- .../basic/theme/images/icons/facebook.png | Bin 0 -> 300 bytes .../output/basic/this-is-a-super-article.html | 27 +++++---- tests/output/basic/unbelievable.html | 27 +++++---- .../custom/a-markdown-powered-article.html | 53 ++++++++++-------- tests/output/custom/archives.html | 16 +++--- tests/output/custom/article-1.html | 53 ++++++++++-------- tests/output/custom/article-2.html | 53 ++++++++++-------- tests/output/custom/article-3.html | 53 ++++++++++-------- tests/output/custom/categories.html | 8 +-- .../output/custom/drafts/a-draft-article.html | 53 ++++++++++-------- tests/output/custom/feeds/all-en.atom.xml | 14 ++--- tests/output/custom/feeds/all-fr.atom.xml | 4 +- tests/output/custom/feeds/all.atom.xml | 14 ++--- tests/output/custom/feeds/all.rss.xml | 14 ++--- tests/output/custom/feeds/bar.atom.xml | 2 +- tests/output/custom/feeds/bar.rss.xml | 2 +- tests/output/custom/feeds/cat1.atom.xml | 6 +- tests/output/custom/feeds/cat1.rss.xml | 6 +- tests/output/custom/feeds/content.atom.xml | 4 +- tests/output/custom/feeds/content.rss.xml | 4 +- tests/output/custom/feeds/yeah.atom.xml | 2 +- tests/output/custom/feeds/yeah.rss.xml | 2 +- tests/output/custom/oh-yeah-fr.html | 53 ++++++++++-------- tests/output/custom/oh-yeah.html | 53 ++++++++++-------- tests/output/custom/second-article-fr.html | 53 ++++++++++-------- tests/output/custom/second-article.html | 53 ++++++++++-------- tests/output/custom/theme/css/wide.css | 15 +++-- .../custom/theme/images/icons/facebook.png | Bin 0 -> 300 bytes .../custom/this-is-a-super-article.html | 53 ++++++++++-------- tests/output/custom/unbelievable.html | 53 ++++++++++-------- 49 files changed, 599 insertions(+), 479 deletions(-) create mode 100644 tests/output/basic/theme/images/icons/facebook.png create mode 100644 tests/output/custom/theme/images/icons/facebook.png diff --git a/tests/output/basic/a-markdown-powered-article.html b/tests/output/basic/a-markdown-powered-article.html index 9cb92c4b..ceadf79a 100644 --- a/tests/output/basic/a-markdown-powered-article.html +++ b/tests/output/basic/a-markdown-powered-article.html @@ -41,13 +41,18 @@
    - -
    - +
    diff --git a/tests/output/basic/archives.html b/tests/output/basic/archives.html index 9aedb29d..52d00234 100644 --- a/tests/output/basic/archives.html +++ b/tests/output/basic/archives.html @@ -48,28 +48,28 @@
    Fri 15 October 2010
    -
    Unbelievable !
    +
    Unbelievable !
    Wed 20 October 2010
    -
    Oh yeah !
    +
    Oh yeah !
    Thu 02 December 2010
    -
    This is a super article !
    +
    This is a super article !
    Thu 17 February 2011
    -
    Article 1
    +
    Article 1
    Thu 17 February 2011
    -
    Article 2
    +
    Article 2
    Thu 17 February 2011
    -
    Article 3
    +
    Article 3
    Wed 20 April 2011
    -
    A markdown powered article
    +
    A markdown powered article
    Wed 29 February 2012
    -
    Second article
    +
    Second article
    diff --git a/tests/output/basic/article-1.html b/tests/output/basic/article-1.html index 5f1d7c1d..bd6f9716 100644 --- a/tests/output/basic/article-1.html +++ b/tests/output/basic/article-1.html @@ -41,13 +41,18 @@ - -
    -
    -

    Article 1

    -
    -
    + +
    +
    +
    +

    + Article 1

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

    Article 1

    +

    Article 1

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

    Article 2

    -
    -
    + +
    +
    +
    +

    + Article 2

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

    Article 2

    +

    Article 2

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

    Article 3

    -
    -
    + +
    +
    +
    +

    + Article 3

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

    Article 3

    +

    Article 3

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

    A draft article

    -
    -
    + +
    +
    +
    +

    + A draft article

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

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

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

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

    Trop bien !

    -
    -
    + +
    +
    +
    +

    + Trop bien !

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

    Et voila du contenu en français

    +

    Et voila du contenu en français

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

    Oh yeah !

    -
    -
    + +
    +
    +
    +

    + Oh yeah !

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

    Why not ?

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

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

    Deuxième article

    -
    -
    + +
    +
    +
    +

    + Deuxième article

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

    Ceci est un article, en français.

    +

    Ceci est un article, en français.

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

    Second article

    -
    -
    + +
    +
    +
    +

    + Second article

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

    This is some article, in english

    +

    This is some article, in english

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

    This is a super article !

    -
    -
    + +
    +
    +
    +

    + This is a super article !

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

    Some content here !

    +

    Some content here !

    This is a simple title

    And here comes the cool stuff.

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

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

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

    Unbelievable !

    -
    -
    + +
    +
    +
    +

    + Unbelievable !

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

    Or completely awesome. Depends the needs.

    +

    Or completely awesome. Depends the needs.

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

    A markdown powered article

    -
    -
    + +
    +
    +
    +

    + A markdown powered article

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

    You're mutually oblivious.

    -
    - -
    -

    Comments !

    -
    - -
    - +

    You're mutually oblivious.

    +
    + +
    +

    Comments !

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

    Article 1

    -
    -
    + +
    +
    +
    +

    + Article 1

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

    Article 1

    +

    Article 1

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

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

    Article 2

    -
    -
    + +
    +
    +
    +

    + Article 2

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

    Article 2

    +

    Article 2

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

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

    Article 3

    -
    -
    + +
    +
    +
    +

    + Article 3

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

    Article 3

    +

    Article 3

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

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

    A draft article

    -
    -
    + +
    +
    +
    +

    + A draft article

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

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

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

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

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

    Trop bien !

    -
    -
    + +
    +
    +
    +

    + Trop bien !

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

    Et voila du contenu en français

    +

    Et voila du contenu en français

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

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

    Oh yeah !

    -
    -
    + +
    +
    +
    +

    + Oh yeah !

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

    Why not ?

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

    alternate text
    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

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

    Deuxième article

    -
    -
    + +
    +
    +
    +

    + Deuxième article

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

    Ceci est un article, en français.

    +

    Ceci est un article, en français.

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

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

    Second article

    -
    -
    + +
    +
    +
    +

    + Second article

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

    This is some article, in english

    +

    This is some article, in english

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

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

    This is a super article !

    -
    -
    + +
    +
    +
    +

    + This is a super article !

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

    Some content here !

    +

    Some content here !

    This is a simple title

    And here comes the cool stuff.

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

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

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

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

    Unbelievable !

    -
    -
    + +
    +
    +
    +

    + Unbelievable !

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

    Or completely awesome. Depends the needs.

    +

    Or completely awesome. Depends the needs.

    -
    - -
    -

    Comments !

    -
    - -
    - +
    + +
    +

    Comments !

    +
    + +
    + -
    +
    From a8983b420f97379e306c1c5bd93b548b19b042cb Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 12 May 2012 01:30:09 +0200 Subject: [PATCH 062/278] be more verbose when functional tests fail --- tests/test_pelican.py | 48 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 1192dfe1..933c82fa 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -36,9 +36,27 @@ class TestPelican(unittest.TestCase): pelican = Pelican(path=INPUT_PATH, output_path=temp_path) pelican.run() diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "basic"))) - self.assertEqual(diff.left_only, []) - self.assertEqual(diff.right_only, []) - self.assertEqual(diff.diff_files, []) + self.assertEqual(diff.left_only, [], msg="some generated " \ + "files are absent from the expected functional " \ + "tests output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.right_only, [], msg="some files from " \ + "the expected functional tests output are absent " \ + "from the current output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.diff_files, [], msg="some generated " \ + "files differ from the expected functional tests " \ + "output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") def test_custom_generation_works(self): # the same thing with a specified set of settings should work @@ -47,6 +65,24 @@ class TestPelican(unittest.TestCase): settings=read_settings(SAMPLE_CONFIG)) pelican.run() diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "custom"))) - self.assertEqual(diff.left_only, []) - self.assertEqual(diff.right_only, []) - self.assertEqual(diff.diff_files, []) + self.assertEqual(diff.left_only, [], msg="some generated " \ + "files are absent from the expected functional " \ + "tests output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.right_only, [], msg="some files from " \ + "the expected functional tests output are absent " \ + "from the current output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.diff_files, [], msg="some generated " \ + "files differ from the expected functional tests " \ + "output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") From e82c6512b4703b19f5c142d0cd85b67a88e0040d Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 12 May 2012 02:03:18 +0200 Subject: [PATCH 063/278] clean up temporary dirs in tearDown to force cleanup even if tests fail --- tests/support.py | 18 --------- tests/test_generators.py | 47 ++++++++++++++---------- tests/test_pelican.py | 79 +++++++++++++++++++++------------------- 3 files changed, 69 insertions(+), 75 deletions(-) diff --git a/tests/support.py b/tests/support.py index f2b4a075..8b8cbab8 100644 --- a/tests/support.py +++ b/tests/support.py @@ -1,14 +1,10 @@ __all__ = [ - 'temporary_folder', 'get_article', 'unittest', ] import os import subprocess -from contextlib import contextmanager -from tempfile import mkdtemp -from shutil import rmtree from pelican.contents import Article @@ -18,20 +14,6 @@ except ImportError: import unittest -@contextmanager -def temporary_folder(): - """creates a temporary folder, return it and delete it afterwards. - - This allows to do something like this in tests: - - >>> with temporary_folder() as d: - # do whatever you want - """ - tempdir = mkdtemp() - yield tempdir - rmtree(tempdir) - - def get_article(title, slug, content, lang, extra_metadata=None): metadata = {'slug': slug, 'title': title, 'lang': lang} if extra_metadata is not None: diff --git a/tests/test_generators.py b/tests/test_generators.py index e62551fa..4e6b0acf 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -3,10 +3,12 @@ from mock import MagicMock import os import re +from tempfile import mkdtemp +from shutil import rmtree from pelican.generators import ArticlesGenerator, LessCSSGenerator from pelican.settings import _DEFAULT_CONFIG -from .support import unittest, temporary_folder, skipIfNoExecutable +from .support import unittest, skipIfNoExecutable CUR_DIR = os.path.dirname(__file__) @@ -107,6 +109,14 @@ class TestLessCSSGenerator(unittest.TestCase): } """ + def setUp(self): + self.temp_content = mkdtemp() + self.temp_output = mkdtemp() + + def tearDown(self): + rmtree(self.temp_content) + rmtree(self.temp_output) + @skipIfNoExecutable('lessc') def test_less_compiler(self): @@ -114,28 +124,25 @@ class TestLessCSSGenerator(unittest.TestCase): settings['STATIC_PATHS'] = ['static'] settings['LESS_GENERATOR'] = True - # we'll nest here for py < 2.7 compat - with temporary_folder() as temp_content: - with temporary_folder() as temp_output: - generator = LessCSSGenerator(None, settings, temp_content, - _DEFAULT_CONFIG['THEME'], temp_output, None) + generator = LessCSSGenerator(None, settings, self.temp_content, + _DEFAULT_CONFIG['THEME'], self.temp_output, None) - # create a dummy less file - less_dir = os.path.join(temp_content, 'static', 'css') - less_filename = os.path.join(less_dir, 'test.less') + # create a dummy less file + less_dir = os.path.join(self.temp_content, 'static', 'css') + less_filename = os.path.join(less_dir, 'test.less') - less_output = os.path.join(temp_output, 'static', 'css', - 'test.css') + less_output = os.path.join(self.temp_output, 'static', 'css', + 'test.css') - os.makedirs(less_dir) - with open(less_filename, 'w') as less_file: - less_file.write(self.LESS_CONTENT) + os.makedirs(less_dir) + with open(less_filename, 'w') as less_file: + less_file.write(self.LESS_CONTENT) - generator.generate_output() + generator.generate_output() - # we have the file ? - self.assertTrue(os.path.exists(less_output)) + # we have the file ? + self.assertTrue(os.path.exists(less_output)) - # was it compiled ? - self.assertIsNotNone(re.search(r'^\s+color:\s*#4D926F;$', - open(less_output).read(), re.MULTILINE | re.IGNORECASE)) + # was it compiled ? + self.assertIsNotNone(re.search(r'^\s+color:\s*#4D926F;$', + open(less_output).read(), re.MULTILINE | re.IGNORECASE)) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 933c82fa..a331690b 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -5,11 +5,11 @@ except ImportError: import os from filecmp import dircmp +from tempfile import mkdtemp +from shutil import rmtree from mock import patch -from .support import temporary_folder - from pelican import Pelican from pelican.settings import read_settings @@ -25,46 +25,23 @@ class TestPelican(unittest.TestCase): # general functional testing for pelican. Basically, this test case tries # to run pelican in different situations and see how it behaves + def setUp(self): + self.temp_path = mkdtemp() + + def tearDown(self): + rmtree(self.temp_path) + def test_basic_generation_works(self): # when running pelican without settings, it should pick up the default # ones and generate the output without raising any exception / issuing # any warning. - with temporary_folder() as temp_path: - with patch("pelican.contents.getenv") as mock_getenv: - # force getenv('USER') to always return the same value - mock_getenv.return_value = "Dummy Author" - pelican = Pelican(path=INPUT_PATH, output_path=temp_path) - pelican.run() - diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "basic"))) - self.assertEqual(diff.left_only, [], msg="some generated " \ - "files are absent from the expected functional " \ - "tests output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") - self.assertEqual(diff.right_only, [], msg="some files from " \ - "the expected functional tests output are absent " \ - "from the current output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") - self.assertEqual(diff.diff_files, [], msg="some generated " \ - "files differ from the expected functional tests " \ - "output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") - - def test_custom_generation_works(self): - # the same thing with a specified set of settings should work - with temporary_folder() as temp_path: - pelican = Pelican(path=INPUT_PATH, output_path=temp_path, - settings=read_settings(SAMPLE_CONFIG)) + with patch("pelican.contents.getenv") as mock_getenv: + # force getenv('USER') to always return the same value + mock_getenv.return_value = "Dummy Author" + pelican = Pelican(path=INPUT_PATH, output_path=self.temp_path) pelican.run() - diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "custom"))) + diff = dircmp( + self.temp_path, os.sep.join((OUTPUT_PATH, "basic"))) self.assertEqual(diff.left_only, [], msg="some generated " \ "files are absent from the expected functional " \ "tests output.\n" \ @@ -86,3 +63,31 @@ class TestPelican(unittest.TestCase): "changed. If these changes are normal, please refer " \ "to docs/contribute.rst to update the expected " \ "output of the functional tests.") + + def test_custom_generation_works(self): + # the same thing with a specified set of settings should work + pelican = Pelican(path=INPUT_PATH, output_path=self.temp_path, + settings=read_settings(SAMPLE_CONFIG)) + pelican.run() + diff = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "custom"))) + self.assertEqual(diff.left_only, [], msg="some generated " \ + "files are absent from the expected functional " \ + "tests output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.right_only, [], msg="some files from " \ + "the expected functional tests output are absent " \ + "from the current output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") + self.assertEqual(diff.diff_files, [], msg="some generated " \ + "files differ from the expected functional tests " \ + "output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests.") From 0444513e90ae987cc6b6948742e0225315a20213 Mon Sep 17 00:00:00 2001 From: m-r-r Date: Sat, 12 May 2012 11:49:49 +0200 Subject: [PATCH 064/278] Trailing slashes removed to avoid category bug --- pelican/generators.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index ede948a4..24920450 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -245,7 +245,9 @@ class ArticlesGenerator(Generator): def generate_context(self): """change the context""" - article_path = os.path.join(self.path, self.settings['ARTICLE_DIR']) + 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, @@ -259,8 +261,8 @@ class ArticlesGenerator(Generator): # if no category is set, use the name of the path as a category if 'category' not in metadata: - if os.path.dirname(f) == article_path: - category = self.settings['DEFAULT_CATEGORY'] + if os.path.dirname(f) == article_path: # if the article is not in a subdirectory + category = self.settings['DEFAULT_CATEGORY'] else: category = os.path.basename(os.path.dirname(f))\ .decode('utf-8') From fed8e8b331668963d6d5f944211490541274eace Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 12 May 2012 23:48:57 +0200 Subject: [PATCH 065/278] documentation for webassets --- docs/settings.rst | 54 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index 85e9f0c3..582cd9d4 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -369,6 +369,7 @@ Setting name (default value) What does it do? value is `static`, but if your theme has other static paths, you can put them here. `CSS_FILE` (``'main.css'``) Specify the CSS file you want to load. +`WEBASSETS` (``False``) Asset management with `webassets` (see below) ================================================ ===================================================== By default, two themes are available. You can specify them using the `-t` option: @@ -418,7 +419,58 @@ adding the following to your configuration:: CSS_FILE = "wide.css" -.. _pelican-themes: :doc:`pelican-themes` +Asset management +---------------- + +The `WEBASSETS` setting allows to use the `webassets`_ module to manage assets +(css, js). The module must first be installed:: + + pip install webassets + +`webassets` allows to concatenate your assets and to use almost all of the +hype tools of the moment (see the `documentation`_): + +* css minifier (`cssmin`, `yuicompressor`, ...) +* css compiler (`less`, `sass`, ...) +* js minifier (`uglifyjs`, `yuicompressor`, `closure`, ...) + +Others filters include gzip compression, integration of images in css with +`datauri` and more. Webassets also append a version identifier to your asset +url to convince browsers to download new versions of your assets when you use +far future expires headers. + +When using it with Pelican, `webassets` is configured to process assets in the +``OUTPUT_PATH/theme`` directory. You can use it in your templates with a +template tag, for example: + +.. code-block:: jinja + + {% assets filters="cssmin", output="css/style.min.css", "css/inuit.css", "css/pygment-monokai.css", "css/main.css" %} + + {% endassets %} + +will produce a minified css file with the version identifier: + +.. code-block:: html + + + +Another example for javascript: + +.. code-block:: jinja + + {% assets filters="uglifyjs,gzip", output="js/packed.js", "js/jquery.js", "js/base.js", "js/widgets.js" %} + + {% endassets %} + +will produce a minified and gzipped js file: + +.. code-block:: html + + + +.. _webassets: https://github.com/miracle2k/webassets +.. _documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html Example settings ================ From ba8ed9fb1806e5f45f30237a13f472034f6b6697 Mon Sep 17 00:00:00 2001 From: sam Date: Sun, 13 May 2012 23:37:33 +0200 Subject: [PATCH 066/278] Added strip raw option to wordpress xml importer --- pelican/tools/pelican_import.py | 27 +- tests/content/wordpressexport.xml | 578 ++++++++++++++++++++++++++++++ tests/support.py | 88 ++++- tests/test_importer.py | 43 +++ 4 files changed, 728 insertions(+), 8 deletions(-) create mode 100644 tests/content/wordpressexport.xml create mode 100644 tests/test_importer.py diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 050b1010..f3e9bb48 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -25,8 +25,14 @@ def wp2fields(xml): items = soup.rss.channel.findAll('item') for item in items: + if item.fetch('wp:status')[0].contents[0] == "publish": - title = item.title.contents[0] + + try: + title = item.title.contents[0] + except IndexError: + continue + content = item.fetch('content:encoded')[0].contents[0] filename = item.fetch('wp:post_name')[0].contents[0] @@ -197,7 +203,7 @@ def build_markdown_header(title, date, author, categories, tags): header += '\n' return header -def fields2pelican(fields, out_markup, output_path, dircat=False): +def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=False): for title, content, filename, date, author, categories, tags, in_markup in fields: if (in_markup == "markdown") or (out_markup == "markdown") : ext = '.md' @@ -230,10 +236,13 @@ def fields2pelican(fields, out_markup, output_path, dircat=False): paragraphs = [u'

    {}

    '.format(p) for p in paragraphs] new_content = ''.join(paragraphs) - fp.write(content) + fp.write(new_content) - cmd = 'pandoc --normalize --reference-links --from=html --to={0} -o "{1}" "{2}"'.format( - out_markup, out_filename, html_filename) + + parse_raw = '--parse-raw' if not strip_raw else '' + cmd = ('pandoc --normalize --reference-links {0} --from=html' + ' --to={1} -o "{2}" "{3}"').format( + parse_raw, out_markup, out_filename, html_filename) try: rc = subprocess.call(cmd, shell=True) @@ -279,6 +288,10 @@ def main(): help='Output markup format (supports rst & markdown)') parser.add_argument('--dir-cat', action='store_true', dest='dircat', help='Put files in directories with categories name') + parser.add_argument('--strip-raw', action='store_true', dest='strip_raw', + help="Strip raw HTML code that can't be converted to " + "markup such as flash embeds or iframes (wordpress import only)") + args = parser.parse_args() input_type = None @@ -306,4 +319,6 @@ def main(): elif input_type == 'feed': fields = feed2fields(args.input) - fields2pelican(fields, args.markup, args.output, dircat=args.dircat or False) + fields2pelican(fields, args.markup, args.output, + dircat=args.dircat or False, + strip_raw=args.strip_raw or False) diff --git a/tests/content/wordpressexport.xml b/tests/content/wordpressexport.xml new file mode 100644 index 00000000..d3e86cba --- /dev/null +++ b/tests/content/wordpressexport.xml @@ -0,0 +1,578 @@ + + + + + + + + + + + + + + + + + + + + + + + Pelican test channel + http://thisisa.test + Not a real feed, just for test + Sun, 13 May 2012 01:13:52 +0000 + en + 1.1 + http://thisisa.test + http://thisisa.test + + 2Bobbob@thisisa.test + 3Jonhjonh@thisisa.test + + 7categ-1 + 11categ-2 + 1uncategorized + 15categ-3 + 25tag-1 + 122tag2 + 68tag-3 + + http://wordpress.org/?v=3.3.1 + + + Empty post + http://thisisa.test/?attachment_id=24 + Sat, 04 Feb 2012 03:17:33 +0000 + bob + https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Pelican_lakes_entrance02.jpg/240px-Pelican_lakes_entrance02.jpg + + + + 24 + 2012-02-04 03:17:33 + 2012-02-04 03:17:33 + open + open + empty-post + inherit + 0 + 0 + attachment + + 0 + https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Pelican_lakes_entrance02.jpg/240px-Pelican_lakes_entrance02.jpg + + _wp_attachment_metadata + + + + _wp_attached_file + + + + _wp_attachment_image_alt + + + + + + http://thisisa.test/?p=168 + Thu, 01 Jan 1970 00:00:00 +0000 + bob + http://thisisa.test/?p=168 + + + + 168 + 2012-02-15 21:23:57 + 0000-00-00 00:00:00 + open + open + + draft + 0 + 0 + post + + 0 + + + _edit_last + + + + + A normal post + http://thisisa.test/?p=173 + Thu, 01 Jan 1970 00:00:00 +0000 + bob + http://thisisa.test/?p=173 + + +
  • Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, +quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo +consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse +cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non +proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  • +
  • Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, +quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo +consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse +cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non +proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  • + + +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, +quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo +consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse +cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non +proident, sunt in culpa qui officia deserunt mollit anim id est laborum.]]>
    + + 173 + 2012-02-16 15:52:55 + 0000-00-00 00:00:00 + open + open + + draft + 0 + 0 + post + + 0 + + + _edit_last + + +
    + + Complete draft + http://thisisa.test/?p=176 + Thu, 01 Jan 1970 00:00:00 +0000 + bob + http://thisisa.test/?p=176 + + + + 176 + 2012-02-17 15:11:55 + 0000-00-00 00:00:00 + open + open + + draft + 0 + 0 + post + + 0 + + + _edit_last + + + + + Page + http://thisisa.test/contact/ + Wed, 11 Apr 2012 11:38:08 +0000 + bob + http://thisisa.test/?page_id=334 + + + + 334 + 2012-04-11 06:38:08 + 2012-04-11 11:38:08 + open + open + contact + publish + 0 + 0 + page + + 0 + + sharing_disabled + + + + _wp_page_template + + + + _edit_last + + + + + Empty Page + http://thisisa.test/empty/ + Wed, 11 Apr 2012 11:38:08 +0000 + bob + http://thisisa.test/?page_id=334 + + + + 334 + 2012-04-11 06:38:08 + 2012-04-11 11:38:08 + open + open + empty + publish + 0 + 0 + page + + 0 + + sharing_disabled + + + + _wp_page_template + + + + _edit_last + + + + + Special chars: l'é + http://thisisa.test/?p=471 + Thu, 01 Jan 1970 00:00:00 +0000 + bob + http://thisisa.test/?p=471 + + + + 471 + 2012-04-29 09:44:27 + 0000-00-00 00:00:00 + open + open + + draft + 0 + 0 + post + + 0 + + + _edit_last + + + + + + With excerpt + http://thisisa.test/with-excerpt/ + Sat, 04 Feb 2012 02:03:06 +0000 + bob + http://thisisa.test/?p=8 + + + + 8 + 2012-02-04 02:03:06 + 2012-02-04 02:03:06 + open + open + with-excerpt + publish + 0 + 0 + post + + 0 + + + + + _edit_last + + + + et_bigpost + + + + _thumbnail_id + + + + + With tags + http://thisisa.test/tags/ + Sat, 04 Feb 2012 21:05:25 +0000 + bob + http://thisisa.test/?p=25 + + + + 25 + 2012-02-04 21:05:25 + 2012-02-04 21:05:25 + open + open + with-tags + publish + 0 + 0 + post + + 0 + + + + + + _edit_last + + + + et_bigpost + + + + _thumbnail_id + + + + + With comments + http://thisisa.test/with-comments/ + Wed, 18 Apr 2012 08:36:26 +0000 + john + http://thisisa.test/?p=422 + + + + 422 + 2012-04-18 03:36:26 + 2012-04-18 08:36:26 + open + open + with-comments + publish + 0 + 0 + post + + 0 + + + _edit_last + + + + _thumbnail_id + + + + 116 + + User2@mail.test + + 127.0.0.1 + 2012-05-06 15:46:06 + 2012-05-06 20:46:06 + + 1 + + 0 + 0 + + akismet_result + + + + akismet_history + + + + akismet_as_submitted + + + + + 117 + + bob@thisisa.test + + 127.0.0.1 + 2012-05-06 17:44:06 + 2012-05-06 22:44:06 + + 1 + + 116 + 3 + + akismet_result + + + + akismet_history + + + + akismet_as_submitted + + + + + 156 + + + http://thisisa.test/to-article-you-ping-back/ + 127.0.0.1 + 2012-05-09 19:30:19 + 2012-05-10 00:30:19 + + trash + pingback + 0 + 0 + + akismet_history + + + + _wp_trash_meta_status + + + + _wp_trash_meta_time + + + + + 122 + + bob@thisisa.test + + 127.0.0.1 + 2012-05-07 14:11:34 + 2012-05-07 19:11:34 + + 1 + + 121 + 3 + + akismet_result + + + + akismet_history + + + + akismet_as_submitted + + + + + + Post with raw data + http://thisisa.test/?p=173 + Thu, 01 Jan 1970 00:00:00 +0000 + bob + http://thisisa.test/?p=173 + + Pelicans are scary + +Pelicans are supposed to eat fish, damn it! + + + +Bottom line: don't mess up with birds]]> + + 173 + 2012-02-16 15:52:55 + 0000-00-00 00:00:00 + open + open + post-with-raw-data + publish + 0 + 0 + post + + 0 + + + _edit_last + + + +
    +
    diff --git a/tests/support.py b/tests/support.py index f2b4a075..994cd509 100644 --- a/tests/support.py +++ b/tests/support.py @@ -6,6 +6,11 @@ __all__ = [ import os import subprocess +import re +import sys +import cStringIO + +from functools import wraps from contextlib import contextmanager from tempfile import mkdtemp from shutil import rmtree @@ -28,8 +33,87 @@ def temporary_folder(): # do whatever you want """ tempdir = mkdtemp() - yield tempdir - rmtree(tempdir) + try: + yield tempdir + finally: + rmtree(tempdir) + + +def isplit(s, sep=None): + """ + Behave like str.split but returns a generator instead of a list. + + >>> list(isplit('\tUse the force\n')) == '\tUse the force\n'.split() + True + >>> list(isplit('\tUse the force\n')) == ['Use', 'the', 'force'] + True + >>> list(isplit('\tUse the force\n', "e")) == '\tUse the force\n'.split("e") + True + >>> list(isplit('Use the force', "e")) == 'Use the force'.split("e") + True + >>> list(isplit('Use the force', "e")) == ['Us', ' th', ' forc', ''] + True + + """ + sep, hardsep = r'\s+' if sep is None else re.escape(sep), sep is not None + exp, pos, l = re.compile(sep), 0, len(s) + while True: + m = exp.search(s, pos) + if not m: + if pos < l or hardsep: + # ^ mimic "split()": ''.split() returns [] + yield s[pos:] + break + start = m.start() + if pos < start or hardsep: + # ^ mimic "split()": includes trailing empty string + yield s[pos:start] + pos = m.end() + + +def mute(returns_output=False): + """ + Decorate a function that prints to stdout, intercepting the output. + If "returns_output" is True, the function will return a generator + yielding the printed lines instead of the return values. + + The decorator litterally hijack sys.stdout during each function + execution, so be careful with what you apply it to. + + >>> def numbers(): + print "42" + print "1984" + ... + >>> numbers() + 42 + 1984 + >>> mute()(numbers)() + >>> list(mute(True)(numbers)()) + ['42', '1984'] + + """ + + def decorator(func): + + @wraps(func) + def wrapper(*args, **kwargs): + + saved_stdout = sys.stdout + sys.stdout = cStringIO.StringIO() + + try: + out = func(*args, **kwargs) + if returns_output: + out = isplit(sys.stdout.getvalue().strip()) + finally: + sys.stdout = saved_stdout + + return out + + return wrapper + + return decorator + def get_article(title, slug, content, lang, extra_metadata=None): diff --git a/tests/test_importer.py b/tests/test_importer.py new file mode 100644 index 00000000..c6ee9cfb --- /dev/null +++ b/tests/test_importer.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +import os + +from pelican.tools.pelican_import import wp2fields, fields2pelican +from .support import unittest, temporary_folder, mute + +CUR_DIR = os.path.dirname(__file__) +WORDPRESS_XML_SAMPLE = os.path.join(CUR_DIR, 'content', 'wordpressexport.xml') + + +class TestWordpressXmlImporter(unittest.TestCase): + + + def setUp(self): + self.posts = wp2fields(WORDPRESS_XML_SAMPLE) + + + def test_ignore_empty_posts(self): + + posts = list(self.posts) + self.assertTrue(posts) + for title, content, fname, date, author, categ, tags, format in posts: + self.assertTrue(title.strip()) + + + def test_can_toggle_raw_html_code_parsing(self): + + posts = list(self.posts) + r = lambda f: open(f).read() + silent_f2p = mute(True)(fields2pelican) + + with temporary_folder() as temp: + + rst_files = (r(f) for f in silent_f2p(posts, 'markdown', temp)) + self.assertTrue(any(' Date: Tue, 15 May 2012 17:48:07 -0400 Subject: [PATCH 067/278] Add warnings for files skipped due to unknown status --- pelican/generators.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pelican/generators.py b/pelican/generators.py index ede948a4..6483457d 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -284,6 +284,10 @@ class ArticlesGenerator(Generator): all_articles.append(article) elif article.status == "draft": self.drafts.append(article) + else: + logger.warning(u"Unknown status %s for file %s, skipping it." % + (repr(unicode.encode(article.status, 'utf-8')), + repr(f))) self.articles, self.translations = process_translations(all_articles) From ef77847762111d165cba14c65dfe5dfb11425530 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 19 May 2012 23:44:37 +0200 Subject: [PATCH 068/278] force locale to ascii in functional tests --- samples/pelican.conf.py | 2 +- tests/test_pelican.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py index bffe57f6..fffbf1a8 100755 --- a/samples/pelican.conf.py +++ b/samples/pelican.conf.py @@ -8,7 +8,7 @@ GITHUB_URL = 'http://github.com/ametaireau/' DISQUS_SITENAME = "blog-notmyidea" PDF_GENERATOR = False REVERSE_CATEGORY_ORDER = True -LOCALE = "" +LOCALE = "C" DEFAULT_PAGINATION = 4 FEED_RSS = 'feeds/all.rss.xml' diff --git a/tests/test_pelican.py b/tests/test_pelican.py index a331690b..0458d58c 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -7,6 +7,7 @@ import os from filecmp import dircmp from tempfile import mkdtemp from shutil import rmtree +import locale from mock import patch @@ -27,9 +28,12 @@ class TestPelican(unittest.TestCase): def setUp(self): self.temp_path = mkdtemp() + self.old_locale = locale.setlocale(locale.LC_ALL) + locale.setlocale(locale.LC_ALL, 'C') def tearDown(self): rmtree(self.temp_path) + locale.setlocale(locale.LC_ALL, self.old_locale) def test_basic_generation_works(self): # when running pelican without settings, it should pick up the default From 46daadc1378d47bc3fd66a2676156c5053a04f36 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Fri, 8 Jun 2012 11:21:52 +0200 Subject: [PATCH 069/278] add a youtube directive to pelican --- pelican/rstdirectives.py | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/pelican/rstdirectives.py b/pelican/rstdirectives.py index 3d7c2fe7..cb9c6f77 100644 --- a/pelican/rstdirectives.py +++ b/pelican/rstdirectives.py @@ -36,3 +36,59 @@ class Pygments(Directive): directives.register_directive('code-block', Pygments) directives.register_directive('sourcecode', Pygments) + + +class YouTube(Directive): + """ Embed YouTube video in posts. + + VIDEO_ID is required, with / height are optional integer, + and align could be left / center / right. + + Usage: + .. youtube:: VIDEO_ID + :width: 640 + :height: 480 + :align: center + """ + + def align(argument): + """Conversion function for the "align" option.""" + return directives.choice(argument, ('left', 'center', 'right')) + + required_arguments = 1 + optional_arguments = 2 + option_spec = { + 'width': directives.positive_int, + 'height': directives.positive_int, + 'align': align + } + + final_argument_whitespace = False + has_content = False + + def run(self): + videoID = self.arguments[0].strip() + width = 420 + height = 315 + align = 'left' + + if 'width' in self.options: + width = self.options['width'] + + if 'height' in self.options: + height = self.options['height'] + + if 'align' in self.options: + align = self.options['align'] + + url = 'http://www.youtube.com/embed/%s' % videoID + div_block = '
    ' % align + embed_block = '' % (width, height, url) + + return [ + nodes.raw('', div_block, format='html'), + nodes.raw('', embed_block, format='html'), + nodes.raw('', '
    ', format='html')] + +directives.register_directive('youtube', YouTube) From 3dd63a012e2885fdc3e1de3d63ebe57b0179e568 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Fri, 8 Jun 2012 11:23:18 +0200 Subject: [PATCH 070/278] Thanks the author of the youtube directive. --- pelican/rstdirectives.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pelican/rstdirectives.py b/pelican/rstdirectives.py index cb9c6f77..9c821310 100644 --- a/pelican/rstdirectives.py +++ b/pelican/rstdirectives.py @@ -41,6 +41,8 @@ directives.register_directive('sourcecode', Pygments) class YouTube(Directive): """ Embed YouTube video in posts. + Courtesy of Brian Hsu: https://gist.github.com/1422773 + VIDEO_ID is required, with / height are optional integer, and align could be left / center / right. From ae1424a8dd488424ea7aade2205cf1cf60e5c90b Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Fri, 8 Jun 2012 09:56:55 -0700 Subject: [PATCH 071/278] Strip tags from title when within tag attribute The change mentioned in #336 stripped tags properly in some places but seems to have forgotten at least one location in the main index.html --- pelican/themes/notmyidea/templates/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pelican/themes/notmyidea/templates/index.html b/pelican/themes/notmyidea/templates/index.html index 69dc4622..de607152 100644 --- a/pelican/themes/notmyidea/templates/index.html +++ b/pelican/themes/notmyidea/templates/index.html @@ -29,7 +29,8 @@ {% endif %}
  • -

    {{ article.title }}

    +

    {{ article.title }}

    From 219280d20315a9af491ddca77d8d61bae9488fb0 Mon Sep 17 00:00:00 2001 From: Abhishek L Date: Sun, 10 Jun 2012 00:00:49 +0530 Subject: [PATCH 072/278] Updated docs, for user and project pages in Github --- docs/tips.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/tips.rst b/docs/tips.rst index 6ddc3d33..14a79a5e 100644 --- a/docs/tips.rst +++ b/docs/tips.rst @@ -10,6 +10,26 @@ GitHub comes with an interesting "pages" feature: you can upload things there and it will be available directly from their servers. As Pelican is a static file generator, we can take advantage of this. +User Pages +---------- +Github allows you to create user pages in the form of ``username.github.com``. +Whatever is created in master branch will be published. For this purposes just +the output generated by pelican needs to pushed at github. + +So given a repository containing your articles, just run pelican over the posts +and deploy the master branch at github:: + + $ pelican -s pelican.conf.py ./path/to/posts -o /path/to/output + +Now add all the files in the output directory generated by pelican:: + + $ git add /path/to/output/* + $ git commit -am "Your Message" + $ git push origin master + +Project Pages +------------- +For creating Project pages, a branch called ``gh-pages`` is used for publishing. The excellent `ghp-import `_ makes this really easy. You will have to install it:: @@ -31,3 +51,4 @@ Put the following into `.git/hooks/post-commit`:: pelican -s pelican.conf.py . && ghp-import output && git push origin gh-pages + From ed8b8bc27e97d22e59c5ab4a84104a368bd0ef62 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sun, 10 Jun 2012 00:24:26 +0200 Subject: [PATCH 073/278] Also reload when the settings file changes. Fix for #360 --- pelican/__init__.py | 31 ++++++++++++++++++++++--------- pelican/utils.py | 22 +++++++++++++++++++--- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 6b3d12fb..23b25730 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -9,7 +9,7 @@ from pelican.generators import (ArticlesGenerator, PagesGenerator, StaticGenerator, PdfGenerator, LessCSSGenerator) from pelican.log import init from pelican.settings import read_settings, _DEFAULT_CONFIG -from pelican.utils import clean_output_dir, files_changed +from pelican.utils import clean_output_dir, files_changed, file_changed from pelican.writers import Writer __major__ = 3 @@ -134,7 +134,7 @@ class Pelican(object): generators = [ArticlesGenerator, PagesGenerator, StaticGenerator] if self.settings['PDF_GENERATOR']: generators.append(PdfGenerator) - if self.settings['LESS_GENERATOR']: # can be True or PATH to lessc + if self.settings['LESS_GENERATOR']: # can be True or PATH to lessc generators.append(LessCSSGenerator) return generators @@ -192,11 +192,7 @@ def parse_arguments(): return parser.parse_args() -def main(): - args = parse_arguments() - init(args.verbosity) - # Split the markup languages only if some have been given. Otherwise, - # populate the variable with None. +def get_instance(args): markup = [a.strip().lower() for a in args.markup.split(',')]\ if args.markup else None @@ -208,9 +204,18 @@ def main(): module = __import__(module) cls = getattr(module, cls_name) + return cls(settings, args.path, args.theme, args.output, markup, + args.delete_outputdir) + + +def main(): + args = parse_arguments() + init(args.verbosity) + # Split the markup languages only if some have been given. Otherwise, + # populate the variable with None. + pelican = get_instance(args) + try: - pelican = cls(settings, args.path, args.theme, args.output, markup, - args.delete_outputdir) if args.autoreload: while True: try: @@ -222,6 +227,14 @@ def main(): if files_changed(pelican.path, pelican.markup) or \ files_changed(pelican.theme, ['']): pelican.run() + + # reload also if settings.py changed + if file_changed(args.settings): + logger.info('%s changed, re-generating' % + args.settings) + pelican = get_instance(args) + pelican.run() + time.sleep(.5) # sleep to avoid cpu load except KeyboardInterrupt: break diff --git a/pelican/utils.py b/pelican/utils.py index d4e34842..0940bf72 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -4,6 +4,7 @@ import re import pytz import shutil import logging +from collections import defaultdict from codecs import open as _open from datetime import datetime @@ -221,9 +222,9 @@ def files_changed(path, extensions): """Return the last time files have been modified""" for root, dirs, files in os.walk(path): dirs[:] = [x for x in dirs if x[0] != '.'] - for file in files: - if any(file.endswith(ext) for ext in extensions): - yield os.stat(os.path.join(root, file)).st_mtime + for f in files: + if any(f.endswith(ext) for ext in extensions): + yield os.stat(os.path.join(root, f)).st_mtime global LAST_MTIME mtime = max(file_times(path)) @@ -233,6 +234,21 @@ def files_changed(path, extensions): return False +FILENAMES_MTIMES = defaultdict(int) + + +def file_changed(filename): + mtime = os.stat(filename).st_mtime + if FILENAMES_MTIMES[filename] == 0: + FILENAMES_MTIMES[filename] = mtime + return False + else: + if mtime > FILENAMES_MTIMES[filename]: + FILENAMES_MTIMES[filename] = mtime + return True + return False + + def set_date_tzinfo(d, tz_name=None): """ Date without tzinfo shoudbe utc. This function set the right tz to date that aren't utc and don't have From 298c15bdda06e14afeef271cb12bd85749b21d79 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sun, 10 Jun 2012 12:39:51 +0200 Subject: [PATCH 074/278] don't test the markdown reader if markdown isn't installed --- dev_requirements.txt | 1 + tests/test_readers.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/dev_requirements.txt b/dev_requirements.txt index e1a15a3f..927a2cab 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -6,3 +6,4 @@ unittest2 pytz mock Markdown +blinker diff --git a/tests/test_readers.py b/tests/test_readers.py index de2e9c32..a921cfc2 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -62,8 +62,10 @@ class RstReaderTest(unittest.TestCase): except ImportError: return unittest.skip('need the typogrify distribution') + class MdReaderTest(unittest.TestCase): + @unittest.skipUnless(readers.Markdown, "markdown isn't installed") def test_article_with_md_extention(self): # test to ensure the md extension is being processed by the correct reader reader = readers.MarkdownReader({}) @@ -74,6 +76,7 @@ class MdReaderTest(unittest.TestCase): self.assertEqual(content, expected) + @unittest.skipUnless(readers.Markdown, "markdown isn't installed") def test_article_with_mkd_extension(self): # test to ensure the mkd extension is being processed by the correct reader reader = readers.MarkdownReader({}) From 68d5ed57e31f51d04d0054f232fa27fe46d70554 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sun, 10 Jun 2012 13:17:52 +0200 Subject: [PATCH 075/278] Add beautifulSoup in the dev deps --- dev_requirements.txt | 1 + tox.ini | 1 + 2 files changed, 2 insertions(+) diff --git a/dev_requirements.txt b/dev_requirements.txt index 927a2cab..ef1dbf31 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -7,3 +7,4 @@ pytz mock Markdown blinker +BeautifulSoup diff --git a/tox.ini b/tox.ini index 2cba1472..a7dc9ec6 100644 --- a/tox.ini +++ b/tox.ini @@ -12,3 +12,4 @@ deps = unittest2 mock Markdown + BeautifulSoup From 7c48937ea25acdb492118e85518bcb82d97c59f6 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sun, 10 Jun 2012 13:27:36 +0200 Subject: [PATCH 076/278] pandoc is optional --- pelican/tools/pelican_import.py | 21 +++++++++++---------- tests/test_importer.py | 10 +++++----- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index f3e9bb48..dab3c3a8 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -247,14 +247,15 @@ def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=Fals try: rc = subprocess.call(cmd, shell=True) if rc < 0: - print("Child was terminated by signal %d" % -rc) - exit() + error = "Child was terminated by signal %d" % -rc + exit(error) + elif rc > 0: - print("Please, check your Pandoc installation.") - exit() + error = "Please, check your Pandoc installation." + exit(error) except OSError, e: - print("Pandoc execution failed: %s" % e) - exit() + error = "Pandoc execution failed: %s" % e + exit(error) os.remove(html_filename) @@ -302,15 +303,15 @@ def main(): elif args.feed: input_type = 'feed' else: - print("You must provide either --wpfile, --dotclear or --feed options") - exit() + error = "You must provide either --wpfile, --dotclear or --feed options" + exit(error) if not os.path.exists(args.output): try: os.mkdir(args.output) except OSError: - print("Unable to create the output folder: " + args.output) - exit() + error = "Unable to create the output folder: " + args.output + exit(error) if input_type == 'wordpress': fields = wp2fields(args.input) diff --git a/tests/test_importer.py b/tests/test_importer.py index c6ee9cfb..1dc6fa78 100644 --- a/tests/test_importer.py +++ b/tests/test_importer.py @@ -11,11 +11,9 @@ WORDPRESS_XML_SAMPLE = os.path.join(CUR_DIR, 'content', 'wordpressexport.xml') class TestWordpressXmlImporter(unittest.TestCase): - def setUp(self): self.posts = wp2fields(WORDPRESS_XML_SAMPLE) - def test_ignore_empty_posts(self): posts = list(self.posts) @@ -23,7 +21,7 @@ class TestWordpressXmlImporter(unittest.TestCase): for title, content, fname, date, author, categ, tags, format in posts: self.assertTrue(title.strip()) - + @unittest.skipUnless(os.system('pandoc --version') == 0, 'pandoc is not installed') def test_can_toggle_raw_html_code_parsing(self): posts = list(self.posts) @@ -34,10 +32,12 @@ class TestWordpressXmlImporter(unittest.TestCase): rst_files = (r(f) for f in silent_f2p(posts, 'markdown', temp)) self.assertTrue(any(' Date: Sun, 10 Jun 2012 13:32:23 +0200 Subject: [PATCH 077/278] don't test webassets key if it can be unset --- pelican/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/settings.py b/pelican/settings.py index b9912a47..9dcba369 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -152,7 +152,7 @@ def configure_settings(settings, default_settings=None, filename=None): "http://docs.notmyidea.org/alexis/pelican/settings.html#timezone " "for more information") - if settings['WEBASSETS']: + if 'WEBASSETS' in settings: try: from webassets.ext.jinja2 import AssetsExtension settings['JINJA_EXTENSIONS'].append(AssetsExtension) From 7682f657a436806478c256f4e659065ae93fc6f5 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sun, 10 Jun 2012 21:46:32 +0200 Subject: [PATCH 078/278] don't do anything with webassets if the setting is set to false (default) --- pelican/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/settings.py b/pelican/settings.py index 9dcba369..5769f1f4 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -152,7 +152,7 @@ def configure_settings(settings, default_settings=None, filename=None): "http://docs.notmyidea.org/alexis/pelican/settings.html#timezone " "for more information") - if 'WEBASSETS' in settings: + if 'WEBASSETS' in settings and settings['WEBASSETS'] is not False: try: from webassets.ext.jinja2 import AssetsExtension settings['JINJA_EXTENSIONS'].append(AssetsExtension) From 191b1cdb0f12231b24f17b74c828242496b55915 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sun, 10 Jun 2012 21:56:06 +0200 Subject: [PATCH 079/278] skip unless deps are installed in tests --- tests/test_importer.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_importer.py b/tests/test_importer.py index 1dc6fa78..5504b12e 100644 --- a/tests/test_importer.py +++ b/tests/test_importer.py @@ -8,12 +8,20 @@ from .support import unittest, temporary_folder, mute CUR_DIR = os.path.dirname(__file__) WORDPRESS_XML_SAMPLE = os.path.join(CUR_DIR, 'content', 'wordpressexport.xml') +PANDOC = os.system('pandoc --version') == 0 +try: + import BeautifulSoup +except ImportError: + BeautifulSoup = False # NOQA + class TestWordpressXmlImporter(unittest.TestCase): def setUp(self): self.posts = wp2fields(WORDPRESS_XML_SAMPLE) + @unittest.skipUnless(PANDOC and BeautifulSoup, + 'Needs Pandoc and BeautifulSoup') def test_ignore_empty_posts(self): posts = list(self.posts) @@ -21,7 +29,8 @@ class TestWordpressXmlImporter(unittest.TestCase): for title, content, fname, date, author, categ, tags, format in posts: self.assertTrue(title.strip()) - @unittest.skipUnless(os.system('pandoc --version') == 0, 'pandoc is not installed') + @unittest.skipUnless(PANDOC and BeautifulSoup, + 'Needs Pandoc and BeautifulSoup') def test_can_toggle_raw_html_code_parsing(self): posts = list(self.posts) From 9fb5969c59ca47911679b1c8f994ddf613cec522 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Sun, 10 Jun 2012 17:58:05 -0400 Subject: [PATCH 080/278] Allow settings to specify a summary length, optionally allowing unlimited summary length --- pelican/contents.py | 4 +++- pelican/settings.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pelican/contents.py b/pelican/contents.py index f5f3a1dc..b8bb0993 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -139,7 +139,9 @@ class Page(object): if hasattr(self, '_summary'): return self._summary else: - return truncate_html_words(self.content, 50) + if self.settings['SUMMARY_MAX_LENGTH']: + return truncate_html_words(self.content, self.settings['SUMMARY_MAX_LENGTH']) + return self.content def _set_summary(self, summary): """Dummy function""" diff --git a/pelican/settings.py b/pelican/settings.py index 4da66989..a8c8bea4 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -68,6 +68,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'ARTICLE_PERMALINK_STRUCTURE': '', 'TYPOGRIFY': False, 'LESS_GENERATOR': False, + 'SUMARY_MAX_LENGTH': 50, } From 876c7f509392d6c245a81e26fd5fd2a81851281f Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Sun, 10 Jun 2012 18:26:53 -0400 Subject: [PATCH 081/278] turn utils.open into actual context manager so as to better handle encoding warnings --- pelican/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pelican/utils.py b/pelican/utils.py index d4e34842..db15a343 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import contextlib import os import re import pytz @@ -32,10 +33,10 @@ def get_date(string): pass raise ValueError("'%s' is not a valid date" % string) - +@contextlib.contextmanager def open(filename): """Open a file and return it's content""" - return _open(filename, encoding='utf-8').read() + yield _open(filename, encoding='utf-8').read() def slugify(value): From c6d1de14f3db63705b35fbe3fd5db3701ea962a4 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Sun, 10 Jun 2012 18:27:38 -0400 Subject: [PATCH 082/278] better html parser --- pelican/readers.py | 101 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 2 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index 83565918..83cb7e3b 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -13,8 +13,11 @@ try: from markdown import Markdown except ImportError: Markdown = False # NOQA +import cgi +from HTMLParser import HTMLParser import re + from pelican.contents import Category, Tag, Author from pelican.utils import get_date, open @@ -126,13 +129,12 @@ class MarkdownReader(Reader): metadata[name] = self.process_metadata(name, value[0]) return content, metadata - +""" class HtmlReader(Reader): file_extensions = ['html', 'htm'] _re = re.compile('\<\!\-\-\#\s?[A-z0-9_-]*\s?\:s?[A-z0-9\s_-]*\s?\-\-\>') def read(self, filename): - """Parse content and metadata of (x)HTML files""" with open(filename) as content: metadata = {'title': 'unnamed'} for i in self._re.findall(content): @@ -142,6 +144,101 @@ class HtmlReader(Reader): metadata[name] = self.process_metadata(name, value) return content, metadata +""" + +class PelicanHTMLParser(HTMLParser): + def __init__(self, settings): + HTMLParser.__init__(self) + self.body = '' + self.metadata = {} + self.settings = settings + + self._data_buffer = '' + + self._in_top_level = True + self._in_head = False + self._in_title = False + self._in_body = False + self._in_tags = False + + def handle_starttag(self, tag, attrs): + if tag == 'head' and self._in_top_level: + self._in_top_level = False + self._in_head = True + elif tag == 'title' and self._in_head: + self._in_title = True + self._data_buffer = '' + elif tag == 'body' and self._in_top_level: + self._in_top_level = False + self._in_body = True + self._data_buffer = '' + elif tag == 'meta' and self._in_head: + self._handle_meta_tag(attrs) + + elif self._in_body: + self._data_buffer += self.build_tag(tag, attrs, False) + + def handle_endtag(self, tag): + if tag == 'head': + if self._in_head: + self._in_head = False + self._in_top_level = True + elif tag == 'title': + self._in_title = False + self.metadata['title'] = self._data_buffer + elif tag == 'body': + self.body = self._data_buffer + self._in_body = False + self._in_top_level = True + elif self._in_body: + self._data_buffer += ''.format(cgi.escape(tag)) + + def handle_startendtag(self, tag, attrs): + if tag == 'meta' and self._in_head: + self._handle_meta_tag(attrs) + if self._in_body: + self._data_buffer += self.build_tag(tag, attrs, True) + + def handle_comment(self, data): + if self._in_body and data.strip() == 'PELICAN_END_SUMMARY': + self.metadata['summary'] = self._data_buffer + + def handle_data(self, data): + self._data_buffer += data + + def build_tag(self, tag, attrs, close_tag): + result = '<{}'.format(cgi.escape(tag)) + result += ''.join((' {}="{}"'.format(cgi.escape(k), cgi.escape(v)) for k,v in attrs)) + if close_tag: + return result + ' />' + return result + '>' + + def _handle_meta_tag(self, attrs): + name = self._attr_value(attrs, 'name') + contents = self._attr_value(attrs, 'contents', '') + if name == 'keywords': + if contents: + self.metadata['tags'] = [Tag(unicode(tag), self.settings) for tag in contents.split(',')] + elif name == 'date': + self.metadata['date'] = get_date(contents) + else: + self.metadata[name] = contents + + @classmethod + def _attr_value(cls, attrs, name, default=None): + return next((x[1] for x in attrs if x[0] == name), default) + +class HTMLReader(Reader): + file_extensions = ['htm', 'html'] + enabled = True + + def read(self, filename): + """Parse content and metadata of markdown files""" + with open(filename) as content: + parser = PelicanHTMLParser(self.settings) + parser.feed(content) + parser.close() + return parser.body, parser.metadata _EXTENSIONS = {} From c6f1d0aadaa5e1dd71ad2a6897169f9da4458c2a Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Mon, 11 Jun 2012 08:39:13 -0400 Subject: [PATCH 083/278] fix SUMMARY_MAX_LENGTH, document it, and test it --- docs/settings.rst | 6 ++++++ pelican/settings.py | 2 +- tests/test_contents.py | 38 ++++++++++++++++++++++++++++++-------- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 85e9f0c3..a26c37dd 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -90,6 +90,12 @@ Setting name (default value) What doe index pages for collections of content e.g. tags and category index pages. `PAGINATED_DIRECT_TEMPLATES` (``('index',)``) Provides the direct templates that should be paginated. +`SUMMARY_MAX_LENGTH` (``50``) When creating a short summary of an article, this will + be the default length in words of the text created. + This only applies if your content does not otherwise + specify a summary. Setting to None will cause the summary + to be a copy of the original content. + ===================================================================== ===================================================================== .. [#] Default is the system locale. diff --git a/pelican/settings.py b/pelican/settings.py index a8c8bea4..d2a39cd9 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -68,7 +68,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'ARTICLE_PERMALINK_STRUCTURE': '', 'TYPOGRIFY': False, 'LESS_GENERATOR': False, - 'SUMARY_MAX_LENGTH': 50, + 'SUMMARY_MAX_LENGTH': 50, } diff --git a/tests/test_contents.py b/tests/test_contents.py index c6ef29a8..e7c9ad01 100644 --- a/tests/test_contents.py +++ b/tests/test_contents.py @@ -4,6 +4,7 @@ from .support import unittest from pelican.contents import Page from pelican.settings import _DEFAULT_CONFIG +from pelican.utils import truncate_html_words from jinja2.utils import generate_lorem_ipsum @@ -48,6 +49,20 @@ class TestPage(unittest.TestCase): page = Page(**self.page_kwargs) self.assertEqual(page.summary, TEST_SUMMARY) + def test_summary_max_length(self): + """If a :SUMMARY_MAX_LENGTH: is set, and there is no other summary, generated summary + should not exceed the given length.""" + page_kwargs = self._copy_page_kwargs() + settings = _DEFAULT_CONFIG.copy() + page_kwargs['settings'] = settings + del page_kwargs['metadata']['summary'] + settings['SUMMARY_MAX_LENGTH'] = None + page = Page(**page_kwargs) + self.assertEqual(page.summary, TEST_CONTENT) + settings['SUMMARY_MAX_LENGTH'] = 10 + page = Page(**page_kwargs) + self.assertEqual(page.summary, truncate_html_words(TEST_CONTENT, 10)) + def test_slug(self): """If a title is given, it should be used to generate the slug.""" page = Page(**self.page_kwargs) @@ -83,14 +98,9 @@ class TestPage(unittest.TestCase): from datetime import datetime from sys import platform dt = datetime(2015, 9, 13) - # make a deep copy of page_kawgs - page_kwargs = dict([(key, self.page_kwargs[key]) for key in - self.page_kwargs]) - for key in page_kwargs: - if not isinstance(page_kwargs[key], dict): - break - page_kwargs[key] = dict([(subkey, page_kwargs[key][subkey]) - for subkey in page_kwargs[key]]) + + page_kwargs = self._copy_page_kwargs() + # set its date to dt page_kwargs['metadata']['date'] = dt page = Page(**page_kwargs) @@ -124,3 +134,15 @@ class TestPage(unittest.TestCase): # Until we find some other method to test this functionality, we # will simply skip this test. unittest.skip("There is no locale %s in this system." % locale) + + def _copy_page_kwargs(self): + # make a deep copy of page_kwargs + page_kwargs = dict([(key, self.page_kwargs[key]) for key in + self.page_kwargs]) + for key in page_kwargs: + if not isinstance(page_kwargs[key], dict): + break + page_kwargs[key] = dict([(subkey, page_kwargs[key][subkey]) + for subkey in page_kwargs[key]]) + + return page_kwargs From 1c708a70ba7f806ca2cf373b1f3c47d74c52c086 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Mon, 11 Jun 2012 09:00:36 -0400 Subject: [PATCH 084/278] Revert "better html parser" This reverts commit c6d1de14f3db63705b35fbe3fd5db3701ea962a4. --- pelican/readers.py | 101 +-------------------------------------------- 1 file changed, 2 insertions(+), 99 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index 83cb7e3b..83565918 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -13,11 +13,8 @@ try: from markdown import Markdown except ImportError: Markdown = False # NOQA -import cgi -from HTMLParser import HTMLParser import re - from pelican.contents import Category, Tag, Author from pelican.utils import get_date, open @@ -129,12 +126,13 @@ class MarkdownReader(Reader): metadata[name] = self.process_metadata(name, value[0]) return content, metadata -""" + class HtmlReader(Reader): file_extensions = ['html', 'htm'] _re = re.compile('\<\!\-\-\#\s?[A-z0-9_-]*\s?\:s?[A-z0-9\s_-]*\s?\-\-\>') def read(self, filename): + """Parse content and metadata of (x)HTML files""" with open(filename) as content: metadata = {'title': 'unnamed'} for i in self._re.findall(content): @@ -144,101 +142,6 @@ class HtmlReader(Reader): metadata[name] = self.process_metadata(name, value) return content, metadata -""" - -class PelicanHTMLParser(HTMLParser): - def __init__(self, settings): - HTMLParser.__init__(self) - self.body = '' - self.metadata = {} - self.settings = settings - - self._data_buffer = '' - - self._in_top_level = True - self._in_head = False - self._in_title = False - self._in_body = False - self._in_tags = False - - def handle_starttag(self, tag, attrs): - if tag == 'head' and self._in_top_level: - self._in_top_level = False - self._in_head = True - elif tag == 'title' and self._in_head: - self._in_title = True - self._data_buffer = '' - elif tag == 'body' and self._in_top_level: - self._in_top_level = False - self._in_body = True - self._data_buffer = '' - elif tag == 'meta' and self._in_head: - self._handle_meta_tag(attrs) - - elif self._in_body: - self._data_buffer += self.build_tag(tag, attrs, False) - - def handle_endtag(self, tag): - if tag == 'head': - if self._in_head: - self._in_head = False - self._in_top_level = True - elif tag == 'title': - self._in_title = False - self.metadata['title'] = self._data_buffer - elif tag == 'body': - self.body = self._data_buffer - self._in_body = False - self._in_top_level = True - elif self._in_body: - self._data_buffer += ''.format(cgi.escape(tag)) - - def handle_startendtag(self, tag, attrs): - if tag == 'meta' and self._in_head: - self._handle_meta_tag(attrs) - if self._in_body: - self._data_buffer += self.build_tag(tag, attrs, True) - - def handle_comment(self, data): - if self._in_body and data.strip() == 'PELICAN_END_SUMMARY': - self.metadata['summary'] = self._data_buffer - - def handle_data(self, data): - self._data_buffer += data - - def build_tag(self, tag, attrs, close_tag): - result = '<{}'.format(cgi.escape(tag)) - result += ''.join((' {}="{}"'.format(cgi.escape(k), cgi.escape(v)) for k,v in attrs)) - if close_tag: - return result + ' />' - return result + '>' - - def _handle_meta_tag(self, attrs): - name = self._attr_value(attrs, 'name') - contents = self._attr_value(attrs, 'contents', '') - if name == 'keywords': - if contents: - self.metadata['tags'] = [Tag(unicode(tag), self.settings) for tag in contents.split(',')] - elif name == 'date': - self.metadata['date'] = get_date(contents) - else: - self.metadata[name] = contents - - @classmethod - def _attr_value(cls, attrs, name, default=None): - return next((x[1] for x in attrs if x[0] == name), default) - -class HTMLReader(Reader): - file_extensions = ['htm', 'html'] - enabled = True - - def read(self, filename): - """Parse content and metadata of markdown files""" - with open(filename) as content: - parser = PelicanHTMLParser(self.settings) - parser.feed(content) - parser.close() - return parser.body, parser.metadata _EXTENSIONS = {} From d9dba3864486dd3949e69976619bc993aaee387a Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Mon, 11 Jun 2012 09:00:57 -0400 Subject: [PATCH 085/278] Revert "turn utils.open into actual context manager so as to better handle encoding warnings" This reverts commit 876c7f509392d6c245a81e26fd5fd2a81851281f. --- pelican/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pelican/utils.py b/pelican/utils.py index db15a343..d4e34842 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -import contextlib import os import re import pytz @@ -33,10 +32,10 @@ def get_date(string): pass raise ValueError("'%s' is not a valid date" % string) -@contextlib.contextmanager + def open(filename): """Open a file and return it's content""" - yield _open(filename, encoding='utf-8').read() + return _open(filename, encoding='utf-8').read() def slugify(value): From 336d6fd40740d75638f4064a04fb00e83526f2a8 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 11 Jun 2012 12:27:01 -0700 Subject: [PATCH 086/278] Getting Started documentation improvements Expanded installation instructions, added Upgrading section, updated link to Pip installer, and other minor improvements. --- docs/getting_started.rst | 61 +++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 313b44e1..8accf658 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -4,17 +4,48 @@ Getting started Installing ========== -You're ready? Let's go! You can install Pelican via several different methods. The simplest is via `pip `_:: +You're ready? Let's go! You can install Pelican via several different methods. +The simplest is via `pip `_:: $ pip install pelican -If you have the project source, you can install Pelican using the distutils -method. I recommend doing so in a virtualenv:: +If you don't have pip installed, an alternative method is easy_install:: - $ virtualenv pelican_venv - $ source bin/activate + $ easy_install pelican + +While the above is the simplest method, the recommended approach is to create +a virtual environment for Pelican via `virtualenv `_ +and `virtualenvwrapper `_ +before installing Pelican:: + + $ pip install virtualenvwrapper + $ mkvirtualenv pelican + +Once the virtual environment has been created and activated, Pelican can be +be installed via pip or easy_install as noted above. Alternatively, if you +have the project source, you can install Pelican using the distutils +method:: + + $ cd path-to-Pelican-source $ python setup.py install +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/ametaireau/pelican#egg=pelican + +Upgrading +--------- + +If you installed a stable Pelican release via pip or easy_install and wish to +upgrade to the latest stable release, you can do so by adding `--upgrade` to +the relevant command. For pip, that would be:: + + $ pip install --upgrade pelican + +If you installed Pelican via distutils or the bleeding-edge method, simply +perform the same step to install the most recent version. + Dependencies ------------ @@ -54,10 +85,9 @@ following syntax (give your file the `.rst` extension):: You can also use Markdown syntax (with a file ending in `.md`). -Markdown generation will not work until you explicitly install the `markdown` -distribution. You can do so on a normal system using `pip install markdown` - -:: +Markdown generation will not work until you explicitly install the `Markdown` +package, which can be done via `pip install Markdown`. Metadata syntax for +Markdown posts should follow this pattern:: Date: 2010-12-03 Title: My super title @@ -94,7 +124,7 @@ Kickstart a blog ---------------- You also can use the `pelican-quickstart` script to start a new blog in -seconds, by just answering few questions. Just run `pelican-quickstart` and +seconds by just answering a few questions. Just run `pelican-quickstart` and you're done! (Added in Pelican 3.0) Pages @@ -175,12 +205,12 @@ For Markdown, format your code blocks thusly:: The specified identifier should be one that appears on the `list of available lexers `_. -Autoreload ----------- +Auto-reload +----------- It's possible to tell Pelican to watch for your modifications, instead of -manually launching it every time you want to see your changes. To enable this, -run the `pelican` command with the `-r` or `--autoreload` options. +manually re-running it every time you want to see your changes. To enable this, +run the `pelican` command with the `-r` or `--autoreload` option. Publishing drafts ----------------- @@ -203,3 +233,6 @@ You can either use your browser to open the files on your disk:: Or run a simple web server using Python:: cd output && python -m SimpleHTTPServer + +(Tip: If using the latter method in conjunction with the auto-reload feature, +ensure that `DELETE_OUTPUT_DIRECTORY` is set to `False` in your settings file.) From 8c375f016f48a67e147334bb72fee3f717b4d4b8 Mon Sep 17 00:00:00 2001 From: Michael Guntsche Date: Wed, 13 Jun 2012 21:54:40 +0200 Subject: [PATCH 087/278] Add template files to MANIFEST.in Commit 7c53cc8955b8f38d put the templates in a separate directory. As a result setuptools did not include them any longer. --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index a092ecd0..13ea58a1 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ include *.rst global-include *.py -recursive-include pelican *.html *.css *png +recursive-include pelican *.html *.css *png *.in include LICENSE From ddb345897e41f7fc11a345381ee6392737839a75 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Thu, 14 Jun 2012 10:29:44 -0400 Subject: [PATCH 088/278] Add gitorious icon to default theme. See ametaireau/pelican-themes#38 and ametaireau/pelican-themes#39 for references. --- pelican/themes/notmyidea/static/css/main.css | 1 + .../notmyidea/static/images/icons/gitorious.png | Bin 0 -> 3675 bytes 2 files changed, 1 insertion(+) create mode 100644 pelican/themes/notmyidea/static/images/icons/gitorious.png diff --git a/pelican/themes/notmyidea/static/css/main.css b/pelican/themes/notmyidea/static/css/main.css index 92905076..dce9e247 100644 --- a/pelican/themes/notmyidea/static/css/main.css +++ b/pelican/themes/notmyidea/static/css/main.css @@ -312,6 +312,7 @@ img.left, figure.left {float: right; margin: 0 0 2em 2em;} .social a[type$='atom+xml'], .social a[type$='rss+xml'] {background-image: url('../images/icons/rss.png');} .social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');} .social a[href*='linkedin.com'] {background-image: url('../images/icons/linkedin.png');} + .social a[href*='gitorious.org'] {background-image: url('../images/icons/gitorious.org');} /* About diff --git a/pelican/themes/notmyidea/static/images/icons/gitorious.png b/pelican/themes/notmyidea/static/images/icons/gitorious.png new file mode 100644 index 0000000000000000000000000000000000000000..6485f5ecc5f6047a052d9adfb686ee154e7233af GIT binary patch literal 3675 zcmeH}_cs;(AIIM!du1jmd)(}q&As*>mwP2~txFP0S<$suA0ydaQQ0fx>V~qnD`Z|H zDsM1YRfBtf8PhSR$Jg1$Z#Z(m^oWl9R>38%Fr zV-o!|&8oo5l;~FpNdreqVXu59TS#ArPaCJS)~oig4I?ydw2WCs3f4*(#&YPD3tysp zyLy&ZrFA0dh5gU|Zg3a4e&2NdXtJ$6v<*278zrMgbh332;&r zrUQOx5VdKotgD z`hA5QR(*4vZDlM6DVAhkU}Z6+_|xb0_{drY{|m>{Rte_f~M(8MshYu zaDF=@zFp0G=Tzfw8oWz^vUSY}hTV7;tYWO}x%9@qin2NJ zz-^>1h>9&zzl~0rDhSGtx}s}@G(%cU8$HTuwl1u5UTNv!XK>?b2$mG^VXBOK5UJE9S~ooN=pm#z z=Y+30S+kBG1X@TR1#Igi$iJ}=^&f}&} zMOJneveKy1y3%l~Rk>!n6kF1&-|TP{$*kLJB6d^E5S>amk6pK&v7IlaFXb}VR6D4V zuJ9@5Eo#;a`gpf=C#T@UElh!#U+F?f>-wL|;W8)i6W>3j2ZoGD>IOz(Y9b@yqDHq; zfS(4ROfT`LHO#3~2Ud*AL}f31fDf#vM_57*)#U_^`9#`UW=N*s1@ zEq7yYs5%rQ?QS?V7*u1cMJAi8n@ca0;w>^PDhnpjoo{~P`f=q=Ja5*fsfjf>UtBl} z?aGaA>aOYB$!N_8e;@wOi6#wG{0ws?-wnQq`)}`YsM)J6(+pxFMPwjlUngmyn!j8Z{`LttFk$+cV$Sx@r=55a6^FI(C4~Z^-Z1 zE+f|NDDQah#LvALQhXs%;Gl5-Q)eISi}l*5Hp7cdS)awK2uqk{B)V~3NXAVj9Z@~? zrl~lnf`t0Pt@TUm-isBj6%CaI`2`2(A(ghKzNSITPQL=@*hSc5A+kF;lspPbF(MRb z%EUZV3jN3FG23wZT?PpcLnt>+NZ3Es@H zRuSJOKhdDRqLMo!7{y}aV-a!MDgFt_OQUkxN|4l`e}Mv0JK8DJOhW`M1S>s zI9TNoTYuVpH@QjXN+wOePeWSOc?T(a9JJ&c{D$}xgr*+tf$;n|oH(GGRatOtczdW} zfS9K8{KpIOHd_bV(ob7dVMnDLWeueY=wK#j~DvftZIEe3rW#u*^ zyC$MlG}PQD@>csmRC^k8}B#pF?a6S+w#gTy!(jfnCHgV1*rl@=B$eBui4CZnPz6+GA-J_-9GrGPn5|X z7AH1G<6!t#A2r^!c$D@NhSjyS)ZyLH9p12(Uy9!+h>k6!6RrLa zL^}#Q^9j!hk0axw29kD7V#UT`){(DMwS{lMb}!`^iFJrNNaR*b0PHDka(5lxuS+ch{+zj-+Oi=YCHqIJMsjZi4BjC{ypbHe2EKN zcOxv`X7T&+o;7f3OrM;*uHK?fxVif-aJQbg#*TQ0$g5Rz_T3EJ)Hux;x9n|x-kev1 zzv+YD32ki*^CWHX7N`*B_gh1La*-z|3RE@cTlYf!NZq7^MXvdXdtxVq!RDDDv7PD` z%NFN-oo(G2*nIqiw&UsC^pCm6x7&gW_eSRoNz}2?Bd6&HsVuPbsky0xaZGVr1=qDy zRhPBzoopPJ!baRjL<_i2U!D%uaC6B-98PRa5k_-Hi?VmKGd}u0Dn8k4+v2Gu_H^`I z`OqJ%Aa`ru{%E^BXfBBF$E!sa%hgBxkHyJezv~WcKb0P3@ML6=sVH;yj@=Zbh-ZD1 z-_6Lz9Dq;}05H)2{3f6I1^^Fa0oZf_KrIIVZoj9_-39ZfDh7YjeuipAOblqHnRd;pX1guKpVP^?KjrDZl!Lxy>?erb8ta^(jygszj+vLaYB8AoV>@2=0&gbI Date: Thu, 14 Jun 2012 23:04:23 +0200 Subject: [PATCH 089/278] added GoSquared support GoSquared(analytics) support added in default themes and documentation (in French and English) --- README.rst | 2 +- docs/fr/configuration.rst | 3 +++ docs/settings.rst | 1 + pelican/themes/notmyidea/templates/gosquared.html | 14 ++++++++++++++ pelican/themes/simple/templates/gosquared.html | 14 ++++++++++++++ 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 pelican/themes/notmyidea/templates/gosquared.html create mode 100644 pelican/themes/simple/templates/gosquared.html diff --git a/README.rst b/README.rst index 5012bb9c..4f4edb61 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ Pelican currently supports: * Atom/RSS feeds * Code syntax highlighting * Import from WordPress, Dotclear, or RSS feeds -* Integration with external tools: Twitter, Google Analytics, etc. (optional) +* Integration with external tools: Twitter, Google Analytics, GoSquared, etc. (optional) Have a look at `the documentation `_ for more information. diff --git a/docs/fr/configuration.rst b/docs/fr/configuration.rst index 695a0b0e..fadaf258 100644 --- a/docs/fr/configuration.rst +++ b/docs/fr/configuration.rst @@ -98,6 +98,9 @@ GITHUB_URL : GOOGLE_ANALYTICS : 'UA-XXXX-YYYY' pour activer Google analytics ; + +GOSQUARED_SITENAME : + 'XXX-YYYYYY-X' pour activer GoSquared ; JINJA_EXTENSIONS : Liste d'extension Jinja2 que vous souhaitez utiliser ; diff --git a/docs/settings.rst b/docs/settings.rst index b36c9953..416c22d4 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -398,6 +398,7 @@ Setting name What does it do ? `GITHUB_URL` Your GitHub URL (if you have one). It will then use this information to create a GitHub ribbon. `GOOGLE_ANALYTICS` 'UA-XXXX-YYYY' to activate Google Analytics. +`GOSQUARED_SITENAME` 'XXX-YYYYYY-X' to activate GoSquared. `MENUITEMS` A list of tuples (Title, URL) for additional menu items to appear at the beginning of the main menu. `PIWIK_URL` URL to your Piwik server - without 'http://' at the diff --git a/pelican/themes/notmyidea/templates/gosquared.html b/pelican/themes/notmyidea/templates/gosquared.html new file mode 100644 index 00000000..f47efcf4 --- /dev/null +++ b/pelican/themes/notmyidea/templates/gosquared.html @@ -0,0 +1,14 @@ +{% if GOSQUARED_SITENAME %} + +{% endif %} diff --git a/pelican/themes/simple/templates/gosquared.html b/pelican/themes/simple/templates/gosquared.html new file mode 100644 index 00000000..f47efcf4 --- /dev/null +++ b/pelican/themes/simple/templates/gosquared.html @@ -0,0 +1,14 @@ +{% if GOSQUARED_SITENAME %} + +{% endif %} From d1dfcdafc229b788bf48f08964836ff17eace4f0 Mon Sep 17 00:00:00 2001 From: asselinpaul Date: Thu, 14 Jun 2012 23:32:23 +0200 Subject: [PATCH 090/278] updated remove GoSqaured from README and template file from the notmyidea theme. --- README.rst | 2 +- pelican/themes/notmyidea/templates/.DS_Store | Bin 0 -> 6148 bytes .../themes/notmyidea/templates/gosquared.html | 14 -------------- 3 files changed, 1 insertion(+), 15 deletions(-) create mode 100644 pelican/themes/notmyidea/templates/.DS_Store delete mode 100644 pelican/themes/notmyidea/templates/gosquared.html diff --git a/README.rst b/README.rst index 4f4edb61..5012bb9c 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ Pelican currently supports: * Atom/RSS feeds * Code syntax highlighting * Import from WordPress, Dotclear, or RSS feeds -* Integration with external tools: Twitter, Google Analytics, GoSquared, etc. (optional) +* Integration with external tools: Twitter, Google Analytics, etc. (optional) Have a look at `the documentation `_ for more information. diff --git a/pelican/themes/notmyidea/templates/.DS_Store b/pelican/themes/notmyidea/templates/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 - var GoSquared={}; - GoSquared.acct = "{{ GOSQUARED_SITENAME }}"; - (function(w){ - function gs(){ - w._gstc_lt=+(new Date); var d=document; - var g = d.createElement("script"); g.type = "text/javascript"; g.async = true; g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js"; - var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(g, s); - } - w.addEventListener?w.addEventListener("load",gs,false):w.attachEvent("onload",gs); - })(window); - -{% endif %} From c461c6435df87bb0407d3459719e3278ffb5d55c Mon Sep 17 00:00:00 2001 From: Michael Guntsche Date: Sat, 16 Jun 2012 19:53:53 +0200 Subject: [PATCH 091/278] Fix HTML5 conformance of the notmyidea template The W3C validator complained that the pagination

    was inside an

      . So just move it out of there. --- pelican/themes/notmyidea/templates/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pelican/themes/notmyidea/templates/index.html b/pelican/themes/notmyidea/templates/index.html index de607152..8752a6b6 100644 --- a/pelican/themes/notmyidea/templates/index.html +++ b/pelican/themes/notmyidea/templates/index.html @@ -41,12 +41,12 @@
  • {% endif %} - {% if loop.last and (articles_page.has_previous() - or not articles_page.has_previous() and loop.length > 1) %} - {% include 'pagination.html' %} - {% endif %} {% if loop.last %} + {% if loop.last and (articles_page.has_previous() + or not articles_page.has_previous() and loop.length > 1) %} + {% include 'pagination.html' %} + {% endif %}
    {% endif %} {% endfor %} From 083f302b194eaeedd76d65b96120f42f54112c22 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 16 Jun 2012 11:23:55 -0700 Subject: [PATCH 092/278] Remove errant .DS_Store and add to .gitignore --- .gitignore | 1 + pelican/themes/notmyidea/templates/.DS_Store | Bin 6148 -> 0 bytes 2 files changed, 1 insertion(+) delete mode 100644 pelican/themes/notmyidea/templates/.DS_Store diff --git a/.gitignore b/.gitignore index 4029b327..9274ba2d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .*.swp .*.swo *.pyc +.DS_Store docs/_build docs/fr/_build build diff --git a/pelican/themes/notmyidea/templates/.DS_Store b/pelican/themes/notmyidea/templates/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Mon, 25 Jun 2012 08:57:09 -0400 Subject: [PATCH 093/278] Add upgrade ability to pelican-themes. Fix typos. I disliked having to do: $ pelican-theme -r -i So I modified install() to handle an upgrade of an existing theme. While doing so, I noticed that in install() and symlink() the script would error with 'no a directory' instead of 'not a directory'. So I fixed that for you as well. --- pelican/tools/pelican_themes.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index 3d35bb5d..a7e0470f 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -48,9 +48,11 @@ def main(): parser.add_argument('-i', '--install', dest='to_install', nargs='+', metavar="theme path", - help='The themes to install ') + help='The themes to install') parser.add_argument('-r', '--remove', dest='to_remove', nargs='+', metavar="theme name", help='The themes to remove') + parser.add_argument('-U', '--upgrade', dest='to_upgrade', nargs='+', + metavar="theme path", help='The themes to upgrade') parser.add_argument('-s', '--symlink', dest='to_symlink', nargs='+', metavar="theme path", help="Same as `--install', but create a symbolic link instead of copying the theme. Useful for theme development") parser.add_argument('-c', '--clean', dest='clean', action="store_true", @@ -85,6 +87,13 @@ def main(): for i in args.to_install: install(i, v=args.verbose) + if args.to_upgrade: + if args.verbose: + print('Upgrading themes...') + + for i in args.to_upgrade: + install(i, v=args.verbose, u=True) + if args.to_symlink: if args.verbose: print('Linking themes...') @@ -149,17 +158,21 @@ def remove(theme_name, v=False): err(target + ' : no such file or directory') -def install(path, v=False): +def install(path, v=False, u=False): """Installs a theme""" if not os.path.exists(path): err(path + ' : no such file or directory') elif not os.path.isdir(path): - err(path + ' : no a directory') + err(path + ' : not a directory') else: theme_name = os.path.basename(os.path.normpath(path)) theme_path = os.path.join(_THEMES_PATH, theme_name) - if os.path.exists(theme_path): + exists = os.path.exists(theme_path) + if exists and not u: err(path + ' : already exists') + elif exists and u: + remove(theme_name, v) + install(path, v) else: if v: print("Copying `{p}' to `{t}' ...".format(p=path, t=theme_path)) @@ -174,7 +187,7 @@ def symlink(path, v=False): if not os.path.exists(path): err(path + ' : no such file or directory') elif not os.path.isdir(path): - err(path + ' : no a directory') + err(path + ' : not a directory') else: theme_name = os.path.basename(os.path.normpath(path)) theme_path = os.path.join(_THEMES_PATH, theme_name) From 707536725da13df8ed7b167447039c738068b1c8 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Mon, 25 Jun 2012 11:43:12 -0400 Subject: [PATCH 094/278] Failed to commit some important changes. --- pelican/tools/pelican_themes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index a7e0470f..6a021ecc 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -64,6 +64,9 @@ def main(): args = parser.parse_args() + + to_install = args.to_install or args.to_upgrade + to_sym = args.to_symlink or args.clean if args.action: @@ -71,8 +74,7 @@ def main(): list_themes(args.verbose) elif args.action is 'path': print(_THEMES_PATH) - elif args.to_install or args.to_remove or args.to_symlink or args.clean: - + elif to_install or args.to_remove or to_sym: if args.to_remove: if args.verbose: print('Removing themes...') From b2ff07d58cc0949cba20da5b4ceffe8979a6c479 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Tue, 26 Jun 2012 16:28:00 +0200 Subject: [PATCH 095/278] we need jinja >= 2.4 --- dev_requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index ef1dbf31..ec3245d1 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,4 +1,4 @@ -Jinja2 +Jinja2>=2.4 Pygments docutils feedgenerator diff --git a/setup.py b/setup.py index a8a8fbd9..1603746e 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from setuptools import setup -requires = ['feedgenerator', 'jinja2', 'pygments', 'docutils', 'pytz', 'blinker'] +requires = ['feedgenerator', 'jinja2 >= 2.4', 'pygments', 'docutils', 'pytz', 'blinker'] try: import argparse From a0e46c91066bd8338d0e067875d6e040fec88477 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Tue, 26 Jun 2012 19:26:43 -0700 Subject: [PATCH 096/278] Add support for `status: hidden` in pages Resolves #380 If the status metadata is set to 'hidden' on a page it is translated and rendered but not linked anywhere in the site. --- docs/getting_started.rst | 4 ++++ pelican/generators.py | 17 +++++++++++++++-- samples/content/pages/hidden_page.rst | 9 +++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 samples/content/pages/hidden_page.rst diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 8accf658..580c43a1 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -136,6 +136,10 @@ generate static pages. Then, use the `DISPLAY_PAGES_ON_MENU` setting, which will add all the pages to the menu. +If you want to exclude any pages from being linked to or listed in the menu +then add a ``status: hidden`` attribute to it's metadata. This is useful for +things like making error pages that fit the generated theme of your site. + Importing an existing blog -------------------------- diff --git a/pelican/generators.py b/pelican/generators.py index 1ddc13c2..6790fcd6 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -357,10 +357,13 @@ class PagesGenerator(Generator): def __init__(self, *args, **kwargs): self.pages = [] + self.hidden_pages = [] + self.hidden_translations = [] super(PagesGenerator, self).__init__(*args, **kwargs) def generate_context(self): all_pages = [] + hidden_pages = [] for f in self.get_files( os.path.join(self.path, self.settings['PAGE_DIR']), exclude=self.settings['PAGE_EXCLUDES']): @@ -373,15 +376,25 @@ class PagesGenerator(Generator): filename=f) if not is_valid_content(page, f): continue - all_pages.append(page) + if page.status == "published": + all_pages.append(page) + elif page.status == "hidden": + hidden_pages.append(page) + else: + logger.warning(u"Unknown status %s for file %s, skipping it." % + (repr(unicode.encode(article.status, 'utf-8')), + repr(f))) + self.pages, self.translations = process_translations(all_pages) + self.hidden_pages, self.hidden_translations = process_translations(hidden_pages) self._update_context(('pages', )) self.context['PAGES'] = self.pages def generate_output(self, writer): - for page in chain(self.translations, self.pages): + for page in chain(self.translations, self.pages, + self.hidden_translations, self.hidden_pages): writer.write_file(page.save_as, self.get_template('page'), self.context, page=page, relative_urls=self.settings.get('RELATIVE_URLS')) diff --git a/samples/content/pages/hidden_page.rst b/samples/content/pages/hidden_page.rst new file mode 100644 index 00000000..ab8704ed --- /dev/null +++ b/samples/content/pages/hidden_page.rst @@ -0,0 +1,9 @@ +This is a test hidden page +########################## + +:category: test +:status: hidden + +This is great for things like error(404) pages +Anyone can see this page but it's not linked to anywhere! + From de251bc9998b1245238e69707c21a0dd5143756b Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Tue, 26 Jun 2012 19:51:48 -0700 Subject: [PATCH 097/278] Fixes typo in error message for bad status Bugfix #380 We want the bad status of page, not article. --- pelican/generators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/generators.py b/pelican/generators.py index 6790fcd6..4e9312cc 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -382,7 +382,7 @@ class PagesGenerator(Generator): hidden_pages.append(page) else: logger.warning(u"Unknown status %s for file %s, skipping it." % - (repr(unicode.encode(article.status, 'utf-8')), + (repr(unicode.encode(page.status, 'utf-8')), repr(f))) From c2993c4d4e19b1eceb3c367c38005dd89d04b53c Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Wed, 27 Jun 2012 07:02:25 -0700 Subject: [PATCH 098/278] Documentation typo --- 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 580c43a1..96038c2a 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -137,7 +137,7 @@ Then, use the `DISPLAY_PAGES_ON_MENU` setting, which will add all the pages to the menu. If you want to exclude any pages from being linked to or listed in the menu -then add a ``status: hidden`` attribute to it's metadata. This is useful for +then add a ``status: hidden`` attribute to its metadata. This is useful for things like making error pages that fit the generated theme of your site. Importing an existing blog From 9ad93d36a0cff5e684bff5f4ca9f6b7080ea42d7 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sun, 1 Jul 2012 10:52:39 -0700 Subject: [PATCH 099/278] Convert code in docs to inline literals Most of the references to code and settings in the docs were wrapped in single tickmarks (`), while reStructuredText syntax actually calls for double tickmarks for inline literals, which are normally rendered as monospaced text with spaces preserved. Converted the relevant instances to inline literals, along with some other minor fixes. --- docs/faq.rst | 6 +-- docs/getting_started.rst | 36 +++++++-------- docs/internals.rst | 40 ++++++++-------- docs/plugins.rst | 26 +++++------ docs/report.rst | 99 ++++++++++++++++++++-------------------- docs/themes.rst | 9 ++-- docs/tips.rst | 26 +++++------ 7 files changed, 119 insertions(+), 123 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index b3dbca87..a3829d65 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -8,14 +8,14 @@ Is it mandatory to have a configuration file? No, it's not. Configuration files are just an easy way to configure Pelican. For basic operations, it's possible to specify options while invoking Pelican -via the command line. See `pelican --help` for more information. +via the command line. See ``pelican --help`` for more information. I'm creating my own theme. How do I use Pygments for syntax highlighting? ========================================================================= Pygments adds some classes to the generated content. These classes are used by themes to style code syntax highlighting via CSS. Specifically, you can -customize the appearance of your syntax highlighting via the `.codehilite pre` +customize the appearance of your syntax highlighting via the ``.codehilite pre`` class in your theme's CSS file. To see how various styles can be used to render Django code, for example, you can use the demo `on the project website `_. @@ -30,7 +30,7 @@ How can I help? There are several ways to help out. First, you can use Pelican and report any suggestions or problems you might have on `the bugtracker -`_. +`_. If you want to contribute, please fork `the git repository `_, make your changes, and issue diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 8accf658..cd186a1c 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -38,7 +38,7 @@ Upgrading --------- If you installed a stable Pelican release via pip or easy_install and wish to -upgrade to the latest stable release, you can do so by adding `--upgrade` to +upgrade to the latest stable release, you can do so by adding ``--upgrade`` to the relevant command. For pip, that would be:: $ pip install --upgrade pelican @@ -55,7 +55,7 @@ At this time, Pelican is dependent on the following Python packages: * jinja2, for templating support * docutils, for supporting reStructuredText as an input format -If you're not using Python 2.7, you will also need `argparse`. +If you're not using Python 2.7, you will also need the ``argparse`` package. Optionally: @@ -73,7 +73,7 @@ file system (for instance, about the category of your articles), but some information you need to provide in the form of metadata inside your files. You can provide this metadata in reStructuredText text files via the -following syntax (give your file the `.rst` extension):: +following syntax (give your file the ``.rst`` extension):: My super title ############## @@ -84,9 +84,9 @@ following syntax (give your file the `.rst` extension):: :author: Alexis Metaireau -You can also use Markdown syntax (with a file ending in `.md`). -Markdown generation will not work until you explicitly install the `Markdown` -package, which can be done via `pip install Markdown`. Metadata syntax for +You can also use Markdown syntax (with a file ending in ``.md``). +Markdown generation will not work until you explicitly install the ``Markdown`` +package, which can be done via ``pip install Markdown``. Metadata syntax for Markdown posts should follow this pattern:: Date: 2010-12-03 @@ -99,17 +99,17 @@ Markdown posts should follow this pattern:: Note that, aside from the title, none of this metadata is mandatory: if the date is not specified, Pelican will rely on the file's "mtime" timestamp, and the category can be determined by the directory in which the file resides. For -example, a file located at `python/foobar/myfoobar.rst` will have a category of -`foobar`. +example, a file located at ``python/foobar/myfoobar.rst`` will have a category of +``foobar``. Generate your blog ------------------ -To launch Pelican, just use the `pelican` command:: +To launch Pelican, just use the ``pelican`` command:: $ pelican /path/to/your/content/ [-s path/to/your/settings.py] -And… that's all! Your weblog will be generated and saved in the `content/` +And… that's all! Your weblog will be generated and saved in the ``content/`` folder. The above command will use the default theme to produce a simple site. It's not @@ -123,17 +123,17 @@ the options you can use:: Kickstart a blog ---------------- -You also can use the `pelican-quickstart` script to start a new blog in -seconds by just answering a few questions. Just run `pelican-quickstart` and +You also can use the ``pelican-quickstart`` script to start a new blog in +seconds by just answering a few questions. Just run ``pelican-quickstart`` and you're done! (Added in Pelican 3.0) Pages ----- -If you create a folder named `pages`, all the files in it will be used to +If you create a folder named ``pages``, all the files in it will be used to generate static pages. -Then, use the `DISPLAY_PAGES_ON_MENU` setting, which will add all the pages to +Then, use the ``DISPLAY_PAGES_ON_MENU`` setting, which will add all the pages to the menu. Importing an existing blog @@ -145,8 +145,8 @@ a simple script. See :ref:`import`. Translations ------------ -It is possible to translate articles. To do so, you need to add a `lang` meta -attribute to your articles/pages and set a `DEFAULT_LANG` setting (which is +It is possible to translate articles. To do so, you need to add a ``lang`` meta +attribute to your articles/pages and set a ``DEFAULT_LANG`` setting (which is English [en] by default). With those settings in place, only articles with the default language will be listed, and each article will be accompanied by a list of available translations for that article. @@ -210,7 +210,7 @@ Auto-reload It's possible to tell Pelican to watch for your modifications, instead of manually re-running it every time you want to see your changes. To enable this, -run the `pelican` command with the `-r` or `--autoreload` option. +run the ``pelican`` command with the ``-r`` or ``--autoreload`` option. Publishing drafts ----------------- @@ -235,4 +235,4 @@ Or run a simple web server using Python:: cd output && python -m SimpleHTTPServer (Tip: If using the latter method in conjunction with the auto-reload feature, -ensure that `DELETE_OUTPUT_DIRECTORY` is set to `False` in your settings file.) +ensure that ``DELETE_OUTPUT_DIRECTORY`` is set to ``False`` in your settings file.) diff --git a/docs/internals.rst b/docs/internals.rst index f0934825..6b6f991f 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -12,34 +12,34 @@ original author wrote with some software design information. Overall structure ================= -What `pelican` does is take a list of files and process them into some +What Pelican does is take a list of files and process them into some sort of output. Usually, the input files are reStructuredText and Markdown files, and the output is a blog, but both input and output can be anything you want. The logic is separated into different classes and concepts: -* `writers` are responsible for writing files: .html files, RSS feeds, and so +* **Writers** are responsible for writing files: .html files, RSS feeds, and so on. Since those operations are commonly used, the object is created once and then passed to the generators. -* `readers` are used to read from various formats (Markdown and +* **Readers** are used to read from various formats (Markdown and reStructuredText for now, but the system is extensible). Given a file, they return metadata (author, tags, category, etc.) and content (HTML-formatted). -* `generators` generate the different outputs. For instance, Pelican comes with - `ArticlesGenerator` and `PageGenerator`. Given a configuration, they can do +* **Generators** generate the different outputs. For instance, Pelican comes with + ``ArticlesGenerator`` and ``PageGenerator``. Given a configuration, they can do whatever they want. Most of the time, it's generating files from inputs. -* `pelican` also uses `templates`, so it's easy to write your own theme. The - syntax is `jinja2`, and, trust me, really easy to learn, so don't hesitate - to jump in and build your own theme. +* Pelican also uses templates, so it's easy to write your own theme. The + syntax is `Jinja2 `_ and is very easy to learn, so + don't hesitate to jump in and build your own theme. How to implement a new reader? ============================== Is there an awesome markup language you want to add to Pelican? -Well, the only thing you have to do is to create a class with a `read` +Well, the only thing you have to do is to create a class with a ``read`` method that returns HTML content and some metadata. Take a look at the Markdown reader:: @@ -65,8 +65,8 @@ Take a look at the Markdown reader:: Simple, isn't it? If your new reader requires additional Python dependencies, then you should wrap -their `import` statements in a `try...except` block. Then inside the reader's -class, set the `enabled` class attribute to mark import success or failure. +their ``import`` statements in a ``try...except`` block. Then inside the reader's +class, set the ``enabled`` class attribute to mark import success or failure. This makes it possible for users to continue using their favourite markup method without needing to install modules for formats they don't use. @@ -76,17 +76,17 @@ How to implement a new generator? Generators have two important methods. You're not forced to create both; only the existing ones will be called. -* `generate_context`, that is called first, for all the generators. +* ``generate_context``, that is called first, for all the generators. Do whatever you have to do, and update the global context if needed. This context is shared between all generators, and will be passed to the - templates. For instance, the `PageGenerator` `generate_context` method finds - all the pages, transforms them into objects, and populates the context with - them. Be careful *not* to output anything using this context at this stage, - as it is likely to change by the effect of other generators. + templates. For instance, the ``PageGenerator`` ``generate_context`` method + finds all the pages, transforms them into objects, and populates the context + with them. Be careful *not* to output anything using this context at this + stage, as it is likely to change by the effect of other generators. -* `generate_output` is then called. And guess what is it made for? Oh, +* ``generate_output`` is then called. And guess what is it made for? Oh, generating the output. :) It's here that you may want to look at the context - and call the methods of the `writer` object that is passed as the first - argument of this function. In the `PageGenerator` example, this method will + and call the methods of the ``writer`` object that is passed as the first + argument of this function. In the ``PageGenerator`` example, this method will look at all the pages recorded in the global context and output a file on - the disk (using the writer method `write_file`) for each page encountered. + the disk (using the writer method ``write_file``) for each page encountered. diff --git a/docs/plugins.rst b/docs/plugins.rst index db5a4bfc..3e009e33 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -3,14 +3,14 @@ Plugins ####### -Since version 3.0, pelican manages plugins. Plugins are a way to add features -to pelican without having to directly hack pelican code. +Since version 3.0, Pelican manages plugins. Plugins are a way to add features +to Pelican without having to directly hack Pelican code. Pelican is shipped with a set of core plugins, but you can easily implement your own (and this page describes how). -How to use plugins? -==================== +How to use plugins +================== To load plugins, you have to specify them in your settings file. You have two ways to do so. @@ -23,21 +23,21 @@ Or by importing them and adding them to the list:: from pelican.plugins import gravatar PLUGINS = [gravatar, ] -If your plugins are not in an importable path, you can specify a `PLUGIN_PATH` +If your plugins are not in an importable path, you can specify a ``PLUGIN_PATH`` in the settings:: PLUGIN_PATH = "plugins" PLUGINS = ["list", "of", "plugins"] -How to create plugins? -====================== +How to create plugins +===================== -Plugins are based on the concept of signals. Pelican sends signals and plugins +Plugins are based on the concept of signals. Pelican sends signals, and plugins subscribe to those signals. The list of signals are defined in a following section. -The only rule to follow for plugins is to define a `register` callable, in -which you map the signals to your plugin logic. Let's take a simple exemple:: +The only rule to follow for plugins is to define a ``register`` callable, in +which you map the signals to your plugin logic. Let's take a simple example:: from pelican import signals @@ -68,7 +68,7 @@ List of plugins =============== Not all the list are described here, but a few of them have been extracted from -pelican core and provided in pelican.plugins. They are described here: +the Pelican core and provided in ``pelican.plugins``. They are described here: Tag cloud --------- @@ -82,7 +82,7 @@ Github Activity This plugin makes use of the ``feedparser`` library that you'll need to install. -Set the GITHUB_ACTIVITY_FEED parameter to your github activity feed. +Set the ``GITHUB_ACTIVITY_FEED`` parameter to your Github activity feed. For example, my setting would look like:: GITHUB_ACTIVITY_FEED = 'https://github.com/kpanic.atom' @@ -105,4 +105,4 @@ variable, as in the example:: ``github_activity`` is a list of lists. The first element is the title -and the second element is the raw html from github. +and the second element is the raw HTML from Github. diff --git a/docs/report.rst b/docs/report.rst index 7e0432e2..f12f3048 100644 --- a/docs/report.rst +++ b/docs/report.rst @@ -1,40 +1,40 @@ -Some history about pelican +Some history about Pelican ########################## .. warning:: This page comes from a report the original author (Alexis Métaireau) wrote - right after writing pelican, in december 2010. The information may not be - up to date. + right after writing Pelican, in December 2010. The information may not be + up-to-date. Pelican is a simple static blog generator. It parses markup files -(markdown or restructured text for now), and generate a HTML folder +(Markdown or reStructuredText for now) and generates an HTML folder with all the files in it. -I've chosen to use python to implement pelican because it seemed to +I've chosen to use Python to implement Pelican because it seemed to be simple and to fit to my needs. I did not wanted to define a class for each thing, but still wanted to keep my things loosely coupled. It turns out that it was exactly what I wanted. From time to time, thanks to the feedback of some users, it took me a very few time to -provide fixes on it. So far, I've re-factored the pelican code by two -times, each time took less than 30 minutes. +provide fixes on it. So far, I've re-factored the Pelican code by two +times; each time took less than 30 minutes. Use case ======== -I was previously using wordpress, a solution you can host on a web +I was previously using WordPress, a solution you can host on a web server to manage your blog. Most of the time, I prefer using markup -languages such as Markdown or RestructuredText to type my articles. +languages such as Markdown or reStructuredText to type my articles. To do so, I use vim. I think it is important to let the people choose the tool they want to write the articles. In my opinion, a blog manager should just allow you to take any kind of input and transform it to a -weblog. That's what pelican does. +weblog. That's what Pelican does. You can write your articles using the tool you want, and the markup -language you want, and then generate a static HTML weblog +language you want, and then generate a static HTML weblog. .. image:: _static/overall.png -To be flexible enough, pelican have a template support, so you can -easily write you own themes if you want to. +To be flexible enough, Pelican has template support, so you can easily write +your own themes if you want to. Design process ============== @@ -42,19 +42,18 @@ Design process Pelican came from a need I have. I started by creating a single file application, and I have make it grow to support what it does by now. To start, I wrote a piece of documentation about what I wanted to do. -Then, I have created the content I wanted to parse (the restructured -text files), and started experimenting with the code. -Pelican was 200 lines long, and contained almost ten functions and one -class when it was first usable. +Then, I created the content I wanted to parse (the reStructuredText files) +and started experimenting with the code. Pelican was 200 lines long and +contained almost ten functions and one class when it was first usable. -I have been facing different problems all over the time, and wanted to -add features to pelican while using it. The first change I have done was +I have been facing different problems all over the time and wanted to +add features to Pelican while using it. The first change I have done was to add the support of a settings file. It is possible to pass the options to the command line, but can be tedious if there is a lot of them. In the same way, I have added the support of different things over -time: atom feeds, multiple themes, multiple markup support, etc. -At some point, it appears that the “only one file” mantra was not good -enough for pelican, so I decided to rework a bit all that, and split this in +time: Atom feeds, multiple themes, multiple markup support, etc. +At some point, it appears that the "only one file" mantra was not good +enough for Pelican, so I decided to rework a bit all that, and split this in multiple different files. I’ve separated the logic in different classes and concepts: @@ -64,59 +63,59 @@ I’ve separated the logic in different classes and concepts: Since those operations are commonly used, the object is created once, and then passed to the generators. -* *readers* are used to read from various formats (Markdown, and - Restructured Text for now, but the system is extensible). Given a - file, they return metadata (author, tags, category etc) and - content (HTML formated). +* *readers* are used to read from various formats (Markdown and + reStructuredText for now, but the system is extensible). Given a + file, they return metadata (author, tags, category, etc) and + content (HTML formatted). -* *generators* generate the different outputs. For instance, pelican +* *generators* generate the different outputs. For instance, Pelican comes with an ArticlesGenerator and PagesGenerator, into others. Given a configuration, they can do whatever you want - them to do. Most of the time it’s generating files from inputs + them to do. Most of the time it's generating files from inputs (user inputs and files). -I also deal with contents objects. They can be `Articles`, `Pages`, `Quotes`, -or whatever you want. They are defined in the contents.py module, -and represent some content to be used by the program. +I also deal with contents objects. They can be ``Articles``, ``Pages``, +``Quotes``, or whatever you want. They are defined in the ``contents.py`` +module and represent some content to be used by the program. -In more details -=============== +In more detail +============== -Here is an overview of the classes involved in pelican. +Here is an overview of the classes involved in Pelican. .. image:: _static/uml.jpg -The interface do not really exists, and I have added it only to clarify the -whole picture. I do use duck typing, and not interfaces. +The interface does not really exist, and I have added it only to clarify the +whole picture. I do use duck typing and not interfaces. Internally, the following process is followed: * First of all, the command line is parsed, and some content from - the user are used to initialize the different generator objects. + the user is used to initialize the different generator objects. -* A `context` is created. It contains the settings from the command +* A ``context`` is created. It contains the settings from the command line and a settings file if provided. -* The `generate_context` method of each generator is called, updating +* The ``generate_context`` method of each generator is called, updating the context. -* The writer is created, and given to the `generate_output` method of +* The writer is created and given to the ``generate_output`` method of each generator. I make two calls because it is important that when the output is generated by the generators, the context will not change. In other -words, the first method `generate_context` should modify the context, -whereas the second `generate_output` method should not. +words, the first method ``generate_context`` should modify the context, +whereas the second ``generate_output`` method should not. Then, it is up to the generators to do what the want, in the -`generate_context` and `generate_content` method. -Taking the `ArticlesGenerator` class will help to understand some others -concepts. Here is what happens when calling the `generate_context` +``generate_context`` and ``generate_content`` method. +Taking the ``ArticlesGenerator`` class will help to understand some others +concepts. Here is what happens when calling the ``generate_context`` method: * Read the folder “path”, looking for restructured text files, load - each of them, and construct a content object (`Article`) with it. To do so, - use `Reader` objects. -* Update the `context` with all those articles. + each of them, and construct a content object (``Article``) with it. To do so, + use ``Reader`` objects. +* Update the ``context`` with all those articles. -Then, the `generate_content` method uses the `context` and the `writer` to -generate the wanted output +Then, the ``generate_content`` method uses the ``context`` and the ``writer`` to +generate the wanted output. diff --git a/docs/themes.rst b/docs/themes.rst index e0583882..8e432a95 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -3,11 +3,10 @@ How to create themes for Pelican ################################ -Pelican uses the great `jinja2 `_ templating engine to -generate its HTML output. The jinja2 syntax is really simple. If you want to -create your own theme, feel free to take inspiration from the "simple" theme, -which is available `here -`_ +Pelican uses the great `Jinja2 `_ templating engine to +generate its HTML output. Jinja2 syntax is really simple. If you want to +create your own theme, feel free to take inspiration from the `"simple" theme +`_. Structure ========= diff --git a/docs/tips.rst b/docs/tips.rst index 14a79a5e..8905103b 100644 --- a/docs/tips.rst +++ b/docs/tips.rst @@ -12,16 +12,16 @@ file generator, we can take advantage of this. User Pages ---------- -Github allows you to create user pages in the form of ``username.github.com``. -Whatever is created in master branch will be published. For this purposes just -the output generated by pelican needs to pushed at github. +GitHub allows you to create user pages in the form of ``username.github.com``. +Whatever is created in the master branch will be published. For this purpose, +just the output generated by Pelican needs to pushed to GitHub. -So given a repository containing your articles, just run pelican over the posts -and deploy the master branch at github:: +So given a repository containing your articles, just run Pelican over the posts +and deploy the master branch to GitHub:: $ pelican -s pelican.conf.py ./path/to/posts -o /path/to/output -Now add all the files in the output directory generated by pelican:: +Now add all the files in the output directory generated by Pelican:: $ git add /path/to/output/* $ git commit -am "Your Message" @@ -31,12 +31,12 @@ Project Pages ------------- For creating Project pages, a branch called ``gh-pages`` is used for publishing. The excellent `ghp-import `_ makes this -really easy. You will have to install it:: +really easy, which can be installed via:: $ pip install ghp-import -Then, given a repository containing your articles, you would simply have -to run Pelican and upload the output to GitHub:: +Then, given a repository containing your articles, you would simply run +Pelican and upload the output to GitHub:: $ pelican -s pelican.conf.py . $ ghp-import output @@ -45,10 +45,8 @@ to run Pelican and upload the output to GitHub:: And that's it. If you want, you can put that directly into a post-commit hook, so each time you -commit, your blog is up to date on GitHub! +commit, your blog is up-to-date on GitHub! -Put the following into `.git/hooks/post-commit`:: - - pelican -s pelican.conf.py . && ghp-import output && git push origin - gh-pages +Put the following into ``.git/hooks/post-commit``:: + pelican -s pelican.conf.py . && ghp-import output && git push origin gh-pages From 8a53ee1ad36e88604f976ab176ab309fb852eb79 Mon Sep 17 00:00:00 2001 From: Alexandre RODIERE Date: Tue, 3 Jul 2012 15:19:38 +0200 Subject: [PATCH 100/278] Fix typo on debug logger calls. --- pelican/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 6dc7dd36..d42526a3 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -68,10 +68,10 @@ class Pelican(object): for plugin in self.plugins: # if it's a string, then import it if isinstance(plugin, basestring): - log.debug("Loading plugin `{0}' ...".format(plugin)) + logger.debug("Loading plugin `{0}' ...".format(plugin)) plugin = __import__(plugin, globals(), locals(), 'module') - log.debug("Registering plugin `{0}' ...".format(plugin.__name__)) + logger.debug("Registering plugin `{0}' ...".format(plugin.__name__)) plugin.register() def _handle_deprecation(self): From cf696939f8c49d54c8b6f5e6fa13422e3278734e Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Wed, 4 Jul 2012 10:06:53 -0700 Subject: [PATCH 101/278] Added tests for page generation. Currently tests rst & markdown generation, ignoring pages w/ bad status, and status hidden vs published --- tests/TestPages/bad_page.rst | 8 +++++ tests/TestPages/hidden_page.rst | 8 +++++ tests/TestPages/hidden_page_markdown.md | 12 +++++++ tests/TestPages/page.rst | 4 +++ tests/TestPages/page_markdown.md | 9 +++++ tests/test_generators.py | 44 ++++++++++++++++++++++++- 6 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 tests/TestPages/bad_page.rst create mode 100644 tests/TestPages/hidden_page.rst create mode 100644 tests/TestPages/hidden_page_markdown.md create mode 100644 tests/TestPages/page.rst create mode 100644 tests/TestPages/page_markdown.md diff --git a/tests/TestPages/bad_page.rst b/tests/TestPages/bad_page.rst new file mode 100644 index 00000000..bc62948b --- /dev/null +++ b/tests/TestPages/bad_page.rst @@ -0,0 +1,8 @@ +This is a test bad page +####################### + +:status: invalid + +The quick brown fox jumped over the lazy dog's back. + +The status here is invalid, the page should not render. diff --git a/tests/TestPages/hidden_page.rst b/tests/TestPages/hidden_page.rst new file mode 100644 index 00000000..57ca329c --- /dev/null +++ b/tests/TestPages/hidden_page.rst @@ -0,0 +1,8 @@ +This is a test hidden page +########################## + +:status: hidden + +The quick brown fox jumped over the lazy dog's back. + +This page is hidden diff --git a/tests/TestPages/hidden_page_markdown.md b/tests/TestPages/hidden_page_markdown.md new file mode 100644 index 00000000..1e532fe7 --- /dev/null +++ b/tests/TestPages/hidden_page_markdown.md @@ -0,0 +1,12 @@ +title: This is a markdown test hidden page +status: hidden + +Test Markdown File Header +========================= + +Used for pelican test +--------------------- + +The quick brown fox jumped over the lazy dog's back. + +This page is hidden diff --git a/tests/TestPages/page.rst b/tests/TestPages/page.rst new file mode 100644 index 00000000..2d13976d --- /dev/null +++ b/tests/TestPages/page.rst @@ -0,0 +1,4 @@ +This is a test page +################### + +The quick brown fox jumped over the lazy dog's back. diff --git a/tests/TestPages/page_markdown.md b/tests/TestPages/page_markdown.md new file mode 100644 index 00000000..d5416a6f --- /dev/null +++ b/tests/TestPages/page_markdown.md @@ -0,0 +1,9 @@ +title: This is a markdown test page + +Test Markdown File Header +========================= + +Used for pelican test +--------------------- + +The quick brown fox jumped over the lazy dog's back. diff --git a/tests/test_generators.py b/tests/test_generators.py index e62551fa..cc84c80f 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -4,7 +4,7 @@ from mock import MagicMock import os import re -from pelican.generators import ArticlesGenerator, LessCSSGenerator +from pelican.generators import ArticlesGenerator, LessCSSGenerator, PagesGenerator from pelican.settings import _DEFAULT_CONFIG from .support import unittest, temporary_folder, skipIfNoExecutable @@ -94,6 +94,48 @@ class TestArticlesGenerator(unittest.TestCase): write.assert_called_count == 0 +class TestPageGenerator(unittest.TestCase): + """ + Every time you want to test for a new field; + Make sure the test pages in "TestPages" have all the fields + Add it to distilled in distill_pages_for_test + Then update the assertItemsEqual in test_generate_context to match expected + """ + + def distill_pages_for_test(self, pages): + distilled = [] + for page in pages: + distilled.append([ + page.title, + page.status + ] + ) + return distilled + + def test_generate_context(self): + settings = _DEFAULT_CONFIG.copy() + + settings['PAGE_DIR'] = 'TestPages' + generator = PagesGenerator(settings.copy(), settings, CUR_DIR, + _DEFAULT_CONFIG['THEME'], None, + _DEFAULT_CONFIG['MARKUP']) + generator.generate_context() + pages = self.distill_pages_for_test(generator.pages) + hidden_pages = self.distill_pages_for_test(generator.hidden_pages) + + pages_expected = [ + [u'This is a test page', 'published'], + [u'This is a markdown test page', 'published'] + ] + hidden_pages_expected = [ + [u'This is a test hidden page', 'hidden'], + [u'This is a markdown test hidden page', 'hidden'] + ] + + self.assertItemsEqual(pages_expected,pages) + self.assertItemsEqual(hidden_pages_expected,hidden_pages) + + class TestLessCSSGenerator(unittest.TestCase): LESS_CONTENT = """ From d589450200c1ce9e14eefad63dc099767af64ada Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Wed, 4 Jul 2012 12:32:20 -0700 Subject: [PATCH 102/278] Change behavior of DELETE_OUTPUT_DIRECTORY to purge contents of the directory, not the directory itself. Added Debug level logging for each deletion Added error level logging when a delete has an exception Built a test case for clean_output_directory in tests.utils.py Updated `settings` in documentation to reflect new behavior Removed the tip from the bottom of getting started since this setting should no longer break web servers pointing to the output directory. --- docs/getting_started.rst | 2 -- docs/settings.rst | 4 ++-- pelican/utils.py | 20 ++++++++++++++++---- tests/test_utils.py | 11 +++++++++++ 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index cd186a1c..a0975bd5 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -234,5 +234,3 @@ Or run a simple web server using Python:: cd output && python -m SimpleHTTPServer -(Tip: If using the latter method in conjunction with the auto-reload feature, -ensure that ``DELETE_OUTPUT_DIRECTORY`` is set to ``False`` in your settings file.) diff --git a/docs/settings.rst b/docs/settings.rst index 65561d5d..c5aa7f4e 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -37,8 +37,8 @@ Setting name (default value) What doe timestamp information (mtime) if it can't get date information from the metadata. `JINJA_EXTENSIONS` (``[]``) A list of any Jinja2 extensions you want to use. -`DELETE_OUTPUT_DIRECTORY` (``False``) Delete the output directory as well as - the generated files. +`DELETE_OUTPUT_DIRECTORY` (``False``) Delete the contents of the output directory before + generating new files. `LOCALE` (''[#]_) Change the locale. A list of locales can be provided here or a single string representing one locale. When providing a list, all the locales will be tried diff --git a/pelican/utils.py b/pelican/utils.py index 0940bf72..a1c40077 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -92,10 +92,22 @@ def clean_output_dir(path): """Remove all the files from the output directory""" # remove all the existing content from the output folder - try: - shutil.rmtree(path) - except Exception: - pass + for filename in os.listdir(path): + file = os.path.join(path, filename) + if os.path.isdir(file): + logger.debug("Deleting directory %s" % file) + try: + shutil.rmtree(file) + except Exception, e: + logger.error("Unable to delete directory %s; %e" % file, e) + elif os.path.isfile(file) or os.path.islink(file): + logger.debug("Deleting file/link %s" % file) + try: + os.remove(file) + except Exception, e: + logger.error("Unable to delete file %s; %e" % file, e) + else: + logger.error("Unable to delete %s, file type unknown" % file) def get_relative_path(filename): diff --git a/tests/test_utils.py b/tests/test_utils.py index e738e295..d2f44131 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import shutil import os import datetime import time @@ -86,3 +87,13 @@ class TestUtils(unittest.TestCase): changed = utils.files_changed(path, 'rst') self.assertEquals(changed, True) self.assertAlmostEqual(utils.LAST_MTIME, t, delta=1) + + def test_clean_output_dir(self): + 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) + self.assertTrue(os.path.isdir(test_directory)) + self.assertListEqual([], os.listdir(test_directory)) + shutil.rmtree(test_directory) + From 2b062ce384c5e75e4af0d137351d97aea8c5ed39 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Wed, 4 Jul 2012 14:55:39 -0700 Subject: [PATCH 103/278] Documentation typo --- docs/settings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index c5aa7f4e..78ede790 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -37,7 +37,7 @@ Setting name (default value) What doe timestamp information (mtime) if it can't get date information from the metadata. `JINJA_EXTENSIONS` (``[]``) A list of any Jinja2 extensions you want to use. -`DELETE_OUTPUT_DIRECTORY` (``False``) Delete the contents of the output directory before +`DELETE_OUTPUT_DIRECTORY` (``False``) Delete the content of the output directory before generating new files. `LOCALE` (''[#]_) Change the locale. A list of locales can be provided here or a single string representing one locale. From c07821e8a210c70eef91067223cebe388481ad71 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Wed, 4 Jul 2012 14:56:52 -0700 Subject: [PATCH 104/278] Too many empty lines at end of file --- tests/test_utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index d2f44131..2e3f714b 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -96,4 +96,3 @@ class TestUtils(unittest.TestCase): self.assertTrue(os.path.isdir(test_directory)) self.assertListEqual([], os.listdir(test_directory)) shutil.rmtree(test_directory) - From b44ea53741f7baab89371718c9a7eba07010bb91 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 00:04:32 +0200 Subject: [PATCH 105/278] update command to generate functional tests output we need to force LC_ALL="C" to avoid generating articles/pages in other languages --- docs/contribute.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contribute.rst b/docs/contribute.rst index 3960b3f9..0090dd07 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -43,9 +43,9 @@ If you have made changes that affect the output of a pelican generated weblog, then you should update the output used by functional tests. To do so, you can use the 2 following commands:: - $ pelican -o tests/output/custom/ -s samples/pelican.conf.py \ + $ LC_ALL="C" pelican -o tests/output/custom/ -s samples/pelican.conf.py \ samples/content/ - $ USER="Dummy Author" pelican -o tests/output/basic/ samples/content/ + $ LC_ALL="C" USER="Dummy Author" pelican -o tests/output/basic/ samples/content/ Coding standards ================ From 36be150f200c009d334d525a9fbeba59c3aa2d11 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 00:07:01 +0200 Subject: [PATCH 106/278] replace FALLBACK_ON_FS_DATE by DEFAULT_DATE DEFAULT_DATE allows to specify any default date as a tuple in addition to the fallback on filesystem mtime check --- pelican/generators.py | 8 ++++++-- pelican/settings.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index ede948a4..dd5eb89e 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -268,9 +268,13 @@ class ArticlesGenerator(Generator): if category != '': metadata['category'] = Category(category, self.settings) - if 'date' not in metadata and self.settings['FALLBACK_ON_FS_DATE']: + if 'date' not in metadata and self.settings['DEFAULT_DATE']: + if self.settings['DEFAULT_DATE'] == 'fs': metadata['date'] = datetime.datetime.fromtimestamp( - os.stat(f).st_ctime) + os.stat(f).st_ctime) + else: + metadata['date'] = datetime.datetime( + *self.settings['DEFAULT_DATE']) article = Article(content, metadata, settings=self.settings, filename=f) diff --git a/pelican/settings.py b/pelican/settings.py index 4da66989..08b01133 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -29,7 +29,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'DISPLAY_PAGES_ON_MENU': True, 'PDF_GENERATOR': False, 'DEFAULT_CATEGORY': 'misc', - 'FALLBACK_ON_FS_DATE': True, + 'DEFAULT_DATE': 'fs', 'WITH_FUTURE_DATES': True, 'CSS_FILE': 'main.css', 'REVERSE_ARCHIVE_ORDER': False, From 775b236c934afab3df47b16c51806d1061c91a54 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 00:08:54 +0200 Subject: [PATCH 107/278] update doc for replacing FALLBACK_ON_FS_DATE by DEFAULT_DATE --- docs/fr/configuration.rst | 8 ++++++-- docs/settings.rst | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/fr/configuration.rst b/docs/fr/configuration.rst index 695a0b0e..7dffd8ab 100644 --- a/docs/fr/configuration.rst +++ b/docs/fr/configuration.rst @@ -130,8 +130,12 @@ Pelican est fournit avec :doc:`pelican-themes`, un script permettant de gérer l Paramètres divers ================= -FALLBACK_ON_FS_DATE : - Si *True*, Pelican se basera sur le *mtime* du fichier s'il n'y a pas de date spécifiée dans le fichier de l'article ; +DEFAULT_DATE: + Date par défaut à utiliser si l'information de date n'est pas spécifiée + dans les metadonnées de l'article. + Si 'fs', Pelican se basera sur le *mtime* du fichier. + Si c'est un tuple, il sera passé au constructeur datetime.datetime pour + générer l'objet datetime utilisé par défaut. KEEP_OUTPUT DIRECTORY : Ne génère que les fichiers modifiés et n'efface pas le repertoire de sortie ; diff --git a/docs/settings.rst b/docs/settings.rst index 85e9f0c3..199faefe 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -33,9 +33,13 @@ Setting name (default value) What doe `DISPLAY_PAGES_ON_MENU` (``True``) Whether to display pages on the menu of the template. Templates may or not honor this setting. -`FALLBACK_ON_FS_DATE` (``True``) If True, Pelican will use the file system +`DEFAULT_DATE` (``fs``) The default date you want to use. + If 'fs', Pelican will use the file system timestamp information (mtime) if it can't get date information from the metadata. + If tuple object, it will instead generate the + default datetime object by passing the tuple to + the datetime.datetime constructor. `JINJA_EXTENSIONS` (``[]``) A list of any Jinja2 extensions you want to use. `DELETE_OUTPUT_DIRECTORY` (``False``) Delete the output directory as well as the generated files. From 3a2df479da5890716e3730716565eeb54a34df02 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 00:10:08 +0200 Subject: [PATCH 108/278] fix test_custom_generation_works functional test --- samples/pelican.conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py index fffbf1a8..e55e0c0b 100755 --- a/samples/pelican.conf.py +++ b/samples/pelican.conf.py @@ -10,6 +10,7 @@ PDF_GENERATOR = False REVERSE_CATEGORY_ORDER = True LOCALE = "C" DEFAULT_PAGINATION = 4 +DEFAULT_DATE = (2012, 03, 02, 14, 01, 01) FEED_RSS = 'feeds/all.rss.xml' CATEGORY_FEED_RSS = 'feeds/%s.rss.xml' From 7abb2a7a7ce519b4d7e9865aa9e130ad287073f0 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 00:11:06 +0200 Subject: [PATCH 109/278] temporary skip failing test_basic_generation_works functional test --- tests/test_pelican.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 0458d58c..15088ed0 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -35,6 +35,7 @@ class TestPelican(unittest.TestCase): rmtree(self.temp_path) locale.setlocale(locale.LC_ALL, self.old_locale) + @unittest.skip("Test failing") def test_basic_generation_works(self): # when running pelican without settings, it should pick up the default # ones and generate the output without raising any exception / issuing From 4427424db39c95890a30d2a6293d129002e2dc04 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Wed, 4 Jul 2012 15:20:15 -0700 Subject: [PATCH 110/278] Changed debugging reporting to post file deletion instead of pre file deletion per request. --- pelican/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/utils.py b/pelican/utils.py index a1c40077..f0f742db 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -95,15 +95,15 @@ def clean_output_dir(path): for filename in os.listdir(path): file = os.path.join(path, filename) if os.path.isdir(file): - logger.debug("Deleting directory %s" % file) try: shutil.rmtree(file) + logger.debug("Deleted directory %s" % file) except Exception, e: logger.error("Unable to delete directory %s; %e" % file, e) elif os.path.isfile(file) or os.path.islink(file): - logger.debug("Deleting file/link %s" % file) try: os.remove(file) + logger.debug("Deleted file/link %s" % file) except Exception, e: logger.error("Unable to delete file %s; %e" % file, e) else: From 2b47429c4a6c1a6cc42421b27a237dbf1dd07cd8 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 5 Jul 2012 01:51:58 +0200 Subject: [PATCH 111/278] update generated output for 'custom' functional test LC_ALL="C" pelican -o tests/output/custom/ -s samples/pelican.conf.py samples/content/ --- .../custom/a-markdown-powered-article.html | 2 +- tests/output/custom/archives.html | 2 +- tests/output/custom/article-1.html | 2 +- tests/output/custom/article-2.html | 2 +- tests/output/custom/article-3.html | 2 +- .../custom/author/alexis-metaireau.html | 20 +-- .../custom/author/alexis-metaireau2.html | 27 ++-- tests/output/custom/categories.html | 4 +- tests/output/custom/category/bar.html | 4 +- tests/output/custom/category/cat1.html | 20 +-- .../category/{content.html => misc.html} | 18 +-- tests/output/custom/category/yeah.html | 4 +- .../output/custom/drafts/a-draft-article.html | 4 +- .../feeds/{content.atom.xml => misc.atom.xml} | 2 +- .../feeds/{content.rss.xml => misc.rss.xml} | 2 +- tests/output/custom/index.html | 22 +-- tests/output/custom/index2.html | 25 ++-- tests/output/custom/oh-yeah-fr.html | 4 +- tests/output/custom/oh-yeah.html | 2 +- .../pages/this-is-a-test-hidden-page.html | 125 ++++++++++++++++++ .../custom/pages/this-is-a-test-page.html | 2 +- tests/output/custom/second-article-fr.html | 4 +- tests/output/custom/second-article.html | 4 +- tests/output/custom/tag/bar.html | 24 ++-- tests/output/custom/tag/baz.html | 16 +-- tests/output/custom/tag/foo.html | 20 +-- tests/output/custom/tag/foobar.html | 4 +- tests/output/custom/tag/oh.html | 4 +- tests/output/custom/tag/yeah.html | 4 +- tests/output/custom/theme/css/main.css | 1 + .../custom/theme/images/icons/gitorious.png | Bin 0 -> 3675 bytes .../custom/this-is-a-super-article.html | 2 +- tests/output/custom/unbelievable.html | 4 +- 33 files changed, 255 insertions(+), 127 deletions(-) rename tests/output/custom/category/{content.html => misc.html} (94%) rename tests/output/custom/feeds/{content.atom.xml => misc.atom.xml} (56%) rename tests/output/custom/feeds/{content.rss.xml => misc.rss.xml} (76%) create mode 100644 tests/output/custom/pages/this-is-a-test-hidden-page.html create mode 100644 tests/output/custom/theme/images/icons/gitorious.png diff --git a/tests/output/custom/a-markdown-powered-article.html b/tests/output/custom/a-markdown-powered-article.html index 28486691..d3d0f53c 100644 --- a/tests/output/custom/a-markdown-powered-article.html +++ b/tests/output/custom/a-markdown-powered-article.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/archives.html b/tests/output/custom/archives.html index 083e6ada..3be563df 100644 --- a/tests/output/custom/archives.html +++ b/tests/output/custom/archives.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/article-1.html b/tests/output/custom/article-1.html index b7c0f46f..4402d227 100644 --- a/tests/output/custom/article-1.html +++ b/tests/output/custom/article-1.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/article-2.html b/tests/output/custom/article-2.html index e60d8077..ec6a86c8 100644 --- a/tests/output/custom/article-2.html +++ b/tests/output/custom/article-2.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/article-3.html b/tests/output/custom/article-3.html index b79c25f0..0d39654c 100644 --- a/tests/output/custom/article-3.html +++ b/tests/output/custom/article-3.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index 85f550b4..b60a01ef 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -41,7 +41,7 @@
  • yeah
  • -
  • content
  • +
  • misc
  • cat1
  • @@ -85,7 +85,6 @@ - @@ -93,7 +92,8 @@
  • - @@ -128,7 +127,8 @@
  • - @@ -163,7 +162,8 @@
  • + +

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

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

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

  • + +

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

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

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

    Page 1 / 1

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

    In content.

    +

    In misc.

    tags: foobarbaz

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

    Page 1 / 1

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

    In content.

    +

    In misc.

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

    In content.

    +

    In misc.

    tags: foobarbaz

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

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

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

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

  • + +

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

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

    In content.

    +

    In misc.

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

    This is a test hidden page

    + +

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

    + +
    + +
    + +
    +

    blogroll

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

    In content.

    +

    In misc.

    tags: foobarbaz

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

    In content.

    +

    In misc.

    tags: foobarbaz

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

    In content.

    +

    In misc.

    tags: foobarbaz

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

  • + +

    Page 1 / 1

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

    In content.

    +

    In misc.

    tags: foobarbaz

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

    Page 1 / 1

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

    In content.

    +

    In misc.

    tags: foobarbaz

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

    Page 1 / 1

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

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

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

    In content.

    +

    In misc.

    From 886a1d94b957ac4f79b2a40a0438f69b1bf1ce5c Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Wed, 4 Jul 2012 17:09:42 -0700 Subject: [PATCH 112/278] Changed name of the page helper method to prevent nose from running it as a test --- tests/test_generators.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_generators.py b/tests/test_generators.py index cc84c80f..61f31696 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -98,11 +98,11 @@ class TestPageGenerator(unittest.TestCase): """ Every time you want to test for a new field; Make sure the test pages in "TestPages" have all the fields - Add it to distilled in distill_pages_for_test + Add it to distilled in distill_pages Then update the assertItemsEqual in test_generate_context to match expected """ - def distill_pages_for_test(self, pages): + def distill_pages(self, pages): distilled = [] for page in pages: distilled.append([ @@ -120,8 +120,8 @@ class TestPageGenerator(unittest.TestCase): _DEFAULT_CONFIG['THEME'], None, _DEFAULT_CONFIG['MARKUP']) generator.generate_context() - pages = self.distill_pages_for_test(generator.pages) - hidden_pages = self.distill_pages_for_test(generator.hidden_pages) + pages = self.distill_pages(generator.pages) + hidden_pages = self.distill_pages(generator.hidden_pages) pages_expected = [ [u'This is a test page', 'published'], From 72421d443844e8bf7e79d76baa8766d0a7a59c8a Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Thu, 5 Jul 2012 11:34:45 -0700 Subject: [PATCH 113/278] Support arbitrary SSH ports in pelican-quickstart Some folks choose non-standard SSH ports for security reasons, so it makes sense to try to support that in the pelican-quickstart script. --- pelican/tools/pelican_quickstart.py | 2 ++ pelican/tools/templates/Makefile.in | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index cfd9bb4c..b5da8926 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -19,6 +19,7 @@ CONF = { 'ftp_user': 'anonymous', 'ftp_target_dir': '/', 'ssh_host': 'locahost', + 'ssh_port': 22, 'ssh_user': 'root', 'ssh_target_dir': '/var/www', 'dropbox_dir' : '~/Dropbox/Public/', @@ -159,6 +160,7 @@ Please answer the following questions so this script can generate the files need if ask('Do you want to upload your website using SSH ?', answer=bool, default=False): CONF['ssh_host'] = ask('What is the hostname of your SSH server ?', str, CONF['ssh_host']) + CONF['ssh_port'] = ask('What is the port of your SSH server?', int, CONF['ssh_port']) CONF['ssh_user'] = ask('What is your username on this server ?', str, CONF['ssh_user']) CONF['ssh_target_dir'] = ask('Where do you want to put your website on this server ?', str, CONF['ssh_target_dir']) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 998d8c97..392336d7 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -11,6 +11,7 @@ FTP_USER=$ftp_user FTP_TARGET_DIR=$ftp_target_dir SSH_HOST=$ssh_host +SSH_PORT=$ssh_port SSH_USER=$ssh_user SSH_TARGET_DIR=$ssh_target_dir @@ -43,10 +44,10 @@ dropbox_upload: $$(OUTPUTDIR)/index.html cp -r $$(OUTPUTDIR)/* $$(DROPBOX_DIR) ssh_upload: $$(OUTPUTDIR)/index.html - scp -r $$(OUTPUTDIR)/* $$(SSH_USER)@$$(SSH_HOST):$$(SSH_TARGET_DIR) + scp -P $$(SSH_PORT) -r $$(OUTPUTDIR)/* $$(SSH_USER)@$$(SSH_HOST):$$(SSH_TARGET_DIR) rsync_upload: $$(OUTPUTDIR)/index.html - rsync -e ssh -P -rvz --delete $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) + rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) ftp_upload: $$(OUTPUTDIR)/index.html lftp ftp://$$(FTP_USER)@$$(FTP_HOST) -e "mirror -R $$(OUTPUTDIR) $$(FTP_TARGET_DIR) ; quit" From d8b85580dc8eb32a718a1e7331b47c4c26061bf0 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Thu, 5 Jul 2012 12:15:55 -0700 Subject: [PATCH 114/278] Minor syntactical improvements to quickstart --- pelican/tools/pelican_quickstart.py | 30 ++++++++++------------ pelican/tools/templates/pelican.conf.py.in | 2 +- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index b5da8926..0e713fe8 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -18,7 +18,7 @@ CONF = { 'ftp_host': 'localhost', 'ftp_user': 'anonymous', 'ftp_target_dir': '/', - 'ssh_host': 'locahost', + 'ssh_host': 'localhost', 'ssh_port': 22, 'ssh_user': 'root', 'ssh_target_dir': '/var/www', @@ -89,7 +89,7 @@ def ask(question, answer=str, default=None, l=None): r = default break else: - print("You must answer `yes' or `no'") + print("You must answer 'yes' or 'no'") return r elif answer == int: r = None @@ -112,12 +112,12 @@ def ask(question, answer=str, default=None, l=None): print('You must enter an integer') return r else: - raise NotImplemented('Arguent `answer` must be str, bool or integer') + raise NotImplemented('Argument `answer` must be str, bool, or integer') def main(): parser = argparse.ArgumentParser( - description="A kickstarter for pelican", + description="A kickstarter for Pelican", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-p', '--path', default=".", help="The path to generate the blog into") @@ -126,7 +126,7 @@ def main(): parser.add_argument('-a', '--author', metavar="author", help='Set the author name of the website') parser.add_argument('-l', '--lang', metavar="lang", - help='Set the default lang of the website') + help='Set the default web site language') args = parser.parse_args() @@ -138,15 +138,15 @@ Please answer the following questions so this script can generate the files need '''.format(v=__version__)) - CONF['basedir'] = os.path.abspath(ask('Where do you want to create your new Web site ?', answer=str, default=args.path)) - CONF['sitename'] = ask('What will be the title of this Web site ?', answer=str, default=args.title) - CONF['author'] = ask('Who will be the author of this Web site ?', answer=str, default=args.author) - CONF['lang'] = ask('What will be the default language of this Web site ?', str, args.lang or CONF['lang'], 2) + CONF['basedir'] = os.path.abspath(ask('Where do you want to create your new web site?', answer=str, default=args.path)) + CONF['sitename'] = ask('What will be the title of this web site?', answer=str, default=args.title) + CONF['author'] = ask('Who will be the author of this web site?', answer=str, default=args.author) + CONF['lang'] = ask('What will be the default language of this web site ?', str, args.lang or CONF['lang'], 2) CONF['with_pagination'] = ask('Do you want to enable article pagination ?', bool, bool(CONF['default_pagination'])) if CONF['with_pagination']: - CONF['default_pagination'] = ask('So how many articles per page do you want ?', int, CONF['default_pagination']) + CONF['default_pagination'] = ask('How many articles per page do you want?', int, CONF['default_pagination']) else: CONF['default_pagination'] = False @@ -155,15 +155,13 @@ Please answer the following questions so this script can generate the files need if mkfile: if ask('Do you want to upload your website using FTP ?', answer=bool, default=False): CONF['ftp_host'] = ask('What is the hostname of your FTP server ?', str, CONF['ftp_host']) - CONF['ftp_user'] = ask('What is your username on this server ?', str, CONF['ftp_user']) - CONF['ftp_target_dir'] = ask('Where do you want to put your website on this server ?', str, CONF['ftp_target_dir']) - + CONF['ftp_user'] = ask('What is your username on that server?', str, CONF['ftp_user']) + CONF['ftp_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ftp_target_dir']) if ask('Do you want to upload your website using SSH ?', answer=bool, default=False): CONF['ssh_host'] = ask('What is the hostname of your SSH server ?', str, CONF['ssh_host']) CONF['ssh_port'] = ask('What is the port of your SSH server?', int, CONF['ssh_port']) - CONF['ssh_user'] = ask('What is your username on this server ?', str, CONF['ssh_user']) - CONF['ssh_target_dir'] = ask('Where do you want to put your website on this server ?', str, CONF['ssh_target_dir']) - + CONF['ssh_user'] = ask('What is your username on that server?', str, CONF['ssh_user']) + CONF['ssh_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ssh_target_dir']) if ask('Do you want to upload your website using Dropbox ?', answer=bool, default=False): CONF['dropbox_dir'] = ask('Where is your Dropbox directory ?', str, CONF['dropbox_dir']) diff --git a/pelican/tools/templates/pelican.conf.py.in b/pelican/tools/templates/pelican.conf.py.in index ee56048e..095a7e7d 100644 --- a/pelican/tools/templates/pelican.conf.py.in +++ b/pelican/tools/templates/pelican.conf.py.in @@ -3,7 +3,7 @@ AUTHOR = u"$author" SITENAME = u"$sitename" -SITEURL = '/' +SITEURL = '' TIMEZONE = 'Europe/Paris' From 764a2cfa5100d1cd70699e33d328c1203e201a00 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 7 Jul 2012 07:41:12 -0700 Subject: [PATCH 115/278] Add dual dev/publish modes to quickstart script Certain configuration options are more useful in production than they are in development. Some examples might be absolute URLs, external analytics service identifiers, Disqus comments, etc. This version of the quickstart script creates two configuration files: one for development and the other for use when publishing. In addition, the related docs have been expanded considerably. Last but not least, the quickstart script will now detect whether there is a project folder associated with the currently active virtualenv (if any) and use it by default. --- docs/getting_started.rst | 109 +++++++++++++----- docs/settings.rst | 25 ++-- pelican/tools/pelican_quickstart.py | 45 +++++--- pelican/tools/templates/Makefile.in | 38 +++--- .../{pelican.conf.py.in => pelicanconf.py.in} | 0 pelican/tools/templates/publishconf.py.in | 17 +++ 6 files changed, 170 insertions(+), 64 deletions(-) rename pelican/tools/templates/{pelican.conf.py.in => pelicanconf.py.in} (100%) create mode 100644 pelican/tools/templates/publishconf.py.in diff --git a/docs/getting_started.rst b/docs/getting_started.rst index aa04dd03..954dac3d 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -1,15 +1,70 @@ Getting started ############### -Installing -========== +Kickstart a blog +================ -You're ready? Let's go! You can install Pelican via several different methods. +You're ready? Let's go! Following is a brief tutorial for those who want to get +started right away. Subsequent sections below will cover individual topics in +greater detail. To get started, here are some recommended install steps for +Pelican:: + + $ sudo pip install --upgrade virtualenv virtualenvwrapper + $ mkvirtualenv pelican + $ pip install pelican Markdown + $ mkdir ~/code/yoursitename # (where you want your new site code to be saved) + $ cd ~/code/yoursitename + $ setvirtualenvproject + $ pelican-quickstart + +Once you've run that last ``pelican-quickstart`` command, you'll be asked some +questions about your site. Once you finish answering all the questions, you can +begin 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.) Once you have some content to generate, you +can convert it to HTML via the following command:: + + $ make html + +If you'd prefer to have Pelican automatically regenerate your site every time a +change is detected (handy when testing locally), use the following command +instead:: + + $ make regenerate + +To preview the site in your browser, open a new terminal tab and enter:: + + $ workon yoursitename + $ make serve + +Visit http://localhost:8000 in your browser to see your site. + +When you're ready to publish your site, you can upload it via the method(s) you +chose during the ``pelican-quickstart`` questionnaire. For this example, we'll +use rsync over ssh:: + + $ make rsync_upload + +That's it! Your site should now be live. + +Closing the current terminal session will also close the virtual environment in +which we installed Pelican. In the future, when you want to work on your site, +you can activate its virtual environment via:: + + $ workon yoursitename + +Not only will that command activate your new site's virtual environment, but it +will also automatically change your working directory to your site project. + +Installing Pelican +================== + +You can install Pelican via several different methods. The simplest is via `pip `_:: $ pip install pelican -If you don't have pip installed, an alternative method is easy_install:: +If you don't have ``pip`` installed, an alternative method is ``easy_install``:: $ easy_install pelican @@ -18,12 +73,12 @@ a virtual environment for Pelican via `virtualenv `_ and `virtualenvwrapper `_ before installing Pelican:: - $ pip install virtualenvwrapper + $ sudo pip install --upgrade virtualenv virtualenvwrapper $ mkvirtualenv pelican Once the virtual environment has been created and activated, Pelican can be -be installed via pip or easy_install as noted above. Alternatively, if you -have the project source, you can install Pelican using the distutils +be installed via ``pip`` or ``easy_install`` as noted above. Alternatively, if +you have the project source, you can install Pelican using the distutils method:: $ cd path-to-Pelican-source @@ -34,6 +89,11 @@ version of Pelican rather than a stable release, use the following command:: $ pip install -e git://github.com/ametaireau/pelican#egg=pelican +If you plan on using Markdown as a markup format, you'll need to install the +Markdown library as well:: + + $ pip install Markdown + Upgrading --------- @@ -83,7 +143,6 @@ following syntax (give your file the ``.rst`` extension):: :category: yeah :author: Alexis Metaireau - You can also use Markdown syntax (with a file ending in ``.md``). Markdown generation will not work until you explicitly install the ``Markdown`` package, which can be done via ``pip install Markdown``. Metadata syntax for @@ -105,27 +164,28 @@ example, a file located at ``python/foobar/myfoobar.rst`` will have a category o Generate your blog ------------------ -To launch Pelican, just use the ``pelican`` command:: +The ``make`` shortcut commands mentioned in the ``Kickstart a blog`` section +are mostly wrappers around the ``pelican`` command that generates the HTML from +the content. The ``pelican`` command can also be run directly:: $ pelican /path/to/your/content/ [-s path/to/your/settings.py] -And… that's all! Your weblog will be generated and saved in the ``content/`` -folder. +The above command will generate your weblog and save it in the ``content/`` +folder, using the default theme to produce a simple site. It's not +very sexy, as it's just simple HTML output (without any style). You can create +your own style if you want. -The above command will use the default theme to produce a simple site. It's not -very sexy, as it's just simple HTML output (without any style). - -You can create your own style if you want. Have a look at the help to see all -the options you can use:: +Pelican has other command-line switches available. Have a look at the help to +see all the options you can use:: $ pelican --help -Kickstart a blog ----------------- +Auto-reload +----------- -You also can use the ``pelican-quickstart`` script to start a new blog in -seconds by just answering a few questions. Just run ``pelican-quickstart`` and -you're done! (Added in Pelican 3.0) +It's possible to tell Pelican to watch for your modifications, instead of +manually re-running it every time you want to see your changes. To enable this, +run the ``pelican`` command with the ``-r`` or ``--autoreload`` option. Pages ----- @@ -209,13 +269,6 @@ For Markdown, format your code blocks thusly:: The specified identifier should be one that appears on the `list of available lexers `_. -Auto-reload ------------ - -It's possible to tell Pelican to watch for your modifications, instead of -manually re-running it every time you want to see your changes. To enable this, -run the ``pelican`` command with the ``-r`` or ``--autoreload`` option. - Publishing drafts ----------------- diff --git a/docs/settings.rst b/docs/settings.rst index 78ede790..3c557e87 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -59,18 +59,16 @@ Setting name (default value) What doe `PDF_GENERATOR` (``False``) Set to True if you want to have PDF versions of your documents. You will need to install `rst2pdf`. -`RELATIVE_URLS` (``True``) Defines whether Pelican should use relative URLs or - not. +`RELATIVE_URLS` (``True``) Defines whether Pelican should use document-relative URLs or + not. If set to ``False``, Pelican will use the SITEURL + setting to construct absolute URLs. `PLUGINS` (``[]``) The list of plugins to load. See :ref:`plugins`. `SITENAME` (``'A Pelican Blog'``) Your site name `SITEURL` Base URL of your website. Not defined by default, - which means the base URL is assumed to be "/" with a - root-relative URL structure. If `SITEURL` is specified - explicitly, there should be no trailing slash at the end, - and URLs will be generated with an absolute URL structure - (including the domain). If you want to use relative URLs - instead of root-relative or absolute URLs, you should - instead use the `RELATIVE_URL` setting. + so it is best to specify your SITEURL; if you do not, feeds + 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_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 @@ -107,6 +105,15 @@ Setting name (default value) What doe URL settings ------------ +The first thing to understand is that there are currently two supported methods +for URL formation: *relative* and *absolute*. Document-relative URLs are useful +when testing locally, and absolute URLs are reliable and most useful when +publishing. One method of supporting both is to have one Pelican configuration +file for local development and another for publishing. To see an example of this +type of setup, use the ``pelican-quickstart`` script as described at the top of +the :doc:`Getting Started` page, which will produce two separate +configuration files for local development and publishing, respectively. + You can customize the URLs and locations where files will be saved. The URLs and SAVE_AS variables use Python's format strings. These variables allow you to place your articles in a location such as '{slug}/index.html' and link to them as diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index 0e713fe8..f747d048 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -24,6 +24,7 @@ CONF = { 'ssh_target_dir': '/var/www', 'dropbox_dir' : '~/Dropbox/Public/', 'default_pagination' : 10, + 'siteurl': '', 'lang': 'en' } @@ -138,35 +139,44 @@ Please answer the following questions so this script can generate the files need '''.format(v=__version__)) - CONF['basedir'] = os.path.abspath(ask('Where do you want to create your new web site?', answer=str, default=args.path)) + project = os.path.join(os.environ['VIRTUAL_ENV'], '.project') + if os.path.isfile(project): + CONF['basedir'] = open(project, 'r').read().rstrip("\n") + print('Using project associated with current virtual environment. Will save to:\n%s\n' % CONF['basedir']) + else: + CONF['basedir'] = os.path.abspath(ask('Where do you want to create your new web site?', answer=str, default=args.path)) + CONF['sitename'] = ask('What will be the title of this web site?', answer=str, default=args.title) CONF['author'] = ask('Who will be the author of this web site?', answer=str, default=args.author) - CONF['lang'] = ask('What will be the default language of this web site ?', str, args.lang or CONF['lang'], 2) + CONF['lang'] = ask('What will be the default language of this web site?', str, args.lang or CONF['lang'], 2) - CONF['with_pagination'] = ask('Do you want to enable article pagination ?', bool, bool(CONF['default_pagination'])) + if ask('Do you want to specify a URL prefix? e.g., http://example.com ', answer=bool, default=True): + CONF['siteurl'] = ask('What is your URL prefix? (see above example; no trailing slash)', str, CONF['siteurl']) + + CONF['with_pagination'] = ask('Do you want to enable article pagination?', bool, bool(CONF['default_pagination'])) if CONF['with_pagination']: CONF['default_pagination'] = ask('How many articles per page do you want?', int, CONF['default_pagination']) else: CONF['default_pagination'] = False - mkfile = ask('Do you want to generate a Makefile to easily manage your website ?', bool, True) + mkfile = ask('Do you want to generate a Makefile to easily manage your website?', bool, True) if mkfile: - if ask('Do you want to upload your website using FTP ?', answer=bool, default=False): - CONF['ftp_host'] = ask('What is the hostname of your FTP server ?', str, CONF['ftp_host']) + if ask('Do you want to upload your website using FTP?', answer=bool, default=False): + CONF['ftp_host'] = ask('What is the hostname of your FTP server?', str, CONF['ftp_host']) CONF['ftp_user'] = ask('What is your username on that server?', str, CONF['ftp_user']) CONF['ftp_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ftp_target_dir']) - if ask('Do you want to upload your website using SSH ?', answer=bool, default=False): - CONF['ssh_host'] = ask('What is the hostname of your SSH server ?', str, CONF['ssh_host']) + if ask('Do you want to upload your website using SSH?', answer=bool, default=False): + CONF['ssh_host'] = ask('What is the hostname of your SSH server?', str, CONF['ssh_host']) CONF['ssh_port'] = ask('What is the port of your SSH server?', int, CONF['ssh_port']) CONF['ssh_user'] = ask('What is your username on that server?', str, CONF['ssh_user']) CONF['ssh_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ssh_target_dir']) - if ask('Do you want to upload your website using Dropbox ?', answer=bool, default=False): - CONF['dropbox_dir'] = ask('Where is your Dropbox directory ?', str, CONF['dropbox_dir']) + if ask('Do you want to upload your website using Dropbox?', answer=bool, default=False): + CONF['dropbox_dir'] = ask('Where is your Dropbox directory?', str, CONF['dropbox_dir']) try: - os.makedirs(os.path.join(CONF['basedir'], 'src')) + os.makedirs(os.path.join(CONF['basedir'], 'content')) except OSError, e: print('Error: {0}'.format(e)) @@ -176,8 +186,17 @@ Please answer the following questions so this script can generate the files need print('Error: {0}'.format(e)) try: - with open(os.path.join(CONF['basedir'], 'pelican.conf.py'), 'w') as fd: - for line in get_template('pelican.conf.py'): + with open(os.path.join(CONF['basedir'], 'pelicanconf.py'), 'w') as fd: + for line in get_template('pelicanconf.py'): + template = string.Template(line) + fd.write(template.safe_substitute(CONF)) + fd.close() + except OSError, e: + print('Error: {0}'.format(e)) + + try: + with open(os.path.join(CONF['basedir'], 'publishconf.py'), 'w') as fd: + for line in get_template('publishconf.py'): template = string.Template(line) fd.write(template.safe_substitute(CONF)) fd.close() diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 392336d7..3a3fe74c 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -2,9 +2,10 @@ PELICAN=$pelican PELICANOPTS=$pelicanopts BASEDIR=$$(PWD) -INPUTDIR=$$(BASEDIR)/src +INPUTDIR=$$(BASEDIR)/content OUTPUTDIR=$$(BASEDIR)/output -CONFFILE=$$(BASEDIR)/pelican.conf.py +CONFFILE=$$(BASEDIR)/pelicanconf.py +PUBLISHCONF=$$(BASEDIR)/publishconf.py FTP_HOST=$ftp_host FTP_USER=$ftp_user @@ -23,10 +24,11 @@ help: @echo 'Usage: ' @echo ' make html (re)generate the web site ' @echo ' make clean remove the generated files ' - @echo ' ftp_upload upload the web site using FTP ' - @echo ' ssh_upload upload the web site using SSH ' - @echo ' dropbox_upload upload the web site using Dropbox ' - @echo ' rsync_upload upload the web site using rsync/ssh' + @echo ' make publish generate using production settings ' + @echo ' ftp_upload upload the web site via FTP ' + @echo ' ssh_upload upload the web site via SSH ' + @echo ' dropbox_upload upload the web site via Dropbox ' + @echo ' rsync_upload upload the web site via rsync/ssh ' @echo ' ' @@ -37,23 +39,31 @@ $$(OUTPUTDIR)/%.html: $$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS) clean: - rm -fr $$(OUTPUTDIR) - mkdir $$(OUTPUTDIR) + find $$(OUTPUTDIR) -mindepth 1 -delete -dropbox_upload: $$(OUTPUTDIR)/index.html +regenerate: clean + $$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS) + +serve: + cd $$(OUTPUTDIR) && python -m SimpleHTTPServer + +publish: + $$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(PUBLISHCONF) $$(PELICANOPTS) + +dropbox_upload: publish cp -r $$(OUTPUTDIR)/* $$(DROPBOX_DIR) -ssh_upload: $$(OUTPUTDIR)/index.html +ssh_upload: publish scp -P $$(SSH_PORT) -r $$(OUTPUTDIR)/* $$(SSH_USER)@$$(SSH_HOST):$$(SSH_TARGET_DIR) -rsync_upload: $$(OUTPUTDIR)/index.html +rsync_upload: publish rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) -ftp_upload: $$(OUTPUTDIR)/index.html +ftp_upload: publish lftp ftp://$$(FTP_USER)@$$(FTP_HOST) -e "mirror -R $$(OUTPUTDIR) $$(FTP_TARGET_DIR) ; quit" -github: $$(OUTPUTDIR)/index.html +github: publish ghp-import $$(OUTPUTDIR) git push origin gh-pages -.PHONY: html help clean ftp_upload ssh_upload rsync_upload dropbox_upload github +.PHONY: html help clean regenerate serve publish ftp_upload ssh_upload rsync_upload dropbox_upload github diff --git a/pelican/tools/templates/pelican.conf.py.in b/pelican/tools/templates/pelicanconf.py.in similarity index 100% rename from pelican/tools/templates/pelican.conf.py.in rename to pelican/tools/templates/pelicanconf.py.in diff --git a/pelican/tools/templates/publishconf.py.in b/pelican/tools/templates/publishconf.py.in new file mode 100644 index 00000000..391eb9fa --- /dev/null +++ b/pelican/tools/templates/publishconf.py.in @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- # + +from pelicanconf import * + +SITEURL = '$siteurl' + +DELETE_OUTPUT_DIRECTORY = True + +# Following items are often useful when publishing + +# Uncomment following line for absolute URLs in production: +#RELATIVE_URLS = False + +#DISQUS_SITENAME = "" +#GOOGLE_ANALYTICS = "" + From 18b4d65c4eefcc020e7094b1886a105d8fc107e0 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 7 Jul 2012 08:45:50 -0700 Subject: [PATCH 116/278] Clarify quickstart docs and remove spurious line --- docs/getting_started.rst | 117 +++++++++++----------- pelican/tools/templates/publishconf.py.in | 1 - 2 files changed, 58 insertions(+), 60 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 954dac3d..93d578a0 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -1,65 +1,10 @@ Getting started ############### -Kickstart a blog -================ - -You're ready? Let's go! Following is a brief tutorial for those who want to get -started right away. Subsequent sections below will cover individual topics in -greater detail. To get started, here are some recommended install steps for -Pelican:: - - $ sudo pip install --upgrade virtualenv virtualenvwrapper - $ mkvirtualenv pelican - $ pip install pelican Markdown - $ mkdir ~/code/yoursitename # (where you want your new site code to be saved) - $ cd ~/code/yoursitename - $ setvirtualenvproject - $ pelican-quickstart - -Once you've run that last ``pelican-quickstart`` command, you'll be asked some -questions about your site. Once you finish answering all the questions, you can -begin 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.) Once you have some content to generate, you -can convert it to HTML via the following command:: - - $ make html - -If you'd prefer to have Pelican automatically regenerate your site every time a -change is detected (handy when testing locally), use the following command -instead:: - - $ make regenerate - -To preview the site in your browser, open a new terminal tab and enter:: - - $ workon yoursitename - $ make serve - -Visit http://localhost:8000 in your browser to see your site. - -When you're ready to publish your site, you can upload it via the method(s) you -chose during the ``pelican-quickstart`` questionnaire. For this example, we'll -use rsync over ssh:: - - $ make rsync_upload - -That's it! Your site should now be live. - -Closing the current terminal session will also close the virtual environment in -which we installed Pelican. In the future, when you want to work on your site, -you can activate its virtual environment via:: - - $ workon yoursitename - -Not only will that command activate your new site's virtual environment, but it -will also automatically change your working directory to your site project. - Installing Pelican ================== -You can install Pelican via several different methods. +You're ready? Let's go! You can install Pelican via several different methods. The simplest is via `pip `_:: $ pip install pelican @@ -75,6 +20,7 @@ before installing Pelican:: $ sudo pip install --upgrade virtualenv virtualenvwrapper $ mkvirtualenv pelican + $ pip install pelican Once the virtual environment has been created and activated, Pelican can be be installed via ``pip`` or ``easy_install`` as noted above. Alternatively, if @@ -122,6 +68,59 @@ Optionally: * pygments, for syntax highlighting * Markdown, for supporting Markdown as an input format +Kickstart a blog +================ + +Following is a brief tutorial for those who want to get started right away. +We're going to assume Pelican was installed in a virtual environment via the +following steps (if you're not using a virtual environment for Pelican, you can +skip to the ``pelican-quickstart`` command):: + + $ sudo pip install --upgrade virtualenv virtualenvwrapper + $ mkvirtualenv pelican + $ pip install pelican Markdown + +Next we'll create a directory to house our site content and configuration files, +which can be located any place you prefer, and associate this new project with +the currently-active virtual environment:: + + $ mkdir ~/code/yoursitename + $ cd ~/code/yoursitename + $ setvirtualenvproject + +Now we can run the ``pelican-quickstart`` command, which will ask some questions +about your site:: + + $ pelican-quickstart + +Once you finish answering all the questions, you can begin 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.) +Once you have some content to generate, you can convert it to HTML via the +following command:: + + $ make html + +If you'd prefer to have Pelican automatically regenerate your site every time a +change is detected (handy when testing locally), use the following command +instead:: + + $ make regenerate + +To serve the site so it can be previewed in your browser:: + + $ make serve + +Visit http://localhost:8000 in your browser to see your site. + +When you're ready to publish your site, you can upload it via the method(s) you +chose during the ``pelican-quickstart`` questionnaire. For this example, we'll +use rsync over ssh:: + + $ make rsync_upload + +That's it! Your site should now be live. + Writing articles using Pelican ============================== @@ -171,9 +170,9 @@ the content. The ``pelican`` command can also be run directly:: $ pelican /path/to/your/content/ [-s path/to/your/settings.py] The above command will generate your weblog and save it in the ``content/`` -folder, using the default theme to produce a simple site. It's not -very sexy, as it's just simple HTML output (without any style). You can create -your own style if you want. +folder, using the default theme to produce a simple site. The default theme is +simple HTML without styling and is provided so folks may use it as a basis for +creating their own themes. Pelican has other command-line switches available. Have a look at the help to see all the options you can use:: diff --git a/pelican/tools/templates/publishconf.py.in b/pelican/tools/templates/publishconf.py.in index 391eb9fa..113a7318 100644 --- a/pelican/tools/templates/publishconf.py.in +++ b/pelican/tools/templates/publishconf.py.in @@ -14,4 +14,3 @@ DELETE_OUTPUT_DIRECTORY = True #DISQUS_SITENAME = "" #GOOGLE_ANALYTICS = "" - From dc21efbe10dc6552f882bdf69e4a210da100977a Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 7 Jul 2012 10:33:47 -0700 Subject: [PATCH 117/278] Improved quickstart config formatting. Fixes #401. --- pelican/tools/templates/pelicanconf.py.in | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/pelican/tools/templates/pelicanconf.py.in b/pelican/tools/templates/pelicanconf.py.in index 095a7e7d..07e286cd 100644 --- a/pelican/tools/templates/pelicanconf.py.in +++ b/pelican/tools/templates/pelicanconf.py.in @@ -7,19 +7,16 @@ SITEURL = '' TIMEZONE = 'Europe/Paris' -DEFAULT_LANG='$lang' +DEFAULT_LANG = '$lang' # Blogroll -LINKS = ( - ('Pelican', 'http://docs.notmyidea.org/alexis/pelican/'), - ('Python.org', 'http://python.org'), - ('Jinja2', 'http://jinja.pocoo.org'), - ('You can modify those links in your config file', '#') - ) +LINKS = (('Pelican', 'http://docs.notmyidea.org/alexis/pelican/'), + ('Python.org', 'http://python.org'), + ('Jinja2', 'http://jinja.pocoo.org'), + ('You can modify those links in your config file', '#'),) # Social widget -SOCIAL = ( - ('You can add links in your config file', '#'), - ) +SOCIAL = (('You can add links in your config file', '#'), + ('Another social link', '#'),) DEFAULT_PAGINATION = $default_pagination From dff5b3589bf4d437cc6c250423066049f3ec1adc Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Sat, 7 Jul 2012 12:15:35 -0700 Subject: [PATCH 118/278] Add per page templates. Closes #376 Also set up helper classes in test_generators.py for cleaner tests --- docs/faq.rst | 11 ++++ pelican/contents.py | 11 ++++ pelican/generators.py | 15 +++--- tests/TestPages/hidden_page_with_template.rst | 11 ++++ tests/TestPages/page_with_template.rst | 8 +++ tests/content/article_with_template.rst | 8 +++ tests/test_contents.py | 25 ++++++++- tests/test_generators.py | 54 +++++++++++++++++-- 8 files changed, 128 insertions(+), 15 deletions(-) create mode 100644 tests/TestPages/hidden_page_with_template.rst create mode 100644 tests/TestPages/page_with_template.rst create mode 100644 tests/content/article_with_template.rst diff --git a/docs/faq.rst b/docs/faq.rst index a3829d65..3eec6e84 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -49,3 +49,14 @@ install it. You can do so by typing:: In case you don't have pip installed, consider installing it via:: $ (sudo) easy_install pip + +How do I assign custom templates on a per page basis? +===================================================== + +It's as simple as adding an extra line of metadata to any pages or articles you +want to have it's own template. + + :template: template_name + +Then just make sure to have the template installed in to your theme as +``template_name.html``. \ No newline at end of file diff --git a/pelican/contents.py b/pelican/contents.py index b8bb0993..a5e3be8f 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -21,6 +21,7 @@ class Page(object): :param content: the string to parse, containing the original content. """ mandatory_properties = ('title',) + default_template = 'page' def __init__(self, content, metadata=None, settings=None, filename=None): @@ -44,6 +45,9 @@ class Page(object): # also keep track of the metadata attributes available self.metadata = local_metadata + #default template if it's not defined in page + self.template = self._get_template() + # default author to the one in settings if not defined if not hasattr(self, 'author'): if 'AUTHOR' in settings: @@ -153,9 +157,16 @@ class Page(object): url = property(functools.partial(get_url_setting, key='url')) save_as = property(functools.partial(get_url_setting, key='save_as')) + def _get_template(self): + if hasattr(self, 'template') and self.template is not None: + return self.template + else: + return self.default_template + class Article(Page): mandatory_properties = ('title', 'date', 'category') + default_template = 'article' class Quote(Page): diff --git a/pelican/generators.py b/pelican/generators.py index 4e9312cc..8526a56d 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -167,11 +167,9 @@ class ArticlesGenerator(Generator): def generate_articles(self, write): """Generate the articles.""" - article_template = self.get_template('article') for article in chain(self.translations, self.articles): - write(article.save_as, - article_template, self.context, article=article, - category=article.category) + write(article.save_as, self.get_template(article.template), + self.context, article=article, category=article.category) def generate_direct_templates(self, write): """Generate direct templates pages""" @@ -222,10 +220,10 @@ class ArticlesGenerator(Generator): def generate_drafts(self, write): """Generate drafts pages.""" - article_template = self.get_template('article') for article in self.drafts: - write('drafts/%s.html' % article.slug, article_template, - self.context, article=article, category=article.category) + write('drafts/%s.html' % article.slug, + self.get_template(article.template), self.context, + article=article, category=article.category) def generate_pages(self, writer): """Generate the pages on the disk""" @@ -385,7 +383,6 @@ class PagesGenerator(Generator): (repr(unicode.encode(page.status, 'utf-8')), repr(f))) - self.pages, self.translations = process_translations(all_pages) self.hidden_pages, self.hidden_translations = process_translations(hidden_pages) @@ -395,7 +392,7 @@ class PagesGenerator(Generator): def generate_output(self, writer): for page in chain(self.translations, self.pages, self.hidden_translations, self.hidden_pages): - writer.write_file(page.save_as, self.get_template('page'), + writer.write_file(page.save_as, self.get_template(page.template), self.context, page=page, relative_urls=self.settings.get('RELATIVE_URLS')) diff --git a/tests/TestPages/hidden_page_with_template.rst b/tests/TestPages/hidden_page_with_template.rst new file mode 100644 index 00000000..36104a09 --- /dev/null +++ b/tests/TestPages/hidden_page_with_template.rst @@ -0,0 +1,11 @@ +This is a test hidden page with a custom template +################################################# + +:status: hidden +:template: custom + +The quick brown fox jumped over the lazy dog's back. + +This page is hidden + +This page has a custom template to be called when rendered diff --git a/tests/TestPages/page_with_template.rst b/tests/TestPages/page_with_template.rst new file mode 100644 index 00000000..9388dc2f --- /dev/null +++ b/tests/TestPages/page_with_template.rst @@ -0,0 +1,8 @@ +This is a test page with a preset template +########################################## + +:template: custom + +The quick brown fox jumped over the lazy dog's back. + +This article has a custom template to be called when rendered diff --git a/tests/content/article_with_template.rst b/tests/content/article_with_template.rst new file mode 100644 index 00000000..eb55738c --- /dev/null +++ b/tests/content/article_with_template.rst @@ -0,0 +1,8 @@ +Article with template +##################### + +:template: custom + +This article has a custom template to be called when rendered + +This is some content. With some stuff to "typogrify". diff --git a/tests/test_contents.py b/tests/test_contents.py index e7c9ad01..bc028ea8 100644 --- a/tests/test_contents.py +++ b/tests/test_contents.py @@ -2,7 +2,7 @@ from .support import unittest -from pelican.contents import Page +from pelican.contents import Page, Article from pelican.settings import _DEFAULT_CONFIG from pelican.utils import truncate_html_words @@ -135,6 +135,17 @@ class TestPage(unittest.TestCase): # will simply skip this test. unittest.skip("There is no locale %s in this system." % locale) + def test_template(self): + """ + Pages default to page, metadata overwrites + """ + default_page = Page(**self.page_kwargs) + self.assertEqual('page', default_page.template) + page_kwargs = self._copy_page_kwargs() + page_kwargs['metadata']['template'] = 'custom' + custom_page = Page(**page_kwargs) + self.assertEqual('custom', custom_page.template) + def _copy_page_kwargs(self): # make a deep copy of page_kwargs page_kwargs = dict([(key, self.page_kwargs[key]) for key in @@ -146,3 +157,15 @@ class TestPage(unittest.TestCase): for subkey in page_kwargs[key]]) return page_kwargs + +class TestArticle(TestPage): + def test_template(self): + """ + Articles default to article, metadata overwrites + """ + default_article = Article(**self.page_kwargs) + self.assertEqual('article', default_article.template) + article_kwargs = self._copy_page_kwargs() + article_kwargs['metadata']['template'] = 'custom' + custom_article = Article(**article_kwargs) + self.assertEqual('custom', custom_article.template) diff --git a/tests/test_generators.py b/tests/test_generators.py index 61f31696..3b0a4b46 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -13,6 +13,37 @@ CUR_DIR = os.path.dirname(__file__) class TestArticlesGenerator(unittest.TestCase): + def setUp(self): + super(TestArticlesGenerator, self).setUp() + self.generator = None + + def get_populated_generator(self): + """ + We only need to pull all the test articles once, but read from it + for each test. + """ + if self.generator is None: + settings = _DEFAULT_CONFIG.copy() + settings['ARTICLE_DIR'] = 'content' + settings['DEFAULT_CATEGORY'] = 'Default' + self.generator = ArticlesGenerator(settings.copy(), settings, + CUR_DIR, _DEFAULT_CONFIG['THEME'], None, + _DEFAULT_CONFIG['MARKUP']) + self.generator.generate_context() + return self.generator + + def distill_articles(self, articles): + distilled = [] + for page in articles: + distilled.append([ + page.title, + page.status, + page.category.name, + page.template + ] + ) + return distilled + def test_generate_feeds(self): generator = ArticlesGenerator(None, {'FEED': _DEFAULT_CONFIG['FEED']}, @@ -93,6 +124,16 @@ class TestArticlesGenerator(unittest.TestCase): generator.generate_direct_templates(write) write.assert_called_count == 0 + def test_per_article_template(self): + """ + Custom template articles get the field but standard/unset are None + """ + generator = self.get_populated_generator() + articles = self.distill_articles(generator.articles) + custom_template = ['Article with template', 'published', 'Default', 'custom'] + standard_template = ['This is a super article !', 'published', 'Yeah', 'article'] + self.assertIn(custom_template, articles) + self.assertIn(standard_template, articles) class TestPageGenerator(unittest.TestCase): """ @@ -107,7 +148,8 @@ class TestPageGenerator(unittest.TestCase): for page in pages: distilled.append([ page.title, - page.status + page.status, + page.template ] ) return distilled @@ -124,12 +166,14 @@ class TestPageGenerator(unittest.TestCase): hidden_pages = self.distill_pages(generator.hidden_pages) pages_expected = [ - [u'This is a test page', 'published'], - [u'This is a markdown test page', 'published'] + [u'This is a test page', 'published', 'page'], + [u'This is a markdown test page', 'published', 'page'], + [u'This is a test page with a preset template', 'published', 'custom'] ] hidden_pages_expected = [ - [u'This is a test hidden page', 'hidden'], - [u'This is a markdown test hidden page', 'hidden'] + [u'This is a test hidden page', 'hidden', 'page'], + [u'This is a markdown test hidden page', 'hidden', 'page'], + [u'This is a test hidden page with a custom template', 'hidden', 'custom'] ] self.assertItemsEqual(pages_expected,pages) From a1f27d9189461da533a8cc4334e7701e33ab8ff3 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Sat, 7 Jul 2012 16:59:58 -0700 Subject: [PATCH 119/278] Small change to fix #406 --- pelican/tools/templates/publishconf.py.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pelican/tools/templates/publishconf.py.in b/pelican/tools/templates/publishconf.py.in index 113a7318..a4516332 100644 --- a/pelican/tools/templates/publishconf.py.in +++ b/pelican/tools/templates/publishconf.py.in @@ -1,6 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # +import sys +sys.path.append('.') from pelicanconf import * SITEURL = '$siteurl' From 38ffcfd4c40b5d054cfc99772d84a05cf8bd3e2e Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Sun, 8 Jul 2012 17:50:18 -0700 Subject: [PATCH 120/278] Added the delevop_server script This script and the small changes to quick start's makefile make for easily launching and killing of pelican --debug --autoreload and SimpleHTTPServer. This is extra useful for working on templates. --- pelican/tools/pelican_quickstart.py | 11 ++- pelican/tools/templates/Makefile.in | 3 +- pelican/tools/templates/develop_server.sh.in | 83 ++++++++++++++++++++ 3 files changed, 95 insertions(+), 2 deletions(-) create mode 100755 pelican/tools/templates/develop_server.sh.in diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index f747d048..577a435d 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -160,7 +160,7 @@ Please answer the following questions so this script can generate the files need else: CONF['default_pagination'] = False - mkfile = ask('Do you want to generate a Makefile to easily manage your website?', bool, True) + mkfile = ask('Do you want to generate a Makefile and develop server script to easily manage your website?', bool, True) if mkfile: if ask('Do you want to upload your website using FTP?', answer=bool, default=False): @@ -214,4 +214,13 @@ Please answer the following questions so this script can generate the files need except OSError, e: print('Error: {0}'.format(e)) + try: + with open(os.path.join(CONF['basedir'], 'develop_server.sh'), 'w') as fd: + for line in get_template('develop_server.sh'): + template = string.Template(line) + fd.write(template.safe_substitute(CONF)) + fd.close() + except OSError, e: + print('Error: {0}'.format(e)) + print('Done. Your new project is available at %s' % CONF['basedir']) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 3a3fe74c..df00ffbf 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -25,6 +25,7 @@ help: @echo ' make html (re)generate the web site ' @echo ' make clean remove the generated files ' @echo ' make publish generate using production settings ' + @echo ' make serve run develop_server.sh restart ' @echo ' ftp_upload upload the web site via FTP ' @echo ' ssh_upload upload the web site via SSH ' @echo ' dropbox_upload upload the web site via Dropbox ' @@ -45,7 +46,7 @@ regenerate: clean $$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS) serve: - cd $$(OUTPUTDIR) && python -m SimpleHTTPServer + $$(BASEDIR)/develop_server.sh restart publish: $$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(PUBLISHCONF) $$(PELICANOPTS) diff --git a/pelican/tools/templates/develop_server.sh.in b/pelican/tools/templates/develop_server.sh.in new file mode 100755 index 00000000..2f8c07dd --- /dev/null +++ b/pelican/tools/templates/develop_server.sh.in @@ -0,0 +1,83 @@ +#!/bin/bash +## +# This section should match your Makefile +## +PELICAN=$pelican +PELICANOPTS=$pelicanopts + +BASEDIR=$$(PWD) +INPUTDIR=$$BASEDIR/content +OUTPUTDIR=$$BASEDIR/output +CONFFILE=$$BASEDIR/pelicanconf.py + +### +# Don't change stuff below here unless you are sure +### + +SRV_PID=$$BASEDIR/srv.pid +PELICAN_PID=$$BASEDIR/pelican.pid + +function usage(){ + echo "usage: $$0 (stop) (start) (restart)" + echo "This starts pelican in debug and reload mode and then launches" + echo "A SimpleHTTP server to help site development. It doesn't read" + echo "your pelican options so you edit any paths in your Makefile" + echo "you will need to edit it as well" + exit 3 +} + +function shut_down(){ + if [[ -f $$SRV_PID ]]; then + PID=$$(cat $$SRV_PID) + PROCESS=$$(ps -p $$PID | tail -n 1 | awk '{print $$4}') + if [[ $$PROCESS == python ]]; then + echo "Killing SimpleHTTPServer" + kill $$PID + else + echo "Stale PID, deleting" + fi + rm $$SRV_PID + else + echo "SimpleHTTPServer PIDFile not found" + fi + + if [[ -f $$PELICAN_PID ]]; then + PID=$$(cat $$PELICAN_PID) + PROCESS=$$(ps -p $$PID | tail -n 1 | awk '{print $$4}') + if [[ $$PROCESS != "" ]]; then + echo "Killing Pelican" + kill $$PID + else + echo "Stale PID, deleting" + fi + rm $$PELICAN_PID + else + echo "Pelican PIDFile not found" + fi +} + +function start_up(){ + echo "Starting up Pelican and SimpleHTTPServer" + shift + $$PELICAN --debug --autoreload -r $$INPUTDIR -o $$OUTPUTDIR -s $$CONFFILE $$PELICANOPTS & + echo $$! > $$PELICAN_PID + cd $$OUTPUTDIR + python -m SimpleHTTPServer & + echo $$! > $$SRV_PID + cd $$BASEDIR +} + +### +# MAIN +### +[[ $$# -ne 1 ]] && usage +if [[ $$1 == "stop" ]]; then + shut_down +elif [[ $$1 == "restart" ]]; then + shut_down + start_up +elif [[ $$1 == "start" ]]; then + start_up +else + usage +fi From 10e668a87cd0e1fba125d04bcf93465600c81ba6 Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 9 Jul 2012 15:25:13 +0200 Subject: [PATCH 121/278] Fix issue #175 Force world-readable permission on files and directory of the themes installed by pelican-themes. Only on posix system i.e. mostly non Windows Rationale: If the theme's files have only -rw------- permissions, once installed system wide and owned by root, they will not be accessible to any user but only root. --- pelican/tools/pelican_themes.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index 6a021ecc..0083dd50 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -180,8 +180,19 @@ def install(path, v=False, u=False): print("Copying `{p}' to `{t}' ...".format(p=path, t=theme_path)) try: shutil.copytree(path, theme_path) - except Exception, e: + + if os.name == 'posix': + for root, dirs, files in os.walk(theme_path): + for d in dirs: + dname = os.path.join(root, d) + os.chmod(dname, 0755) + for f in files: + fname = os.path.join(root, f) + os.chmod(fname, 0644) + except shutil.Error, e: err("Cannot copy `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e))) + except OSError, e: + err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) def symlink(path, v=False): From 4acbbb8d0fa157fbb0cb10e2b0c6abc428f8ffab Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 9 Jul 2012 19:48:53 +0200 Subject: [PATCH 122/278] Use logging module instead of err function --- pelican/tools/pelican_themes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index 0083dd50..2fe4f459 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -192,7 +192,9 @@ def install(path, v=False, u=False): except shutil.Error, e: err("Cannot copy `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e))) except OSError, e: - err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) + import logging + logger = logging.getLogger(__name__) + logger.warning("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e))) def symlink(path, v=False): From 842817f110481c280b7a121e96a9a818c8354f6a Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 9 Jul 2012 20:05:21 +0200 Subject: [PATCH 123/278] Revert "Use logging module instead of err function" This reverts commit 4acbbb8d0fa157fbb0cb10e2b0c6abc428f8ffab. I don't know how to use logging/logger This throws: No handlers could be found for logger "pelican.tools.pelican_themes" --- pelican/tools/pelican_themes.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index 2fe4f459..0083dd50 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -192,9 +192,7 @@ def install(path, v=False, u=False): except shutil.Error, e: err("Cannot copy `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e))) except OSError, e: - import logging - logger = logging.getLogger(__name__) - logger.warning("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e))) + err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) def symlink(path, v=False): From a0d2d3446649066e7f03560953b5962d9fdcadf5 Mon Sep 17 00:00:00 2001 From: solsTiCe d'Hiver Date: Mon, 9 Jul 2012 20:07:31 +0200 Subject: [PATCH 124/278] shutil.copytree seems to throw OSError exception too So revert to previous Exception handling --- pelican/tools/pelican_themes.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index 0083dd50..d13e60e9 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -181,18 +181,19 @@ def install(path, v=False, u=False): try: shutil.copytree(path, theme_path) - if os.name == 'posix': - for root, dirs, files in os.walk(theme_path): - for d in dirs: - dname = os.path.join(root, d) - os.chmod(dname, 0755) - for f in files: - fname = os.path.join(root, f) - os.chmod(fname, 0644) - except shutil.Error, e: + try: + if os.name == 'posix': + for root, dirs, files in os.walk(theme_path): + for d in dirs: + dname = os.path.join(root, d) + os.chmod(dname, 0755) + for f in files: + fname = os.path.join(root, f) + os.chmod(fname, 0644) + except OSError, e: + err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) + except Exception, e: err("Cannot copy `{p}' to `{t}':\n{e}".format(p=path, t=theme_path, e=str(e))) - except OSError, e: - err("Cannot change permissions of files or directory in `{r}':\n{e}".format(r=theme_path, e=str(e)), die=False) def symlink(path, v=False): From ddc0aa0e8260f5ab61eb16369632a18c1ee21648 Mon Sep 17 00:00:00 2001 From: Samrat Man Singh Date: Tue, 10 Jul 2012 11:06:07 +0545 Subject: [PATCH 125/278] Related posts is now working, but needs some actual logic. --- pelican/generators.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pelican/generators.py b/pelican/generators.py index 4e9312cc..a7180e98 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -116,6 +116,7 @@ class ArticlesGenerator(Generator): self.dates = {} self.tags = defaultdict(list) self.categories = defaultdict(list) + self.related_posts = [] self.authors = defaultdict(list) super(ArticlesGenerator, self).__init__(*args, **kwargs) self.drafts = [] @@ -344,8 +345,14 @@ class ArticlesGenerator(Generator): self.authors = list(self.authors.items()) self.authors.sort(key=lambda item: item[0].name) + for article in self.articles: + article.related_posts = [] + print article + potential_related = all_articles.remove(article) + article.related_posts = potential_related[:5] + self._update_context(('articles', 'dates', 'tags', 'categories', - 'tag_cloud', 'authors')) + 'tag_cloud', 'authors', 'related_posts')) def generate_output(self, writer): self.generate_feeds(writer) From 4d23ffc1121b553f9b2da6bb9f035fe63437456a Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Tue, 10 Jul 2012 13:40:38 +0200 Subject: [PATCH 126/278] Updated the functional tests to match latest changes. --- .../basic/a-markdown-powered-article.html | 2 +- tests/output/basic/archives.html | 2 +- tests/output/basic/article-1.html | 2 +- tests/output/basic/article-2.html | 2 +- tests/output/basic/article-3.html | 2 +- .../output/basic/author/alexis-metaireau.html | 12 +- tests/output/basic/author/dummy-author.html | 32 ++-- tests/output/basic/categories.html | 4 +- tests/output/basic/category/bar.html | 4 +- tests/output/basic/category/cat1.html | 20 +-- tests/output/basic/category/misc.html | 147 ++++++++++++++++++ tests/output/basic/category/yeah.html | 4 +- .../output/basic/drafts/a-draft-article.html | 8 +- tests/output/basic/feeds/all-fr.atom.xml | 2 +- tests/output/basic/feeds/misc.atom.xml | 4 + tests/output/basic/index.html | 40 ++--- tests/output/basic/oh-yeah-fr.html | 8 +- tests/output/basic/oh-yeah.html | 2 +- .../pages/this-is-a-test-hidden-page.html | 70 +++++++++ .../basic/pages/this-is-a-test-page.html | 2 +- tests/output/basic/second-article-fr.html | 4 +- tests/output/basic/second-article.html | 4 +- tests/output/basic/tag/bar.html | 36 ++--- tests/output/basic/tag/baz.html | 28 ++-- tests/output/basic/tag/foo.html | 32 ++-- tests/output/basic/tag/foobar.html | 4 +- tests/output/basic/tag/oh.html | 4 +- tests/output/basic/tag/yeah.html | 4 +- tests/output/basic/theme/css/main.css | 1 + .../basic/theme/images/icons/gitorious.png | Bin 0 -> 3675 bytes .../output/basic/this-is-a-super-article.html | 2 +- tests/output/basic/unbelievable.html | 4 +- tests/output/custom/tag/bar.html | 20 +-- tests/output/custom/tag/baz.html | 20 +-- tests/output/custom/tag/foo.html | 20 +-- 35 files changed, 387 insertions(+), 165 deletions(-) create mode 100644 tests/output/basic/category/misc.html create mode 100644 tests/output/basic/feeds/misc.atom.xml create mode 100644 tests/output/basic/pages/this-is-a-test-hidden-page.html create mode 100644 tests/output/basic/theme/images/icons/gitorious.png diff --git a/tests/output/basic/a-markdown-powered-article.html b/tests/output/basic/a-markdown-powered-article.html index ceadf79a..bfa09fdf 100644 --- a/tests/output/basic/a-markdown-powered-article.html +++ b/tests/output/basic/a-markdown-powered-article.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/archives.html b/tests/output/basic/archives.html index 52d00234..dac96a47 100644 --- a/tests/output/basic/archives.html +++ b/tests/output/basic/archives.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/article-1.html b/tests/output/basic/article-1.html index bd6f9716..ab1d71d7 100644 --- a/tests/output/basic/article-1.html +++ b/tests/output/basic/article-1.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/article-2.html b/tests/output/basic/article-2.html index 7811204a..52cfff0d 100644 --- a/tests/output/basic/article-2.html +++ b/tests/output/basic/article-2.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/article-3.html b/tests/output/basic/article-3.html index 96acb190..ef97a56d 100644 --- a/tests/output/basic/article-3.html +++ b/tests/output/basic/article-3.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • diff --git a/tests/output/basic/author/alexis-metaireau.html b/tests/output/basic/author/alexis-metaireau.html index 6bf631eb..ad7b8bee 100644 --- a/tests/output/basic/author/alexis-metaireau.html +++ b/tests/output/basic/author/alexis-metaireau.html @@ -35,7 +35,7 @@
  • cat1
  • -
  • content
  • +
  • misc
  • yeah
  • @@ -88,7 +88,6 @@ YEAH !

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

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

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

    Other articles

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

    In content.

    +

    In misc.

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

    In content.

    +

    In misc.

    tags: foobarbaz

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

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

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

    In content.

    +

    In misc.

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

    This is a test hidden page

    + +

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

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

    In content.

    +

    In misc.

    tags: foobarbaz

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

    In content.

    +

    In misc.

    tags: foobarbaz

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

    This is some article, in english

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

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