From d11b33030f4220e16b62bdfe94b80dc1290ead4a Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Wed, 27 Mar 2013 09:15:35 +0100 Subject: [PATCH 01/46] Use .dev suffix for development versions --- pelican/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index f2bd2e07..2e1763ac 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -25,7 +25,7 @@ from pelican.writers import Writer __major__ = 3 __minor__ = 2 __micro__ = 0 -__version__ = "{0}.{1}.{2}".format(__major__, __minor__, __micro__) +__version__ = "{0}.{1}.{2}.dev".format(__major__, __minor__, __micro__) DEFAULT_CONFIG_NAME = 'pelicanconf.py' From 469c531ae4fbc9f8093b3f50607755e3d43e3e26 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Wed, 27 Mar 2013 09:16:19 +0100 Subject: [PATCH 02/46] Include version in doc and warn if it's a dev version. --- docs/conf.py | 16 ++++++++++++---- docs/index.rst | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 40de84c7..84531182 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -4,18 +4,26 @@ import sys, os sys.path.append(os.path.abspath(os.pardir)) -from pelican import __version__, __major__ +from pelican import __version__, __major__, __minor__ # -- General configuration ----------------------------------------------------- templates_path = ['_templates'] -extensions = ['sphinx.ext.autodoc',] +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.ifconfig', 'sphinx.ext.extlinks'] source_suffix = '.rst' master_doc = 'index' project = 'Pelican' copyright = '2010, Alexis Metaireau and contributors' exclude_patterns = ['_build'] -version = __version__ -release = __major__ +version = '%s.%s' % (__major__, __minor__) +release = __version__ +last_stable = '3.1.1' +rst_prolog = ''' +.. |last_stable| replace:: :pelican-doc:`{0}` +'''.format(last_stable) + +extlinks = { + 'pelican-doc': ('http://docs.getpelican.com/%s/', '') +} # -- Options for HTML output --------------------------------------------------- diff --git a/docs/index.rst b/docs/index.rst index 914c2a7e..eb8883ce 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,14 @@ -Pelican -======= +Pelican |release| +================= + + +.. ifconfig:: release.endswith('.dev') + + .. warning:: + + This documentation is for the version of Pelican currently under development. + Were you looking for version |last_stable| documentation? + Pelican is a static site generator, written in Python_. @@ -12,7 +21,7 @@ Pelican is a static site generator, written in Python_. Features -------- -Pelican currently supports: +Pelican |version| currently supports: * Articles (e.g., blog posts) and pages (e.g., "About", "Projects", "Contact") * Comments, via an external service (Disqus). (Please note that while From e6e99ffbb9c671da9a80c61cf7d47c12d77f2ef4 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Wed, 27 Mar 2013 10:11:45 +0100 Subject: [PATCH 03/46] Change current release section with a constant title --- docs/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 61cae1d9..c020d7f4 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,7 +1,7 @@ Release history ############### -3.3 (XXXX-XX-XX) +Next release ================ * Rename signals for better consistency (some plugins may need to be updated) From 9d583961e700667b7f1e78c4f2e0c88954becf15 Mon Sep 17 00:00:00 2001 From: bmcorser Date: Wed, 21 Aug 2013 19:57:55 +0100 Subject: [PATCH 04/46] Fix for THEME_STATIC_PATHS by copying sensitively If more than one path is defined in THEME_STATIC_PATHS, the theme's static directory in output is deleted and replaced by the following path's files. Using `shutil.rmtree` to remove the entire destination tree if overwrite is `True` assumes that we didn't want anything at all that was there. We should recurse through the directory and their subdirs instead, leaving things put there by the previous path where they were. I lazily copied almost verbatim the solution for recursively copying a diectory from http://stackoverflow.com/a/1994840. The reason for this is patch is that without it, my plugin is broken! It also makes my code a lot less crazy: https://github.com/bmcorser/pelicanfly/commit/a83f066 --- pelican/utils.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/pelican/utils.py b/pelican/utils.py index 054c1f40..e028c84c 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -275,16 +275,24 @@ def copy(path, source, destination, destination_path=None, overwrite=False): destination_ = os.path.abspath( os.path.expanduser(os.path.join(destination, destination_path))) + def recurse(source, destination): + for entry in os.listdir(source): + entry_path = os.path.join(source, entry) + if os.path.isdir(entry_path): + entry_dest = os.path.join(destination, entry) + if os.path.exists(entry_dest): + if not os.path.isdir(entry_dest): + raise IOError('Failed to copy {0} a directory.' + .format(entry_dest)) + recurse(entry_path, entry_dest) + else: + shutil.copytree(entry_path, entry_dest) + else: + shutil.copy(entry_path, destination) + + if os.path.isdir(source_): - try: - shutil.copytree(source_, destination_) - logger.info('copying %s to %s' % (source_, destination_)) - except OSError: - if overwrite: - shutil.rmtree(destination_) - shutil.copytree(source_, destination_) - logger.info('replacement of %s with %s' % (source_, - destination_)) + recurse(source_, destination_) elif os.path.isfile(source_): dest_dir = os.path.dirname(destination_) From 2826c1a5580508932b4b27b5b0bb38cea4a45240 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Wed, 21 Aug 2013 22:58:50 -0400 Subject: [PATCH 05/46] Added metadata information. Refs #1028 --- pelican/themes/simple/templates/article.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pelican/themes/simple/templates/article.html b/pelican/themes/simple/templates/article.html index 98cc852c..8da555a1 100644 --- a/pelican/themes/simple/templates/article.html +++ b/pelican/themes/simple/templates/article.html @@ -1,4 +1,14 @@ {% extends "base.html" %} +{% block head %} + {% for keyword in article.keywords %} + + {% endfor %} + + {% for description in article.description %} + + {% endfor %} +{% endblock %} + {% block content %}
From d22b0892418b60b752551ebc95c4616926bb513f Mon Sep 17 00:00:00 2001 From: bmcorser Date: Sat, 24 Aug 2013 13:41:22 +0100 Subject: [PATCH 06/46] Adding placeholder files for regression test --- samples/theme_standard/a_stylesheet | 0 samples/theme_standard/a_template | 0 samples/very/exciting/new/files/bap! | 0 samples/very/exciting/new/files/boom! | 0 samples/very/exciting/new/files/wow! | 0 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 samples/theme_standard/a_stylesheet create mode 100644 samples/theme_standard/a_template create mode 100644 samples/very/exciting/new/files/bap! create mode 100644 samples/very/exciting/new/files/boom! create mode 100644 samples/very/exciting/new/files/wow! diff --git a/samples/theme_standard/a_stylesheet b/samples/theme_standard/a_stylesheet new file mode 100644 index 00000000..e69de29b diff --git a/samples/theme_standard/a_template b/samples/theme_standard/a_template new file mode 100644 index 00000000..e69de29b diff --git a/samples/very/exciting/new/files/bap! b/samples/very/exciting/new/files/bap! new file mode 100644 index 00000000..e69de29b diff --git a/samples/very/exciting/new/files/boom! b/samples/very/exciting/new/files/boom! new file mode 100644 index 00000000..e69de29b diff --git a/samples/very/exciting/new/files/wow! b/samples/very/exciting/new/files/wow! new file mode 100644 index 00000000..e69de29b From 0f4058a3170724cc1709837c1d8f89d364c08bf5 Mon Sep 17 00:00:00 2001 From: bmcorser Date: Sat, 24 Aug 2013 13:42:55 +0100 Subject: [PATCH 07/46] Add regressison test for recursively copying files --- pelican/tests/test_pelican.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pelican/tests/test_pelican.py b/pelican/tests/test_pelican.py index d6c0d8e9..db2d0e6b 100644 --- a/pelican/tests/test_pelican.py +++ b/pelican/tests/test_pelican.py @@ -92,3 +92,22 @@ class TestPelican(LoggedTestCase): mute(True)(pelican.run)() dcmp = dircmp(self.temp_path, os.path.join(OUTPUT_PATH, 'custom')) self.assertFilesEqual(recursiveDiff(dcmp)) + + def test_theme_static_paths_copy(self): + # the same thing with a specified set of settings should work + settings = read_settings(path=SAMPLE_CONFIG, override={ + 'PATH': INPUT_PATH, + 'OUTPUT_PATH': self.temp_path, + 'THEME_STATIC_PATHS': [os.path.join(SAMPLES_PATH, 'very'), + os.path.join(SAMPLES_PATH, 'theme_standard')] + }) + pelican = Pelican(settings=settings) + mute(True)(pelican.run)() + theme_output = os.path.join(self.temp_path, 'theme') + extra_path = os.path.join(theme_output, 'exciting', 'new', 'files') + + for file in ['a_stylesheet', 'a_template']: + self.assertTrue(os.path.exists(os.path.join(theme_output, file))) + + for file in ['wow!', 'boom!', 'bap!']: + self.assertTrue(os.path.exists(os.path.join(extra_path, file))) From b144c3cfbd6ea0e5bd1bba5d30d6bf3605499794 Mon Sep 17 00:00:00 2001 From: bmcorser Date: Sat, 24 Aug 2013 14:38:06 +0100 Subject: [PATCH 08/46] Hack out `overwrite` param --- pelican/generators.py | 2 +- pelican/utils.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index 26fa40ea..d695c7c8 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -544,7 +544,7 @@ class StaticGenerator(Generator): """Copy all the paths from source to destination""" for path in paths: copy(path, source, os.path.join(output_path, destination), - final_path, overwrite=True) + final_path) def generate_context(self): self.staticfiles = [] diff --git a/pelican/utils.py b/pelican/utils.py index e028c84c..d306de65 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -256,7 +256,7 @@ def slugify(value, substitutions=()): return value.decode('ascii') -def copy(path, source, destination, destination_path=None, overwrite=False): +def copy(path, source, destination, destination_path=None): """Copy path from origin to destination. The function is able to copy either files or directories. @@ -265,8 +265,6 @@ def copy(path, source, destination, destination_path=None, overwrite=False): :param source: the source dir :param destination: the destination dir :param destination_path: the destination path (optional) - :param overwrite: whether to overwrite the destination if already exists - or not """ if not destination_path: destination_path = path From c61f6f402a417e807c9cb6f01c9293fced678892 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Wed, 27 Mar 2013 09:30:54 +0100 Subject: [PATCH 09/46] Prepare for bumpr --- bumpr.rc | 30 ++++++++++++++++++++++++++++++ docs/changelog.rst | 2 +- docs/conf.py | 6 +++--- pelican/__init__.py | 5 +---- 4 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 bumpr.rc diff --git a/bumpr.rc b/bumpr.rc new file mode 100644 index 00000000..cfc90fd7 --- /dev/null +++ b/bumpr.rc @@ -0,0 +1,30 @@ +[bumpr] +file = pelican/__init__.py +vcs = git +clean = + python setup.py clean + rm -rf *egg-info build dist +tests = tox +publish = python setup.py sdist register upload +files = README.rst + +[bump] +unsuffix = true +message = Bump version {version} + +[prepare] +part = patch +suffix = dev +message = Prepare version {version} for next development cycle + +[changelog] +file = docs/changelog.rst +separator = = +bump = {version} ({date:%Y-%m-%d}) +prepare = Next release + +[readthedoc] +url = http://docs.getpelican.com/{tag} + +[commands] +bump = sed -i "s/last_stable\s*=.*/last_stable = '{version}'/" docs/conf.py diff --git a/docs/changelog.rst b/docs/changelog.rst index c020d7f4..27938d4d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,7 +2,7 @@ Release history ############### Next release -================ +============ * Rename signals for better consistency (some plugins may need to be updated) * Move metadata extraction from generators to readers; metadata extraction no diff --git a/docs/conf.py b/docs/conf.py index 84531182..5ac81b9e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -4,7 +4,7 @@ import sys, os sys.path.append(os.path.abspath(os.pardir)) -from pelican import __version__, __major__, __minor__ +from pelican import __version__ # -- General configuration ----------------------------------------------------- templates_path = ['_templates'] @@ -14,9 +14,9 @@ master_doc = 'index' project = 'Pelican' copyright = '2010, Alexis Metaireau and contributors' exclude_patterns = ['_build'] -version = '%s.%s' % (__major__, __minor__) release = __version__ -last_stable = '3.1.1' +version = '.'.join(release.split('.')[:1]) +last_stable = '3.2.2' rst_prolog = ''' .. |last_stable| replace:: :pelican-doc:`{0}` '''.format(last_stable) diff --git a/pelican/__init__.py b/pelican/__init__.py index 2e1763ac..cecab54b 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -22,10 +22,7 @@ from pelican.settings import read_settings from pelican.utils import clean_output_dir, folder_watcher, file_watcher from pelican.writers import Writer -__major__ = 3 -__minor__ = 2 -__micro__ = 0 -__version__ = "{0}.{1}.{2}.dev".format(__major__, __minor__, __micro__) +__version__ = "3.2.3.dev" DEFAULT_CONFIG_NAME = 'pelicanconf.py' From bad8cfb3d9883845c054772b75a5934a96aeb394 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Sat, 24 Aug 2013 20:20:37 +0200 Subject: [PATCH 10/46] Added bumpr as a development requirement to perform release --- dev_requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev_requirements.txt b/dev_requirements.txt index fa2634a0..0a4a4589 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -6,3 +6,6 @@ Markdown BeautifulSoup4 lxml typogrify + +# To perform release +bumpr From 8d41d6ba2419e5d380f42f98e530a898c428f516 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Sat, 24 Aug 2013 23:36:07 -0400 Subject: [PATCH 11/46] Refs #1028. Now iterating over tags --- pelican/themes/simple/templates/article.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pelican/themes/simple/templates/article.html b/pelican/themes/simple/templates/article.html index 8da555a1..2356c2f6 100644 --- a/pelican/themes/simple/templates/article.html +++ b/pelican/themes/simple/templates/article.html @@ -7,6 +7,11 @@ {% for description in article.description %} {% endfor %} + + {% for tag in article.tags %} + Date: Sun, 25 Aug 2013 14:14:43 +0200 Subject: [PATCH 12/46] Pin bumpr version to avoid config breakage with new versions --- dev_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index 0a4a4589..c90ac630 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -8,4 +8,4 @@ lxml typogrify # To perform release -bumpr +bumpr==0.2.0 From 71cca7a444f8ac81be3dd55ba678eb69f5d1269a Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Mon, 26 Aug 2013 23:22:08 +0200 Subject: [PATCH 13/46] Fix the behavior of Markdown extensions. There was several issues here: - `self.extensions` was adding 'meta' multiple times (ref #1058) - `self.extensions` was keeping a reference to `self.settings['MD_EXTENSIONS']`, so adding 'meta' to it. - the `%s_EXTENSIONS` block coming after, it was overriding `self.extensions` with `self.settings['EXTENSIONS']` (while it was a reference, it was working, but ...). As this is currently used only for Mardown, the simplest solution is to remove this, and let each reader manage its `_EXTENSIONS` setting. --- pelican/readers.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index 3f01a72c..067bbb85 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -188,8 +188,9 @@ class MarkdownReader(BaseReader): def __init__(self, *args, **kwargs): super(MarkdownReader, self).__init__(*args, **kwargs) - self.extensions = self.settings['MD_EXTENSIONS'] - self.extensions.append('meta') + self.extensions = list(self.settings['MD_EXTENSIONS']) + if 'meta' not in self.extensions: + self.extensions.append('meta') def _parse_metadata(self, meta): """Return the dict containing document metadata""" @@ -405,11 +406,6 @@ class Readers(object): self.readers[fmt] = reader_class(self.settings) - settings_key = '%s_EXTENSIONS' % fmt.upper() - - if settings_key in self.settings: - self.readers[fmt].extensions = self.settings[settings_key] - @property def extensions(self): return self.readers.keys() From 2f34307e129a8ae14b29262b9c63c0ab091f0f7f Mon Sep 17 00:00:00 2001 From: Talha Mansoor Date: Thu, 29 Aug 2013 23:14:47 +0500 Subject: [PATCH 14/46] Change the regex so that it parse |filename| and {filename} equally Updates getpelican/pelican#1061 --- pelican/contents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/contents.py b/pelican/contents.py index 900049a2..94790612 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -187,7 +187,7 @@ class Content(object): (?:href|src)\s*=) (?P["\']) # require value to be quoted - (?P\|(?P.*?)\|(?P.*?)) # the url value + (?P[|{](?P.*?)[|}](?P.*?)) # the url value \2""", re.X) def replacer(m): From 8d352d9a7863fde988645b9b401c76ab2f8f512d Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Thu, 29 Aug 2013 17:35:48 -0700 Subject: [PATCH 15/46] Correct upload targets in Makefile.in --- pelican/tools/templates/Makefile.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 4ca0af6a..524bf82e 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -27,7 +27,7 @@ DROPBOX_DIR=$dropbox_dir DEBUG ?= 0 ifeq ($(DEBUG), 1) PELICANOPTS += -D -endif +endif help: @echo 'Makefile for a pelican Web site ' @@ -40,13 +40,13 @@ help: @echo ' make serve [PORT=8000] serve site at http://localhost:8000' @echo ' make devserver [PORT=8000] start/restart develop_server.sh ' @echo ' make stopserver stop local server ' - @echo ' ssh_upload upload the web site via SSH ' - @echo ' rsync_upload upload the web site via rsync+ssh ' - @echo ' dropbox_upload upload the web site via Dropbox ' - @echo ' ftp_upload upload the web site via FTP ' - @echo ' s3_upload upload the web site via S3 ' - @echo ' cf_upload upload the web site via Cloud Files' - @echo ' github upload the web site via gh-pages ' + @echo ' make ssh_upload upload the web site via SSH ' + @echo ' make rsync_upload upload the web site via rsync+ssh ' + @echo ' make dropbox_upload upload the web site via Dropbox ' + @echo ' make ftp_upload upload the web site via FTP ' + @echo ' make s3_upload upload the web site via S3 ' + @echo ' make cf_upload upload the web site via Cloud Files' + @echo ' make github upload the web site via gh-pages ' @echo ' ' @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html' @echo ' ' From ef16c915d4dfec668788bcff367a860214d01e55 Mon Sep 17 00:00:00 2001 From: bmcorser Date: Sat, 31 Aug 2013 21:48:19 +0100 Subject: [PATCH 16/46] Clarification of THEME_STATIC_PATHS behaviour --- docs/settings.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index c709a339..075bea83 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -597,7 +597,10 @@ Setting name (default value) What does it do? `THEME_STATIC_PATHS`. Default is `theme`. `THEME_STATIC_PATHS` (``['static']``) Static theme paths you want to copy. Default value is `static`, but if your theme has - other static paths, you can put them here. + other static paths, you can put them here. If files + or directories with the same names are included in + the paths defined in this settings, they will be + progressively overwritten. `CSS_FILE` (``'main.css'``) Specify the CSS file you want to load. ================================================ ===================================================== From 10c62b27dd3ca59972978ee4d57022739769bb2b Mon Sep 17 00:00:00 2001 From: bmcorser Date: Sat, 31 Aug 2013 22:00:52 +0100 Subject: [PATCH 17/46] More exciting files --- samples/kinda/exciting/new/files/zap! | 0 samples/kinda/exciting/old | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 samples/kinda/exciting/new/files/zap! create mode 100644 samples/kinda/exciting/old diff --git a/samples/kinda/exciting/new/files/zap! b/samples/kinda/exciting/new/files/zap! new file mode 100644 index 00000000..e69de29b diff --git a/samples/kinda/exciting/old b/samples/kinda/exciting/old new file mode 100644 index 00000000..e69de29b From 089059aec611b0827b925b987cb0f59bbfe4c485 Mon Sep 17 00:00:00 2001 From: bmcorser Date: Sat, 31 Aug 2013 22:11:03 +0100 Subject: [PATCH 18/46] Clarify revised functinality --- pelican/tests/test_pelican.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pelican/tests/test_pelican.py b/pelican/tests/test_pelican.py index db2d0e6b..e829e1a5 100644 --- a/pelican/tests/test_pelican.py +++ b/pelican/tests/test_pelican.py @@ -99,6 +99,7 @@ class TestPelican(LoggedTestCase): 'PATH': INPUT_PATH, 'OUTPUT_PATH': self.temp_path, 'THEME_STATIC_PATHS': [os.path.join(SAMPLES_PATH, 'very'), + os.path.join(SAMPLES_PATH, 'kinda'), os.path.join(SAMPLES_PATH, 'theme_standard')] }) pelican = Pelican(settings=settings) @@ -109,5 +110,5 @@ class TestPelican(LoggedTestCase): for file in ['a_stylesheet', 'a_template']: self.assertTrue(os.path.exists(os.path.join(theme_output, file))) - for file in ['wow!', 'boom!', 'bap!']: + for file in ['wow!', 'boom!', 'bap!', 'zap!']: self.assertTrue(os.path.exists(os.path.join(extra_path, file))) From b7bc5702154e0e5d7d95ae61dfc22dd9a7ba5c62 Mon Sep 17 00:00:00 2001 From: jeekajoo Date: Mon, 2 Sep 2013 19:25:46 +0200 Subject: [PATCH 19/46] add async and defer attributes to piwik.js inspired from http://piwik.org/docs/javascript-tracking/#toc-where-can-i-find-the-piwik-tracking-code --- pelican/themes/notmyidea/templates/piwik.html | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/pelican/themes/notmyidea/templates/piwik.html b/pelican/themes/notmyidea/templates/piwik.html index ff459af7..f9126264 100644 --- a/pelican/themes/notmyidea/templates/piwik.html +++ b/pelican/themes/notmyidea/templates/piwik.html @@ -1,16 +1,19 @@ {% if PIWIK_URL and PIWIK_SITE_ID %} - -{% endif %} \ No newline at end of file + +{% endif %} From 6813cd923fed8b6a4f30a6951327049a6420e5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Sun, 8 Sep 2013 17:07:30 +0200 Subject: [PATCH 20/46] Close some HTML tags. Fix #1076 --- pelican/tests/output/basic/a-markdown-powered-article.html | 4 ++-- pelican/tests/output/basic/archives.html | 4 ++-- pelican/tests/output/basic/article-1.html | 4 ++-- pelican/tests/output/basic/article-2.html | 4 ++-- pelican/tests/output/basic/article-3.html | 4 ++-- pelican/tests/output/basic/author/alexis-metaireau.html | 4 ++-- pelican/tests/output/basic/authors.html | 4 ++-- pelican/tests/output/basic/categories.html | 4 ++-- pelican/tests/output/basic/category/bar.html | 4 ++-- pelican/tests/output/basic/category/cat1.html | 4 ++-- pelican/tests/output/basic/category/misc.html | 4 ++-- pelican/tests/output/basic/category/yeah.html | 4 ++-- pelican/tests/output/basic/filename_metadata-example.html | 4 ++-- pelican/tests/output/basic/index.html | 4 ++-- pelican/tests/output/basic/oh-yeah.html | 4 ++-- pelican/tests/output/basic/override/index.html | 4 ++-- .../output/basic/pages/this-is-a-test-hidden-page.html | 4 ++-- pelican/tests/output/basic/pages/this-is-a-test-page.html | 4 ++-- pelican/tests/output/basic/second-article-fr.html | 4 ++-- pelican/tests/output/basic/second-article.html | 4 ++-- pelican/tests/output/basic/tag/bar.html | 4 ++-- pelican/tests/output/basic/tag/baz.html | 4 ++-- pelican/tests/output/basic/tag/foo.html | 4 ++-- pelican/tests/output/basic/tag/foobar.html | 4 ++-- pelican/tests/output/basic/tag/oh.html | 4 ++-- pelican/tests/output/basic/tag/yeah.html | 4 ++-- pelican/tests/output/basic/tags.html | 4 ++-- pelican/tests/output/basic/this-is-a-super-article.html | 4 ++-- pelican/tests/output/basic/unbelievable.html | 4 ++-- pelican/tests/output/custom/a-markdown-powered-article.html | 4 ++-- pelican/tests/output/custom/archives.html | 4 ++-- pelican/tests/output/custom/article-1.html | 4 ++-- pelican/tests/output/custom/article-2.html | 4 ++-- pelican/tests/output/custom/article-3.html | 4 ++-- pelican/tests/output/custom/author/alexis-metaireau.html | 4 ++-- pelican/tests/output/custom/author/alexis-metaireau2.html | 4 ++-- pelican/tests/output/custom/author/alexis-metaireau3.html | 4 ++-- pelican/tests/output/custom/authors.html | 4 ++-- pelican/tests/output/custom/categories.html | 4 ++-- pelican/tests/output/custom/category/bar.html | 4 ++-- pelican/tests/output/custom/category/cat1.html | 4 ++-- pelican/tests/output/custom/category/misc.html | 4 ++-- pelican/tests/output/custom/category/yeah.html | 4 ++-- pelican/tests/output/custom/drafts/a-draft-article.html | 4 ++-- pelican/tests/output/custom/filename_metadata-example.html | 4 ++-- pelican/tests/output/custom/index.html | 4 ++-- pelican/tests/output/custom/index2.html | 4 ++-- pelican/tests/output/custom/index3.html | 4 ++-- pelican/tests/output/custom/jinja2_template.html | 4 ++-- pelican/tests/output/custom/oh-yeah-fr.html | 4 ++-- pelican/tests/output/custom/oh-yeah.html | 4 ++-- pelican/tests/output/custom/override/index.html | 4 ++-- .../output/custom/pages/this-is-a-test-hidden-page.html | 4 ++-- pelican/tests/output/custom/pages/this-is-a-test-page.html | 4 ++-- pelican/tests/output/custom/second-article-fr.html | 4 ++-- pelican/tests/output/custom/second-article.html | 4 ++-- pelican/tests/output/custom/tag/bar.html | 4 ++-- pelican/tests/output/custom/tag/baz.html | 4 ++-- pelican/tests/output/custom/tag/foo.html | 4 ++-- pelican/tests/output/custom/tag/foobar.html | 4 ++-- pelican/tests/output/custom/tag/oh.html | 4 ++-- pelican/tests/output/custom/tag/yeah.html | 4 ++-- pelican/tests/output/custom/tags.html | 4 ++-- pelican/tests/output/custom/this-is-a-super-article.html | 4 ++-- pelican/tests/output/custom/unbelievable.html | 4 ++-- pelican/themes/notmyidea/templates/base.html | 4 ++-- pelican/themes/simple/templates/article.html | 6 +++--- 67 files changed, 135 insertions(+), 135 deletions(-) diff --git a/pelican/tests/output/basic/a-markdown-powered-article.html b/pelican/tests/output/basic/a-markdown-powered-article.html index b7a90f02..6bc29eba 100644 --- a/pelican/tests/output/basic/a-markdown-powered-article.html +++ b/pelican/tests/output/basic/a-markdown-powered-article.html @@ -1,9 +1,9 @@ - + A markdown powered article - + diff --git a/pelican/tests/output/basic/feeds/all-en.atom.xml b/pelican/tests/output/basic/feeds/all-en.atom.xml index 5b8eb591..da537344 100644 --- a/pelican/tests/output/basic/feeds/all-en.atom.xml +++ b/pelican/tests/output/basic/feeds/all-en.atom.xml @@ -31,7 +31,14 @@ YEAH !</p> <h2>Testing sourcecode directive</h2> <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> </pre></div> -</td></tr></table><p>Lovely.</p> +</td></tr></table></div> +<div class="section" id="testing-another-case"> +<h2>Testing another case</h2> +<p>This will now have a line number in 'custom' since it's the default in +pelican.conf, it will have nothing in default.</p> +<div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> +<p>Lovely.</p> </div> <div class="section" id="testing-more-sourcecode-directives"> <h2>Testing more sourcecode directives</h2> @@ -43,5 +50,12 @@ YEAH !</p> <span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> <p>Lovely.</p> </div> +<div class="section" id="testing-overriding-config-defaults"> +<h2>Testing overriding config defaults</h2> +<p>Even if the default is line numbers, we can override it here</p> +<div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> +<p>Lovely.</p> +</div> The baz tag2010-03-14T00:00:00Ztag:,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> \ No newline at end of file diff --git a/pelican/tests/output/basic/feeds/all.atom.xml b/pelican/tests/output/basic/feeds/all.atom.xml index d19b0c30..d837c895 100644 --- a/pelican/tests/output/basic/feeds/all.atom.xml +++ b/pelican/tests/output/basic/feeds/all.atom.xml @@ -32,7 +32,14 @@ YEAH !</p> <h2>Testing sourcecode directive</h2> <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> </pre></div> -</td></tr></table><p>Lovely.</p> +</td></tr></table></div> +<div class="section" id="testing-another-case"> +<h2>Testing another case</h2> +<p>This will now have a line number in 'custom' since it's the default in +pelican.conf, it will have nothing in default.</p> +<div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> +<p>Lovely.</p> </div> <div class="section" id="testing-more-sourcecode-directives"> <h2>Testing more sourcecode directives</h2> @@ -44,5 +51,12 @@ YEAH !</p> <span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> <p>Lovely.</p> </div> +<div class="section" id="testing-overriding-config-defaults"> +<h2>Testing overriding config defaults</h2> +<p>Even if the default is line numbers, we can override it here</p> +<div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> +<p>Lovely.</p> +</div> The baz tag2010-03-14T00:00:00Ztag:,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> \ No newline at end of file diff --git a/pelican/tests/output/basic/feeds/misc.atom.xml b/pelican/tests/output/basic/feeds/misc.atom.xml index 34b6b4fb..8b988614 100644 --- a/pelican/tests/output/basic/feeds/misc.atom.xml +++ b/pelican/tests/output/basic/feeds/misc.atom.xml @@ -8,7 +8,14 @@ <h2>Testing sourcecode directive</h2> <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> </pre></div> -</td></tr></table><p>Lovely.</p> +</td></tr></table></div> +<div class="section" id="testing-another-case"> +<h2>Testing another case</h2> +<p>This will now have a line number in 'custom' since it's the default in +pelican.conf, it will have nothing in default.</p> +<div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> +<p>Lovely.</p> </div> <div class="section" id="testing-more-sourcecode-directives"> <h2>Testing more sourcecode directives</h2> @@ -20,5 +27,12 @@ <span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> <p>Lovely.</p> </div> +<div class="section" id="testing-overriding-config-defaults"> +<h2>Testing overriding config defaults</h2> +<p>Even if the default is line numbers, we can override it here</p> +<div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> +<p>Lovely.</p> +</div> The baz tag2010-03-14T00:00:00Ztag:,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> \ No newline at end of file diff --git a/pelican/tests/output/basic/index.html b/pelican/tests/output/basic/index.html index 08c4ad09..24b00606 100644 --- a/pelican/tests/output/basic/index.html +++ b/pelican/tests/output/basic/index.html @@ -219,11 +219,11 @@ YEAH !

Testing sourcecode directive

1
formatter = self.options and VARIANTS[self.options.keys()[0]]
 
-

Lovely.

- -
-

Testing more sourcecode directives

-
 8 def run(self):
self.assert_has_content()
10 try:
lexer = get_lexer_by_name(self.arguments[0])
12 except ValueError ...
+ +
+

Testing another case

+

This will now have a line number in 'custom' since it's the default in +pelican.conf, it ...

read more diff --git a/pelican/tests/output/basic/unbelievable.html b/pelican/tests/output/basic/unbelievable.html index db8d0bdf..aef78474 100644 --- a/pelican/tests/output/basic/unbelievable.html +++ b/pelican/tests/output/basic/unbelievable.html @@ -47,7 +47,14 @@

Testing sourcecode directive

1
formatter = self.options and VARIANTS[self.options.keys()[0]]
 
-

Lovely.

+ +
+

Testing another case

+

This will now have a line number in 'custom' since it's the default in +pelican.conf, it will have nothing in default.

+
formatter = self.options and VARIANTS[self.options.keys()[0]]
+
+

Lovely.

Testing more sourcecode directives

@@ -58,6 +65,13 @@

Testing even more sourcecode directives

formatter = self.options and VARIANTS[self.options.keys()[0]]

Lovely.

+
+
+

Testing overriding config defaults

+

Even if the default is line numbers, we can override it here

+
formatter = self.options and VARIANTS[self.options.keys()[0]]
+
+

Lovely.

diff --git a/pelican/tests/output/custom/author/alexis-metaireau3.html b/pelican/tests/output/custom/author/alexis-metaireau3.html index 4b598914..77c9cdfe 100644 --- a/pelican/tests/output/custom/author/alexis-metaireau3.html +++ b/pelican/tests/output/custom/author/alexis-metaireau3.html @@ -55,11 +55,11 @@

Testing sourcecode directive

1
formatter = self.options and VARIANTS[self.options.keys()[0]]
 
-

Lovely.

- -
-

Testing more sourcecode directives

-
 8 def run(self):
self.assert_has_content()
10 try:
lexer = get_lexer_by_name(self.arguments[0])
12 except ValueError ...
+ +
+

Testing another case

+

This will now have a line number in 'custom' since it's the default in +pelican.conf, it ...

read more

There are comments.

diff --git a/pelican/tests/output/custom/category/misc.html b/pelican/tests/output/custom/category/misc.html index f32e04c3..36479803 100644 --- a/pelican/tests/output/custom/category/misc.html +++ b/pelican/tests/output/custom/category/misc.html @@ -99,11 +99,11 @@

Testing sourcecode directive

1
formatter = self.options and VARIANTS[self.options.keys()[0]]
 
-

Lovely.

- -
-

Testing more sourcecode directives

-
 8 def run(self):
self.assert_has_content()
10 try:
lexer = get_lexer_by_name(self.arguments[0])
12 except ValueError ...
+ +
+

Testing another case

+

This will now have a line number in 'custom' since it's the default in +pelican.conf, it ...

read more

There are comments.

diff --git a/pelican/tests/output/custom/feeds/all-en.atom.xml b/pelican/tests/output/custom/feeds/all-en.atom.xml index ce25290d..69ba08c6 100644 --- a/pelican/tests/output/custom/feeds/all-en.atom.xml +++ b/pelican/tests/output/custom/feeds/all-en.atom.xml @@ -31,6 +31,13 @@ YEAH !</p> <h2>Testing sourcecode directive</h2> <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> </pre></div> +</td></tr></table></div> +<div class="section" id="testing-another-case"> +<h2>Testing another case</h2> +<p>This will now have a line number in 'custom' since it's the default in +pelican.conf, it will have nothing in default.</p> +<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> </td></tr></table><p>Lovely.</p> </div> <div class="section" id="testing-more-sourcecode-directives"> @@ -43,5 +50,12 @@ YEAH !</p> <span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> <p>Lovely.</p> </div> +<div class="section" id="testing-overriding-config-defaults"> +<h2>Testing overriding config defaults</h2> +<p>Even if the default is line numbers, we can override it here</p> +<div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> +<p>Lovely.</p> +</div> The baz tag2010-03-14T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> \ No newline at end of file diff --git a/pelican/tests/output/custom/feeds/all.atom.xml b/pelican/tests/output/custom/feeds/all.atom.xml index 68986d40..2eb31731 100644 --- a/pelican/tests/output/custom/feeds/all.atom.xml +++ b/pelican/tests/output/custom/feeds/all.atom.xml @@ -33,6 +33,13 @@ YEAH !</p> <h2>Testing sourcecode directive</h2> <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> </pre></div> +</td></tr></table></div> +<div class="section" id="testing-another-case"> +<h2>Testing another case</h2> +<p>This will now have a line number in 'custom' since it's the default in +pelican.conf, it will have nothing in default.</p> +<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> </td></tr></table><p>Lovely.</p> </div> <div class="section" id="testing-more-sourcecode-directives"> @@ -45,5 +52,12 @@ YEAH !</p> <span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> <p>Lovely.</p> </div> +<div class="section" id="testing-overriding-config-defaults"> +<h2>Testing overriding config defaults</h2> +<p>Even if the default is line numbers, we can override it here</p> +<div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> +<p>Lovely.</p> +</div> The baz tag2010-03-14T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> \ No newline at end of file diff --git a/pelican/tests/output/custom/feeds/all.rss.xml b/pelican/tests/output/custom/feeds/all.rss.xml index 7fee491a..69e30bfd 100644 --- a/pelican/tests/output/custom/feeds/all.rss.xml +++ b/pelican/tests/output/custom/feeds/all.rss.xml @@ -33,6 +33,13 @@ YEAH !</p> <h2>Testing sourcecode directive</h2> <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> </pre></div> +</td></tr></table></div> +<div class="section" id="testing-another-case"> +<h2>Testing another case</h2> +<p>This will now have a line number in 'custom' since it's the default in +pelican.conf, it will have nothing in default.</p> +<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> </td></tr></table><p>Lovely.</p> </div> <div class="section" id="testing-more-sourcecode-directives"> @@ -45,5 +52,12 @@ YEAH !</p> <span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> <p>Lovely.</p> </div> +<div class="section" id="testing-overriding-config-defaults"> +<h2>Testing overriding config defaults</h2> +<p>Even if the default is line numbers, we can override it here</p> +<div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> +<p>Lovely.</p> +</div> Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.htmlThe baz taghttp://blog.notmyidea.org/tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> Alexis MétaireauSun, 14 Mar 2010 00:00:00 +0100tag:blog.notmyidea.org,2010-03-14:tag/baz.html \ No newline at end of file diff --git a/pelican/tests/output/custom/feeds/misc.atom.xml b/pelican/tests/output/custom/feeds/misc.atom.xml index 9328e05a..91d6b28f 100644 --- a/pelican/tests/output/custom/feeds/misc.atom.xml +++ b/pelican/tests/output/custom/feeds/misc.atom.xml @@ -8,6 +8,13 @@ <h2>Testing sourcecode directive</h2> <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> </pre></div> +</td></tr></table></div> +<div class="section" id="testing-another-case"> +<h2>Testing another case</h2> +<p>This will now have a line number in 'custom' since it's the default in +pelican.conf, it will have nothing in default.</p> +<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> </td></tr></table><p>Lovely.</p> </div> <div class="section" id="testing-more-sourcecode-directives"> @@ -20,5 +27,12 @@ <span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> <p>Lovely.</p> </div> +<div class="section" id="testing-overriding-config-defaults"> +<h2>Testing overriding config defaults</h2> +<p>Even if the default is line numbers, we can override it here</p> +<div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> +<p>Lovely.</p> +</div> The baz tag2010-03-14T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> \ No newline at end of file diff --git a/pelican/tests/output/custom/feeds/misc.rss.xml b/pelican/tests/output/custom/feeds/misc.rss.xml index b708c70d..3493d2a3 100644 --- a/pelican/tests/output/custom/feeds/misc.rss.xml +++ b/pelican/tests/output/custom/feeds/misc.rss.xml @@ -8,6 +8,13 @@ <h2>Testing sourcecode directive</h2> <table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> </pre></div> +</td></tr></table></div> +<div class="section" id="testing-another-case"> +<h2>Testing another case</h2> +<p>This will now have a line number in 'custom' since it's the default in +pelican.conf, it will have nothing in default.</p> +<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> </td></tr></table><p>Lovely.</p> </div> <div class="section" id="testing-more-sourcecode-directives"> @@ -20,5 +27,12 @@ <span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> <p>Lovely.</p> </div> +<div class="section" id="testing-overriding-config-defaults"> +<h2>Testing overriding config defaults</h2> +<p>Even if the default is line numbers, we can override it here</p> +<div class="highlight"><pre><span class="n">formatter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="ow">and</span> <span class="n">VARIANTS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]]</span> +</pre></div> +<p>Lovely.</p> +</div> Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.htmlThe baz taghttp://blog.notmyidea.org/tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> Alexis MétaireauSun, 14 Mar 2010 00:00:00 +0100tag:blog.notmyidea.org,2010-03-14:tag/baz.html \ No newline at end of file diff --git a/pelican/tests/output/custom/index3.html b/pelican/tests/output/custom/index3.html index 69f9d20c..b4d9ffc6 100644 --- a/pelican/tests/output/custom/index3.html +++ b/pelican/tests/output/custom/index3.html @@ -55,11 +55,11 @@

Testing sourcecode directive

1
formatter = self.options and VARIANTS[self.options.keys()[0]]
 
-

Lovely.

- -
-

Testing more sourcecode directives

-
 8 def run(self):
self.assert_has_content()
10 try:
lexer = get_lexer_by_name(self.arguments[0])
12 except ValueError ...
+ +
+

Testing another case

+

This will now have a line number in 'custom' since it's the default in +pelican.conf, it ...

read more

There are comments.

diff --git a/pelican/tests/output/custom/unbelievable.html b/pelican/tests/output/custom/unbelievable.html index 74bfa83c..03b533bb 100644 --- a/pelican/tests/output/custom/unbelievable.html +++ b/pelican/tests/output/custom/unbelievable.html @@ -54,6 +54,13 @@

Testing sourcecode directive

1
formatter = self.options and VARIANTS[self.options.keys()[0]]
 
+
+
+

Testing another case

+

This will now have a line number in 'custom' since it's the default in +pelican.conf, it will have nothing in default.

+
1
formatter = self.options and VARIANTS[self.options.keys()[0]]
+

Lovely.

@@ -65,6 +72,13 @@

Testing even more sourcecode directives

formatter = self.options and VARIANTS[self.options.keys()[0]]

Lovely.

+
+
+

Testing overriding config defaults

+

Even if the default is line numbers, we can override it here

+
formatter = self.options and VARIANTS[self.options.keys()[0]]
+
+

Lovely.

diff --git a/samples/content/unbelievable.rst b/samples/content/unbelievable.rst index b990d20c..209e3557 100644 --- a/samples/content/unbelievable.rst +++ b/samples/content/unbelievable.rst @@ -12,9 +12,20 @@ Testing sourcecode directive ---------------------------- .. sourcecode:: python - :linenos: + :linenos: - formatter = self.options and VARIANTS[self.options.keys()[0]] + formatter = self.options and VARIANTS[self.options.keys()[0]] + + +Testing another case +-------------------- + +This will now have a line number in 'custom' since it's the default in +pelican.conf, it will have nothing in default. + +.. sourcecode:: python + + formatter = self.options and VARIANTS[self.options.keys()[0]] Lovely. @@ -71,3 +82,17 @@ Testing even more sourcecode directives Lovely. + +Testing overriding config defaults +---------------------------------- + +Even if the default is line numbers, we can override it here + +.. sourcecode:: python + :linenos: none + + + formatter = self.options and VARIANTS[self.options.keys()[0]] + + +Lovely. diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py index 4d5cd06d..d6a87923 100755 --- a/samples/pelican.conf.py +++ b/samples/pelican.conf.py @@ -48,6 +48,9 @@ STATIC_PATHS = [ # custom page generated with a jinja2 template TEMPLATE_PAGES = {'pages/jinja2_template.html': 'jinja2_template.html'} +# code blocks with line numbers +PYGMENTS_RST_OPTIONS = {'linenos': 'table'} + # foobar will not be used, because it's not in caps. All configuration keys # have to be in caps foobar = "barbaz" From 22da74211d1874edf4e6d3c01f7526d5b633a0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 17 Sep 2013 17:32:08 +0200 Subject: [PATCH 29/46] Fix a broken link --- docs/faq.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faq.rst b/docs/faq.rst index c1d4f5a0..f7ee6826 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -49,7 +49,7 @@ themes to style code syntax highlighting via CSS. Specifically, you can customize the appearance of your syntax highlighting via the ``.highlight pre`` class in your theme's CSS file. To see how various styles can be used to render Django code, for example, use the style selector drop-down at top-right on the -`Pygments project demo site `_. +`Pygments project demo site `_. You can use the following example commands to generate a starting CSS file from a Pygments built-in style (in this case, "monokai") and then copy the generated From 07f87969ea7a66a89f6a54ea575659f839d6d1d7 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 23 Sep 2013 19:28:06 +0200 Subject: [PATCH 30/46] Update changelog --- docs/changelog.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 064c8fd2..ebf84f34 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,13 +4,27 @@ Release history Next release ============ +* Drop Python 3.2 support in favor of Python 3.3 +* Add ``Fabfile`` so Fabric can be used for workflow automation instead of Make +* ``OUTPUT_RETENTION`` setting can be used to preserve metadata (e.g., VCS + data such as ``.hg`` and ``.git``) from being removed from output directory +* Tumblr import +* Improve logic and consistency when cleaning output folder +* Improve documentation versioning and release automation +* Improve pagination flexibility * Rename signals for better consistency (some plugins may need to be updated) * Move metadata extraction from generators to readers; metadata extraction no longer article-specific * Deprecate ``FILES_TO_COPY`` in favor of ``STATIC_PATHS`` and ``EXTRA_PATH_METADATA`` +* Summaries in Markdown posts no longer include footnotes +* Remove unnecessary whitespace in output via ``lstrip_blocks`` Jinja parameter +* Move PDF generation from core to plugin +* Replace ``MARKUP`` setting with ``READERS`` +* Add warning if img tag is missing ``alt`` attribute * Add support for ``{}`` in relative links syntax, besides ``||`` * Add support for ``{tag}`` and ``{category}`` relative links +* Add a ``content_written`` signal 3.2.1 and 3.2.2 =============== From f6c9237a0115491b7db3206717e63a4250c6c2b8 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 23 Sep 2013 19:30:51 +0200 Subject: [PATCH 31/46] Enhance and correct documentation --- docs/faq.rst | 13 +++---- docs/getting_started.rst | 60 ++++++++++++++++--------------- docs/index.rst | 10 ++++-- docs/plugins.rst | 16 ++++----- docs/settings.rst | 77 ++++++++++++++++++++-------------------- docs/themes.rst | 23 ++++++------ docs/tips.rst | 48 +++++++++++++------------ 7 files changed, 129 insertions(+), 118 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index f7ee6826..da37af04 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -23,8 +23,8 @@ How can I help? There are several ways to help out. First, you can report any Pelican suggestions or problems you might have via IRC or the `issue tracker `_. If submitting an issue -report, please check the existing issue list first in order to avoid submitting -a duplicate issue. +report, please first check the existing issue list (both open and closed) in +order to avoid submitting a duplicate issue. If you want to contribute, please fork `the git repository `_, create a new feature branch, make @@ -96,7 +96,8 @@ This metadata can then be accessed in templates such as ``article.html`` via:: Last modified: {{ article.modified }} {% endif %} -If you want to include metadata in templates outside the article context (e.g., ``base.html``), the ``if`` statement should instead be:: +If you want to include metadata in templates outside the article context (e.g., +``base.html``), the ``if`` statement should instead be:: {% if article and article.modified %} @@ -196,10 +197,10 @@ Is Pelican only suitable for blogs? =================================== No. Pelican can be easily configured to create and maintain any type of static site. -This may require little customization of your theme and Pelican configuration. +This may require a little customization of your theme and Pelican configuration. For example, if you are building a launch site for your product and do not need -tags on your site. You can hide tags by removing relevant html code from your theme. -You can also disable generation of tags pages:: +tags on your site, you could remove the relevant HTML code from your theme. +You can also disable generation of tag-related pages via:: TAGS_SAVE_AS = '' TAG_SAVE_AS = '' diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 2605c3a1..201b9ad4 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -83,15 +83,20 @@ Viewing the generated files --------------------------- The files generated by Pelican are static files, so you don't actually need -anything special to view them. You can either use your browser to open the -files on your disk:: +anything special to view them. You can use your browser to open the generated +HTML files directly:: firefox output/index.html -Or run a simple web server using Python:: +Because the above method may have trouble locating your CSS and other linked +assets, running a simple web server using Python will often provide a more +reliable previewing experience:: cd output && python -m SimpleHTTPServer +Once the ``SimpleHTTPServer`` has been started, you can preview your site at +http://localhost:8000/ + Upgrading --------- @@ -452,25 +457,24 @@ And ``image-test.md`` would include:: ![Alt Text]({filename}/images/han.jpg) Any content can be linked in this way. What happens is that the ``images`` -directory gets copied to ``output/static/`` upon publishing. This is -because ``images`` is in the ``settings["STATIC_PATHS"]`` list by default. If -you want to have another directory, say ``pdfs`` you would need to add the -following to ``pelicanconf.py``:: +directory gets copied to ``output/`` during site generation because Pelican +includes ``images`` in the ``STATIC_PATHS`` setting's list by default. If +you want to have another directory, say ``pdfs``, copied from your content to +your output during site generation, you would need to add the following to +your settings file:: STATIC_PATHS = ['images', 'pdfs'] -And then the ``pdfs`` directory would also be copied to ``output/static/``. +After the above line has been added, subsequent site generation should copy the +``content/pdfs/`` directory to ``output/pdfs/``. You can also link to categories or tags, using the ``{tag}tagname`` and ``{category}foobar`` syntax. -For backward compatibility, Pelican also supports bars ``||``, besides ``{}``, -i.e. the ``filename``, ``tag`` and ``category`` identifiers can be enclosed -in bars ``|`` instead of braces ``{}``, for example, ``|filename|an_article.rst``, -``|tag|tagname``, ``|category|foobar``. - -Using ``{}`` ensures that the syntax will not collide with markdown extensions or -reST directives. +For backward compatibility, Pelican also supports bars (``||``) in addition to +curly braces (``{}``). For example: ``|filename|an_article.rst``, +``|tag|tagname``, ``|category|foobar``. The syntax was changed from ``||`` to +``{}`` to avoid collision with Markdown extensions or reST directives. Importing an existing blog -------------------------- @@ -590,12 +594,12 @@ tagsfile string ctags file to use for name definitions. tagurlformat string format for the ctag links. ============= ============ ========================================= -Note that, depending on its version, your pygments module might not have -all of these available. See the `Pygments documentation -`_ for the HTML formatter for more +Note that, depending on the version, your Pygments module might not have +all of these options available. Refer to the *HtmlFormatter* section of the +`Pygments documentation `_ for more details on each of the options. -for example the below code block enables line numbers, starting at 153, +For example, the following code block enables line numbers, starting at 153, and prefixes the Pygments CSS classes with *pgcss* to make the names more unique and avoid possible CSS conflicts:: @@ -606,25 +610,25 @@ more unique and avoid possible CSS conflicts:: -It is also possible to specify the ``PYGMENTS_RST_OPTIONS`` variable -in your Pelican configuration file for settings that will be -automatically applied to every code block. +It is also possible to specify the ``PYGMENTS_RST_OPTIONS`` variable in your +Pelican settings file to include options that will be automatically applied to +every code block. -For example, if you wanted to have line numbers on for every code block +For example, if you want to have line numbers displayed for every code block and a CSS prefix you would set this variable to:: - PYGMENTS_RST_OPTIONS = { 'classprefix': 'pgcss', 'linenos': 'table'} + PYGMENTS_RST_OPTIONS = {'classprefix': 'pgcss', 'linenos': 'table'} -If specified, settings for individual code blocks will override the -defaults in the configuration file. +If specified, settings for individual code blocks will override the defaults in +your settings file. Publishing drafts ----------------- If you want to publish an article as a draft (for friends to review before -publishing, for example), you can add a ``status: draft`` attribute to its +publishing, for example), you can add a ``Status: draft`` attribute to its metadata. That article will then be output to the ``drafts`` folder and not -listed on the index page nor on any category page. +listed on the index page nor on any category or tag page. .. _virtualenv: http://www.virtualenv.org/ .. _W3C ISO 8601: http://www.w3.org/TR/NOTE-datetime diff --git a/docs/index.rst b/docs/index.rst index eb8883ce..35e859d5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -51,9 +51,13 @@ If you want to see new features in Pelican, don't hesitate to offer suggestions, clone the repository, etc. There are many ways to :doc:`contribute`. That's open source, dude! -Send a message to "authors at getpelican dot com" with any requests/feedback! You -can also join the team at `#pelican on Freenode`_ (or if you don't have an IRC -client handy, use the webchat_ for quick feedback. +Send a message to "authors at getpelican dot com" with any requests/feedback. +For a more immediate response, you can also join the team via IRC at +`#pelican on Freenode`_ — if you don't have an IRC client handy, use the +webchat_ for quick feedback. If you ask a question via IRC and don't get an +immediate response, don't leave the channel! It may take a few hours because +of time zone differences, but f you are patient and remain in the channel, +someone will almost always respond to your inquiry. Documentation ------------- diff --git a/docs/plugins.rst b/docs/plugins.rst index 29d67e24..6de01d05 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -135,15 +135,15 @@ shared in the documentation somewhere, so here they are! How to create a new reader -------------------------- -One thing you might want is to add the support for your very own input -format. While it might make sense to add this feature in pelican core, we -wisely chose to avoid this situation, and have the different readers defined in -plugins. +One thing you might want is to add support for your very own input format. +While it might make sense to add this feature in Pelican core, we +wisely chose to avoid this situation and instead have the different readers +defined via plugins. The rationale behind this choice is mainly that plugins are really easy to -write and don't slow down pelican itself when they're not active. +write and don't slow down Pelican itself when they're not active. -No more talking, here is the example:: +No more talking — here is an example:: from pelican import signals from pelican.readers import BaseReader @@ -153,7 +153,7 @@ No more talking, here is the example:: enabled = True # Yeah, you probably want that :-) # The list of file extensions you want this reader to match with. - # In the case multiple readers use the same extensions, the latest will + # If multiple readers were to use the same extension, the latest will # win (so the one you're defining here, most probably). file_extensions = ['yeah'] @@ -173,7 +173,7 @@ No more talking, here is the example:: def add_reader(readers): readers.reader_classes['yeah'] = NewReader - # this is how pelican works. + # This is how pelican works. def register(): signals.readers_init.connect(add_reader) diff --git a/docs/settings.rst b/docs/settings.rst index e8965731..b6c18fa9 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -84,10 +84,10 @@ Setting name (default value) What doe here or a single string representing one locale. When providing a list, all the locales will be tried until one works. -`READERS` (``{}``) A dict of file extensions / Reader classes to overwrite or - add file readers. for instance, to avoid processing .html files: - ``READERS = {'html': None}``. Or to add a custom reader for the - `foo` extension: ``READERS = {'foo': FooReader}`` +`READERS` (``{}``) A dictionary of file extensions / Reader classes for Pelican to + process or ignore. For example, to avoid processing .html files, + set: ``READERS = {'html': None}``. To add a custom reader for the + `foo` extension, set: ``READERS = {'foo': FooReader}`` `IGNORE_FILES` (``['.#*']``) A list of file globbing patterns to match against the source files to be ignored by the processor. For example, the default ``['.#*']`` will ignore emacs lock files. @@ -106,11 +106,9 @@ Setting name (default value) What doe `PAGE_EXCLUDES` (``()``) A list of directories to exclude when looking for pages. `ARTICLE_DIR` (``''``) Directory to look at for articles, relative to `PATH`. `ARTICLE_EXCLUDES`: (``('pages',)``) A list of directories to exclude when looking for articles. -`PDF_GENERATOR` (``False``) Set to ``True`` if you want PDF versions of your documents to be. - generated. You will need to install ``rst2pdf``. `OUTPUT_SOURCES` (``False``) Set to True if you want to copy the articles and pages in their original format (e.g. Markdown or reStructuredText) to the - specified OUTPUT_PATH. + specified ``OUTPUT_PATH``. `OUTPUT_SOURCES_EXTENSION` (``.text``) Controls the extension that will be used by the SourcesGenerator. Defaults to ``.text``. If not a valid string the default value will be used. @@ -144,7 +142,7 @@ Setting name (default value) What doe are not needed, set ``DIRECT_TEMPLATES = ('index', 'archives')`` `PAGINATED_DIRECT_TEMPLATES` (``('index',)``) Provides the direct templates that should be paginated. `SUMMARY_MAX_LENGTH` (``50``) When creating a short summary of an article, this will - be the default length in words of the text created. + be the default length (measured 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. @@ -155,9 +153,9 @@ Setting name (default value) What doe `ASCIIDOC_OPTIONS` (``[]``) A list of options to pass to AsciiDoc. See the `manpage `_ `WITH_FUTURE_DATES` (``True``) If disabled, content with dates in the future will get a - default status of draft. + default status of ``draft``. `INTRASITE_LINK_REGEX` (``'[{|](?P.*?)[|}]'``) Regular expression that is used to parse internal links. - Default syntax of links to internal files, tags, etc. is + Default syntax of links to internal files, tags, etc., is to enclose the identifier, say ``filename``, in ``{}`` or ``||``. Identifier between ``{`` and ``}`` goes into the ``what`` capturing group. For details see :ref:`ref-linking-to-internal-content`. @@ -173,7 +171,7 @@ 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 +for URL formation: *relative* and *absolute*. 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 @@ -181,16 +179,17 @@ 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 -``{slug}`` for clean URLs. These settings give you the flexibility to place your -articles and pages anywhere you want. +You can customize the URLs and locations where files will be saved. The +``*_URL`` and ``*_SAVE_AS`` variables use Python's format strings. These +variables allow you to place your articles in a location such as +``{slug}/index.html`` and link to them as ``{slug}`` for clean URLs. These +settings give you the flexibility to place your articles and pages anywhere you +want. .. note:: - If you specify a datetime directive, it will be substituted using the + If you specify a ``datetime`` directive, it will be substituted using the input files' date metadata attribute. If the date is not specified for a - particular file, Pelican will rely on the file's mtime timestamp. + particular file, Pelican will rely on the file's ``mtime`` timestamp. Check the Python datetime documentation at http://bit.ly/cNcJUC for more information. @@ -213,7 +212,7 @@ and the URL to this would be ``/posts/2011/Aug/07/sample-post/``. Pelican can optionally create per-year, per-month, and per-day archives of your posts. These secondary archives are disabled by default but are automatically -enabled if you supply format strings for their respective `_SAVE_AS` settings. +enabled if you supply format strings for their respective ``_SAVE_AS`` settings. Period archives fit intuitively with the hierarchical model of web URLs and can make it easier for readers to navigate through the posts you've written over time. @@ -222,12 +221,12 @@ Example usage: * YEAR_ARCHIVE_SAVE_AS = ``'posts/{date:%Y}/index.html'`` * MONTH_ARCHIVE_SAVE_AS = ``'posts/{date:%Y}/{date:%b}/index.html'`` -With these settings, Pelican will create an archive of all your posts for the year -at (for instance) 'posts/2011/index.html', and an archive of all your posts for -the month at 'posts/2011/Aug/index.html'. +With these settings, Pelican will create an archive of all your posts for the +year at (for instance) ``posts/2011/index.html`` and an archive of all your +posts for the month at ``posts/2011/Aug/index.html``. .. note:: - Period archives work best when the final path segment is 'index.html'. + Period archives work best when the final path segment is ``index.html``. This way a reader can remove a portion of your URL and automatically arrive at an appropriate archive of posts, without having to specify a page name. @@ -299,10 +298,11 @@ Have a look at `the wikipedia page`_ to get a list of valid timezone values. Date format and locale ---------------------- -If no DATE_FORMATS are set, Pelican will fall back to DEFAULT_DATE_FORMAT. If -you need to maintain multiple languages with different date formats, you can -set this dict using the language name (``lang`` metadata in your post content) -as the key. Regarding available format codes, see `strftime document of python`_ : +If no ``DATE_FORMATS`` are set, Pelican will fall back to +``DEFAULT_DATE_FORMAT``. If you need to maintain multiple languages with +different date formats, you can set the ``DATE_FORMATS`` dictionary using the +language name (``lang`` metadata in your post content) as the key. Regarding +available format codes, see `strftime document of python`_ : .. parsed-literal:: @@ -320,8 +320,8 @@ You can set locale to further control date format: ) Also, it is possible to set different locale settings for each language. If you -put (locale, format) tuples in the dict, this will override the LOCALE setting -above: +put (locale, format) tuples in the dict, this will override the ``LOCALE`` +setting above: .. parsed-literal:: # On Unix/Linux @@ -473,9 +473,9 @@ Pagination ========== The default behaviour of Pelican is to list all the article titles along -with a short description on the index page. While it works pretty well -for small-to-medium blogs, for sites with large quantity of articles it would -be convenient to have a way to paginate the list. +with a short description on the index page. While this works well for +small-to-medium sites, sites with a large quantity of articles will probably +benefit from paginating this list. You can use the following settings to configure the pagination. @@ -483,8 +483,8 @@ You can use the following settings to configure the pagination. Setting name (default value) What does it do? ================================================ ===================================================== `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. + last page. Use this when you don't want the last page + to only contain a handful of articles. `DEFAULT_PAGINATION` (``False``) The maximum number of articles to include on a page, not including orphans. False to disable pagination. @@ -528,7 +528,7 @@ Setting name (default value) What does it do? `TAG_CLOUD_MAX_ITEMS` (``100``) Maximum number of tags in the cloud. ================================================ ===================================================== -The default theme does not include a tag cloud, but it is pretty easy to add:: +The default theme does not include a tag cloud, but it is pretty easy to add one::
    {% for tag in tag_cloud %} @@ -536,9 +536,10 @@ The default theme does not include a tag cloud, but it is pretty easy to add:: {% endfor %}
-You should then also define CSS styles with appropriate classes (tag-0 to tag-N, where -N matches `TAG_CLOUD_STEPS` -1), tag-0 being the most frequent, and define a ul.tagcloud -class with appropriate list-style to create the cloud, for example:: +You should then also define CSS styles with appropriate classes (tag-0 to tag-N, +where N matches ``TAG_CLOUD_STEPS`` -1), tag-0 being the most frequent, and +define a ``ul.tagcloud`` class with appropriate list-style to create the cloud. +For example:: ul.tagcloud { list-style: none; diff --git a/docs/themes.rst b/docs/themes.rst index ddf509f8..c5aafb46 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -30,12 +30,12 @@ To make your own theme, you must follow the following structure:: └── tags.html // must list all the tags. Can be a tag cloud. * `static` contains all the static assets, which will be copied to the output - `theme` folder. I've put the CSS and image folders here, but they are - just examples. Put what you need here. + `theme` folder. The above filesystem layout includes CSS and image folders, + but those are 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 - you keep things organized while creating your theme. + The template files listed above are mandatory; you can add your own templates + if it helps you keep things organized while creating your theme. Templates and variables ======================= @@ -44,8 +44,8 @@ The idea is to use a simple syntax that you can embed into your HTML pages. This document describes which templates should exist in a theme, and which variables will be passed to each template at generation time. -All templates will receive the variables defined in your settings file, if they -are in all-caps. You can access them directly. +All templates will receive the variables defined in your settings file, as long +as they are in all-caps. You can access them directly. Common variables ---------------- @@ -58,19 +58,18 @@ Variable Description output_file The name of the file currently being generated. For instance, when Pelican is rendering the homepage, output_file will be "index.html". -articles The list of articles, ordered descending by date +articles The list of articles, ordered descending by date. All the elements are `Article` objects, so you can access their attributes (e.g. title, summary, author etc.). Sometimes this is shadowed (for instance in the tags page). You will then find info about it in the `all_articles` variable. dates The same list of articles, but ordered by date, - ascending + ascending. tags A list of (tag, articles) tuples, containing all the tags. categories A list of (category, articles) tuples, containing - all the categories. - and the list of respective articles (values) + all the categories and corresponding articles (values) pages The list of pages ============= =================================================== @@ -91,9 +90,9 @@ __ http://jinja.pocoo.org/docs/templates/#sort Date Formatting --------------- -Pelican formats the date with according to your settings and locale +Pelican formats the date according to your settings and locale (``DATE_FORMATS``/``DEFAULT_DATE_FORMAT``) and provides a -``locale_date`` attribute. On the other hand, ``date`` attribute will +``locale_date`` attribute. On the other hand, the ``date`` attribute will be a `datetime`_ object. If you need custom formatting for a date different than your settings, use the Jinja filter ``strftime`` that comes with Pelican. Usage is same as Python `strftime`_ format, diff --git a/docs/tips.rst b/docs/tips.rst index 1864f0dd..7629481f 100644 --- a/docs/tips.rst +++ b/docs/tips.rst @@ -15,16 +15,16 @@ Project Pages and User Pages. Project Pages ------------- -To publish a Pelican site as Project Pages you need to *push* the content of +To publish a Pelican site as a Project Page you need to *push* the content of the ``output`` dir generated by Pelican to a repository's ``gh-pages`` branch on GitHub. The excellent `ghp-import `_, which can be installed with ``easy_install`` or ``pip``, makes this process really easy. -For example, if the sources of your Pelican site are contained in a GitHub -repository, and if you want to publish your Pelican site as Project Pages of -this repository, you can then use the following:: +For example, if the source of your Pelican site is contained in a GitHub +repository, and if you want to publish that Pelican site in the form of Project +Pages to this repository, you can then use the following:: $ pelican content -o output -s pelicanconf.py $ ghp-import output @@ -38,28 +38,28 @@ already exist). The ``git push origin gh-pages`` command updates the remote .. note:: The ``github`` target of the Makefile created by the ``pelican-quickstart`` - command publishes the Pelican site as Project Pages as described above. + command publishes the Pelican site as Project Pages, as described above. User Pages ---------- -To publish a Pelican site as User Pages you need to *push* the content of the -``output`` dir generated by Pelican to the ``master`` branch of your -``.github.com`` repository on GitHub. +To publish a Pelican site in the form of User Pages, you need to *push* the +content of the ``output`` dir generated by Pelican to the ``master`` branch of +your ``.github.io`` repository on GitHub. Again, you can take advantage of ``ghp-import``:: $ pelican content -o output -s pelicanconf.py $ ghp-import output - $ git push git@github.com:elemoine/elemoine.github.com.git gh-pages:master + $ git push git@github.com:elemoine/elemoine.github.io.git gh-pages:master The ``git push`` command pushes the local ``gh-pages`` branch (freshly updated -by the ``ghp-import`` command) to the ``elemoine.github.com`` repository's +by the ``ghp-import`` command) to the ``elemoine.github.io`` repository's ``master`` branch on GitHub. .. note:: - To publish your Pelican site as User Pages feel free to adjust the the + To publish your Pelican site as User Pages, feel free to adjust the ``github`` target of the Makefile. Extra Tips @@ -67,28 +67,30 @@ Extra Tips Tip #1: -To automatically update your Pelican site on each commit you can create +To automatically update your Pelican site on each commit, you can create a post-commit hook. For example, you can add the following to ``.git/hooks/post-commit``:: - pelican pelican content -o output -s pelicanconf.py && ghp-import output && git push origin gh-pages + pelican content -o output -s pelicanconf.py && ghp-import output && git push origin gh-pages Tip #2: To use a `custom domain `_ with -GitHub Pages you need to have a ``CNAME`` file at the root of your pages. For -that you will add ``CNAME`` file to your ``content``, dir and use the -``FILES_TO_COPY`` setting variable to tell Pelican to copy that file -to the ``output`` dir. For example:: +GitHub Pages, you need to put the domain of your site (e.g., +``blog.example.com``) inside a ``CNAME`` file at the root of your site. To do +this, create the ``content/extras/`` directory and add a ``CNAME`` file to it. +Then use the ``STATIC_PATHS`` setting to tell Pelican to copy this file to your +output directory. For example:: - FILES_TO_COPY = (('extra/CNAME', 'CNAME'),) + STATIC_PATHS = ['images', 'extra/CNAME'] + EXTRA_PATH_METADATA = {'extra/CNAME': {'path': 'CNAME'},} -How to add Youtube or Vimeo Videos +How to add YouTube or Vimeo Videos ================================== -The easiest way is to paste embed code of the video from these sites in your -markup file. +The easiest way is to paste the embed code of the video from these sites +directly into your source content. -Alternatively, you can also use Pelican plugins like ``liquid_tags`` or ``pelican_youtube`` -or ``pelican_vimeo`` to embed videos in your blog. +Alternatively, you can also use Pelican plugins like ``liquid_tags``, +``pelican_youtube``, or ``pelican_vimeo`` to embed videos in your content. From e5c0a54c57eb7d9cd718a382f66977ea8becf24a Mon Sep 17 00:00:00 2001 From: Honza Javorek Date: Tue, 24 Sep 2013 14:19:47 +0200 Subject: [PATCH 32/46] Removed obsolete comment. --- pelican/contents.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index b453f61b..1858013c 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -197,10 +197,6 @@ class Content(object): value = m.group('value') origin = m.group('path') - # we support only filename for now. the plan is to support - # categories, tags, etc. in the future, but let's keep things - # simple for now. - # XXX Put this in a different location. if what == 'filename': if value.startswith('/'): From 7d43c4fa00fa31c9ef445a5f923255da870bf650 Mon Sep 17 00:00:00 2001 From: Honza Javorek Date: Tue, 24 Sep 2013 15:18:09 +0200 Subject: [PATCH 33/46] Support for params and fragments in intrasite links. Adresses #1063. --- pelican/contents.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index 1858013c..83fbad8f 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -5,6 +5,7 @@ import six import copy import locale import logging +import urlparse import functools import os import re @@ -194,30 +195,36 @@ class Content(object): def replacer(m): what = m.group('what') - value = m.group('value') + value = urlparse.urlparse(m.group('value')) + path = value.path origin = m.group('path') # XXX Put this in a different location. if what == 'filename': - if value.startswith('/'): - value = value[1:] + if path.startswith('/'): + path = path[1:] else: # relative to the source path of this content - value = self.get_relative_source_path( - os.path.join(self.relative_dir, value) + path = self.get_relative_source_path( + os.path.join(self.relative_dir, path) ) - if value in self._context['filenames']: + if path in self._context['filenames']: origin = '/'.join((siteurl, - self._context['filenames'][value].url)) - origin = origin.replace('\\', '/') # Fow windows paths. + self._context['filenames'][path].url)) + origin = origin.replace('\\', '/') # for Windows paths. else: logger.warning("Unable to find {fn}, skipping url" - " replacement".format(fn=value)) + " replacement".format(fn=path)) elif what == 'category': - origin = Category(value, self.settings).url + origin = Category(path, self.settings).url elif what == 'tag': - origin = Tag(value, self.settings).url + origin = Tag(path, self.settings).url + + # keep all other parts, such as query, fragment, etc. + parts = list(value) + parts[2] = origin + origin = urlparse.urlunparse(parts) return ''.join((m.group('markup'), m.group('quote'), origin, m.group('quote'))) From 5f23aab8072bb28631043e6c0f8585fde6c2dd93 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 24 Sep 2013 21:28:59 +0200 Subject: [PATCH 34/46] Change Bumpr test from tox to unittest There are currently some minor problems when running tox that are not present when running "python -m unittest discover". Once those problems have been resolved, we should probably change this setting back to tox. --- bumpr.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bumpr.rc b/bumpr.rc index cfc90fd7..fd35b042 100644 --- a/bumpr.rc +++ b/bumpr.rc @@ -4,7 +4,7 @@ vcs = git clean = python setup.py clean rm -rf *egg-info build dist -tests = tox +tests = python -m unittest discover publish = python setup.py sdist register upload files = README.rst From 2f57b86560f93037ead2466016cdd5e358cae872 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 24 Sep 2013 21:37:53 +0200 Subject: [PATCH 35/46] Modify sed command in bumpr.rc to support BSD It appears that BSD sed, unlike Linux, has a requirement that you provide an extension to the -i option. So, while Linux allows: sed -i "sed-command" ... to edit in-place, the BSD variant needs to have: sed -i "" "sed-command" i.e., with an empty backup suffix. --- bumpr.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bumpr.rc b/bumpr.rc index fd35b042..969fdb24 100644 --- a/bumpr.rc +++ b/bumpr.rc @@ -27,4 +27,4 @@ prepare = Next release url = http://docs.getpelican.com/{tag} [commands] -bump = sed -i "s/last_stable\s*=.*/last_stable = '{version}'/" docs/conf.py +bump = sed -i "" "s/last_stable\s*=.*/last_stable = '{version}'/" docs/conf.py From b35ce43b7fc2cb96d6534dd0392bb41d2de1d933 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 24 Sep 2013 21:57:07 +0200 Subject: [PATCH 36/46] Bump version 3.3.0 --- README.rst | 2 +- docs/changelog.rst | 4 ++-- pelican/__init__.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 20c3f217..278f3a44 100644 --- a/README.rst +++ b/README.rst @@ -61,7 +61,7 @@ client handy, use the webchat_ for quick feedback. .. _reStructuredText: http://docutils.sourceforge.net/rst.html .. _Markdown: http://daringfireball.net/projects/markdown/ .. _Jinja2: http://jinja.pocoo.org/ -.. _`Pelican documentation`: http://docs.getpelican.com/latest/ +.. _`Pelican documentation`: http://docs.getpelican.com/3.3.0/ .. _`Pelican's internals`: http://docs.getpelican.com/en/latest/internals.html .. _`#pelican on Freenode`: irc://irc.freenode.net/pelican .. _webchat: http://webchat.freenode.net/?channels=pelican&uio=d4 diff --git a/docs/changelog.rst b/docs/changelog.rst index ebf84f34..a5f0c1f3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,8 +1,8 @@ Release history ############### -Next release -============ +3.3.0 (2013-09-24) +================== * Drop Python 3.2 support in favor of Python 3.3 * Add ``Fabfile`` so Fabric can be used for workflow automation instead of Make diff --git a/pelican/__init__.py b/pelican/__init__.py index cecab54b..9daeed76 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -22,7 +22,7 @@ from pelican.settings import read_settings from pelican.utils import clean_output_dir, folder_watcher, file_watcher from pelican.writers import Writer -__version__ = "3.2.3.dev" +__version__ = "3.3.0" DEFAULT_CONFIG_NAME = 'pelicanconf.py' From 2c468f091a587257f3d455f5727fa4c05cbbca87 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 24 Sep 2013 21:57:28 +0200 Subject: [PATCH 37/46] Prepare version 3.3.1.dev for next development cycle --- README.rst | 2 +- docs/changelog.rst | 5 +++++ pelican/__init__.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 278f3a44..20c3f217 100644 --- a/README.rst +++ b/README.rst @@ -61,7 +61,7 @@ client handy, use the webchat_ for quick feedback. .. _reStructuredText: http://docutils.sourceforge.net/rst.html .. _Markdown: http://daringfireball.net/projects/markdown/ .. _Jinja2: http://jinja.pocoo.org/ -.. _`Pelican documentation`: http://docs.getpelican.com/3.3.0/ +.. _`Pelican documentation`: http://docs.getpelican.com/latest/ .. _`Pelican's internals`: http://docs.getpelican.com/en/latest/internals.html .. _`#pelican on Freenode`: irc://irc.freenode.net/pelican .. _webchat: http://webchat.freenode.net/?channels=pelican&uio=d4 diff --git a/docs/changelog.rst b/docs/changelog.rst index a5f0c1f3..54b0d871 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,11 @@ Release history ############### +Next release +============ + +- Nothing yet + 3.3.0 (2013-09-24) ================== diff --git a/pelican/__init__.py b/pelican/__init__.py index 9daeed76..b3ffe21a 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -22,7 +22,7 @@ from pelican.settings import read_settings from pelican.utils import clean_output_dir, folder_watcher, file_watcher from pelican.writers import Writer -__version__ = "3.3.0" +__version__ = "3.3.1.dev" DEFAULT_CONFIG_NAME = 'pelicanconf.py' From 6fb0335269e9d9dbd79c2f4cb020cd9a6b03313a Mon Sep 17 00:00:00 2001 From: Honza Javorek Date: Wed, 25 Sep 2013 11:39:29 +0200 Subject: [PATCH 38/46] Attempt to be compilant with Python 3. --- pelican/contents.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index 83fbad8f..dbc33716 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -5,12 +5,16 @@ import six import copy import locale import logging -import urlparse import functools import os import re import sys +try: + from urlparse import urlparse, urlunparse +except ImportError: + from urllib.parse import urlparse, urlunparse + from datetime import datetime @@ -195,7 +199,7 @@ class Content(object): def replacer(m): what = m.group('what') - value = urlparse.urlparse(m.group('value')) + value = urlparse(m.group('value')) path = value.path origin = m.group('path') @@ -224,7 +228,7 @@ class Content(object): # keep all other parts, such as query, fragment, etc. parts = list(value) parts[2] = origin - origin = urlparse.urlunparse(parts) + origin = urlunparse(parts) return ''.join((m.group('markup'), m.group('quote'), origin, m.group('quote'))) From 7415d370e6a9c6f9b96da927685ffe9a6bc6eada Mon Sep 17 00:00:00 2001 From: Honza Javorek Date: Wed, 25 Sep 2013 16:13:28 +0200 Subject: [PATCH 39/46] Added tests. --- pelican/tests/test_contents.py | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py index 936903c1..2e44253a 100644 --- a/pelican/tests/test_contents.py +++ b/pelican/tests/test_contents.py @@ -204,6 +204,66 @@ class TestPage(unittest.TestCase): ('A simple test, with a ' 'link')) + def test_intrasite_link(self): + article = type(b'_DummyArticle', (object,), {'url': 'article.html'}) + + args = self.page_kwargs.copy() + args['settings'] = get_settings() + args['source_path'] = 'content' + args['context']['filenames'] = {'article.rst': article} + + # Classic intrasite link via filename + args['content'] = ( + 'A simple test, with a ' + 'link' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEquals( + content, + 'A simple test, with a ' + 'link' + ) + + # fragment + args['content'] = ( + 'A simple test, with a ' + 'link' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEquals( + content, + 'A simple test, with a ' + 'link' + ) + + # query + args['content'] = ( + 'A simple test, with a ' + 'link' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEquals( + content, + 'A simple test, with a ' + 'link' + ) + + # combination + args['content'] = ( + 'A simple test, with a ' + 'link' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEquals( + content, + 'A simple test, with a ' + 'link' + ) + class TestArticle(TestPage): def test_template(self): From 6ed23fec7dc1c907b9dcc3eb3d08eca61c1bb9b5 Mon Sep 17 00:00:00 2001 From: Honza Javorek Date: Wed, 25 Sep 2013 16:31:23 +0200 Subject: [PATCH 40/46] Tuned the tests so they are PY3 compilant. --- pelican/tests/test_contents.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py index 2e44253a..437d0228 100644 --- a/pelican/tests/test_contents.py +++ b/pelican/tests/test_contents.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +import six from datetime import datetime from sys import platform @@ -205,7 +206,10 @@ class TestPage(unittest.TestCase): 'link')) def test_intrasite_link(self): - article = type(b'_DummyArticle', (object,), {'url': 'article.html'}) + # type does not take unicode in PY2 and bytes in PY3, which in + # combination with unicode literals leads to following insane line: + cls_name = '_DummyArticle' if six.PY3 else b'_DummyArticle' + article = type(cls_name, (object,), {'url': 'article.html'}) args = self.page_kwargs.copy() args['settings'] = get_settings() From a49b744e951a810040baca27ff04fda23f973e26 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Thu, 26 Sep 2013 00:37:35 +0200 Subject: [PATCH 41/46] Fix tests with latest versions of smartypants. smartypants is now py3 compatible but the default settings for double quotes has been changed (http://pythonhosted.org/smartypants/changes.html). This commit: - update the typogrify test (change quotes, and add more test casesi: caps word, ellipsis) - install typogrify on travis - uses upstream version of smartypants in tox instead of dmdm's fork for py3 --- .travis.yml | 2 ++ pelican/tests/content/article.rst | 2 +- pelican/tests/test_readers.py | 13 +++++++------ tox.ini | 1 - 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1df32baa..62373e68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,8 @@ before_install: - sudo locale-gen fr_FR.UTF-8 tr_TR.UTF-8 install: - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then ln -s /usr/share/asciidoc/asciidocapi.py ~/virtualenv/python2.7/lib/python2.7/site-packages/; fi + - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install typogrify ; fi + - if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then pip install git+https://github.com/dmdm/typogrify.git@py3k#egg=typogrify; fi - pip install mock nose nose-cov Markdown - pip install . script: nosetests -sv --with-coverage --cover-package=pelican pelican diff --git a/pelican/tests/content/article.rst b/pelican/tests/content/article.rst index 7109c29b..793e6869 100644 --- a/pelican/tests/content/article.rst +++ b/pelican/tests/content/article.rst @@ -1,6 +1,6 @@ Article title ############# -This is some content. With some stuff to "typogrify". +THIS is some content. With some stuff to "typogrify"... Now with added support for :abbr:`TLA (three letter acronym)`. diff --git a/pelican/tests/test_readers.py b/pelican/tests/test_readers.py index b6652d03..841e3d34 100644 --- a/pelican/tests/test_readers.py +++ b/pelican/tests/test_readers.py @@ -104,8 +104,8 @@ class RstReaderTest(ReaderTest): # if nothing is specified in the settings, the content should be # unmodified page = self.read_file(path='article.rst') - expected = ('

This is some content. With some stuff to ' - '"typogrify".

\n

Now with added ' + expected = ('

THIS is some content. With some stuff to ' + '"typogrify"...

\n

Now with added ' 'support for ' 'TLA.

\n') @@ -114,10 +114,11 @@ class RstReaderTest(ReaderTest): try: # otherwise, typogrify should be applied page = self.read_file(path='article.rst', TYPOGRIFY=True) - expected = ('

This is some content. With some stuff to ' - '“typogrify”.

\n

Now with added ' - 'support for ' - 'TLA.

\n') + expected = ( + '

THIS is some content. ' + 'With some stuff to "typogrify"…

\n' + '

Now with added support for TLA.

\n') self.assertEqual(page.content, expected) except ImportError: diff --git a/tox.ini b/tox.ini index 8763c963..440216cf 100644 --- a/tox.ini +++ b/tox.ini @@ -22,6 +22,5 @@ deps = mock Markdown BeautifulSoup4 - git+https://github.com/dmdm/smartypants.git#egg=smartypants git+https://github.com/dmdm/typogrify.git@py3k#egg=typogrify lxml From cb82e486369479432624b293aa1176f11c11f074 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Fri, 4 Oct 2013 16:23:19 +0200 Subject: [PATCH 42/46] None, not False, in *_SAVE_AS docs. Fixes #1106. --- docs/settings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index b6c18fa9..82752436 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -278,7 +278,7 @@ Setting name (default value) What does it do? If you do not want one or more of the default pages to be created (e.g., you are the only author on your site and thus do not need an Authors page), - set the corresponding ``*_SAVE_AS`` setting to ``False`` to prevent the + set the corresponding ``*_SAVE_AS`` setting to ``None`` to prevent the relevant page from being generated. Timezone From 9657071301ffb7029d17a675f9544e7ec458b202 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 6 Oct 2013 15:30:14 +0200 Subject: [PATCH 43/46] Python 3.3 got mock --- pelican/tests/test_generators.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pelican/tests/test_generators.py b/pelican/tests/test_generators.py index f47ce7d3..e821bb86 100644 --- a/pelican/tests/test_generators.py +++ b/pelican/tests/test_generators.py @@ -3,7 +3,10 @@ from __future__ import unicode_literals import os from codecs import open -from mock import MagicMock +try: + from unittest.mock import MagicMock +except ImportError: + from mock import MagicMock from shutil import rmtree from tempfile import mkdtemp From 67d3ab8883ba072cc10da214db25dceedb0000a1 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 6 Oct 2013 16:15:43 +0200 Subject: [PATCH 44/46] assertEquals is deprecated in favor of assertEqual --- pelican/tests/test_contents.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py index 437d0228..9c894ffc 100644 --- a/pelican/tests/test_contents.py +++ b/pelican/tests/test_contents.py @@ -193,17 +193,17 @@ class TestPage(unittest.TestCase): 'link') page = Page(**args) content = page.get_content('http://notmyidea.org') - self.assertEquals(content, ('A simple test, with a ' - 'link')) + self.assertEqual(content, ('A simple test, with a ' + 'link')) # Category args['content'] = ('A simple test, with a ' 'link') page = Page(**args) content = page.get_content('http://notmyidea.org') - self.assertEquals(content, - ('A simple test, with a ' - 'link')) + self.assertEqual(content, + ('A simple test, with a ' + 'link')) def test_intrasite_link(self): # type does not take unicode in PY2 and bytes in PY3, which in @@ -222,7 +222,7 @@ class TestPage(unittest.TestCase): 'link' ) content = Page(**args).get_content('http://notmyidea.org') - self.assertEquals( + self.assertEqual( content, 'A simple test, with a ' 'link' @@ -234,7 +234,7 @@ class TestPage(unittest.TestCase): 'link' ) content = Page(**args).get_content('http://notmyidea.org') - self.assertEquals( + self.assertEqual( content, 'A simple test, with a ' 'link' @@ -247,7 +247,7 @@ class TestPage(unittest.TestCase): '?utm_whatever=234&highlight=word">link' ) content = Page(**args).get_content('http://notmyidea.org') - self.assertEquals( + self.assertEqual( content, 'A simple test, with a ' 'link' ) content = Page(**args).get_content('http://notmyidea.org') - self.assertEquals( + self.assertEqual( content, 'A simple test, with a ' ' Date: Tue, 8 Oct 2013 13:20:56 +0200 Subject: [PATCH 46/46] Add Tumblr and Posterous to importer description --- pelican/tools/pelican_import.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 8cc5b083..69e1f1b4 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -98,7 +98,7 @@ def decode_wp_content(content, br=True): def wp2fields(xml): - """Opens a wordpress XML file, and yield pelican fields""" + """Opens a wordpress XML file, and yield Pelican fields""" try: from bs4 import BeautifulSoup except ImportError: @@ -551,8 +551,9 @@ def fields2pelican(fields, out_markup, output_path, def main(): parser = argparse.ArgumentParser( - description="Transform feed, Wordpress or Dotclear files to reST (rst) " - "or Markdown (md) files. Be sure to have pandoc installed.", + description="Transform feed, WordPress, Tumblr, Dotclear, or Posterous " + "files into reST (rst) or Markdown (md) files. Be sure to " + "have pandoc installed.", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument(dest='input', help='The input file to read')