From 9d583961e700667b7f1e78c4f2e0c88954becf15 Mon Sep 17 00:00:00 2001 From: bmcorser Date: Wed, 21 Aug 2013 19:57:55 +0100 Subject: [PATCH 01/11] 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 d22b0892418b60b752551ebc95c4616926bb513f Mon Sep 17 00:00:00 2001 From: bmcorser Date: Sat, 24 Aug 2013 13:41:22 +0100 Subject: [PATCH 02/11] 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 03/11] 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 04/11] 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 ef16c915d4dfec668788bcff367a860214d01e55 Mon Sep 17 00:00:00 2001 From: bmcorser Date: Sat, 31 Aug 2013 21:48:19 +0100 Subject: [PATCH 05/11] 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 06/11] 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 07/11] 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 08/11] 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 3d419bf55dc03ed61327d94f7aa585ddfeee0e3e Mon Sep 17 00:00:00 2001 From: Talha Mansoor Date: Mon, 9 Sep 2013 10:28:47 +0500 Subject: [PATCH 09/11] Update changelog.rst 1. Escape `|tag|` and `|category|` with double ticks otherwise reST converts them to links that are invalid. 2. Updated syntax for relative links use braces instead of bars. --- docs/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index bbe0e76c..064c8fd2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -10,7 +10,7 @@ Next release * Deprecate ``FILES_TO_COPY`` in favor of ``STATIC_PATHS`` and ``EXTRA_PATH_METADATA`` * Add support for ``{}`` in relative links syntax, besides ``||`` -* Add support for |tag| and |category| relative links +* Add support for ``{tag}`` and ``{category}`` relative links 3.2.1 and 3.2.2 =============== From e03cf3f51735d5387fee7064cae89aaa1d34a0a6 Mon Sep 17 00:00:00 2001 From: bmcorser Date: Sat, 14 Sep 2013 16:18:53 +0100 Subject: [PATCH 10/11] Fix `utils.copy` behaviour Previously, the copy util failed if only a directory containing only files was specified in THEME_STATIC_PATHS --- pelican/tests/test_pelican.py | 15 +++++++++++++++ pelican/utils.py | 3 +++ 2 files changed, 18 insertions(+) diff --git a/pelican/tests/test_pelican.py b/pelican/tests/test_pelican.py index e829e1a5..8cccc918 100644 --- a/pelican/tests/test_pelican.py +++ b/pelican/tests/test_pelican.py @@ -112,3 +112,18 @@ class TestPelican(LoggedTestCase): for file in ['wow!', 'boom!', 'bap!', 'zap!']: self.assertTrue(os.path.exists(os.path.join(extra_path, file))) + + def test_theme_static_paths_copy_single_file(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, 'theme_standard')] + }) + + pelican = Pelican(settings=settings) + mute(True)(pelican.run)() + theme_output = os.path.join(self.temp_path, 'theme') + + for file in ['a_stylesheet', 'a_template']: + self.assertTrue(os.path.exists(os.path.join(theme_output, file))) diff --git a/pelican/utils.py b/pelican/utils.py index d306de65..f222f63c 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -273,6 +273,9 @@ def copy(path, source, destination, destination_path=None): destination_ = os.path.abspath( os.path.expanduser(os.path.join(destination, destination_path))) + if not os.path.exists(destination_): + os.makedirs(destination_) + def recurse(source, destination): for entry in os.listdir(source): entry_path = os.path.join(source, entry) From 3580233b385f05d7eaee258ed9cff451d528ead9 Mon Sep 17 00:00:00 2001 From: SDGSDG Date: Sun, 15 Sep 2013 22:43:24 -0700 Subject: [PATCH 11/11] Support for pygment defaults and relevant documentation --- docs/getting_started.rst | 62 +++++++++++++++++++ docs/settings.rst | 3 + pelican/rstdirectives.py | 14 ++++- pelican/settings.py | 12 +++- pelican/tests/output/basic/category/misc.html | 10 +-- .../tests/output/basic/feeds/all-en.atom.xml | 16 ++++- pelican/tests/output/basic/feeds/all.atom.xml | 16 ++++- .../tests/output/basic/feeds/misc.atom.xml | 16 ++++- pelican/tests/output/basic/index.html | 10 +-- pelican/tests/output/basic/unbelievable.html | 16 ++++- .../custom/author/alexis-metaireau3.html | 10 +-- .../tests/output/custom/category/misc.html | 10 +-- .../tests/output/custom/feeds/all-en.atom.xml | 14 +++++ .../tests/output/custom/feeds/all.atom.xml | 14 +++++ pelican/tests/output/custom/feeds/all.rss.xml | 14 +++++ .../tests/output/custom/feeds/misc.atom.xml | 14 +++++ .../tests/output/custom/feeds/misc.rss.xml | 14 +++++ pelican/tests/output/custom/index3.html | 10 +-- pelican/tests/output/custom/unbelievable.html | 14 +++++ samples/content/unbelievable.rst | 29 ++++++++- samples/pelican.conf.py | 3 + 21 files changed, 288 insertions(+), 33 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index d7a36080..2605c3a1 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -533,6 +533,9 @@ which posts are translations:: That's true, foobar is still alive! + +.. _internal_pygments_options: + Syntax highlighting ------------------- @@ -556,6 +559,65 @@ indenting both the identifier and code:: The specified identifier (e.g. ``python``, ``ruby``) should be one that appears on the `list of available lexers `_. +When using reStructuredText the following options are available in the +code-block directive: + +============= ============ ========================================= +Option Valid values Description +============= ============ ========================================= +anchorlinenos N/A If present wrap line numbers in tags. +classprefix string String to prepend to token class names +hl_lines numbers List of lines to be highlighted. +lineanchors string Wrap each line in an anchor using this + string and -linenumber. +linenos string If present or set to "table" output line + numbers in a table, if set to + "inline" output them inline. "none" means + do not output the line numbers for this + table. +linenospecial number If set every nth line will be given the + 'special' css class. +linenostart number Line number for the first line. +linenostep number Print every nth line number. +lineseparator string String to print between lines of code, + '\n' by default. +linespans string Wrap each line in a span using this and + -linenumber. +nobackground N/A If set do not output background color for + the wrapping element +nowrap N/A If set do not wrap the tokens at all. +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 +details on each of the options. + +for example the below 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:: + + .. code-block:: identifier + :classprefix: pgcss + :linenos: table + :linenostart: 153 + + + +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. + +For example, if you wanted to have line numbers on for every code block +and a CSS prefix you would set this variable to:: + + PYGMENTS_RST_OPTIONS = { 'classprefix': 'pgcss', 'linenos': 'table'} + +If specified, settings for individual code blocks will override the +defaults in the configuration file. + Publishing drafts ----------------- diff --git a/docs/settings.rst b/docs/settings.rst index 70341a3f..e8965731 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -161,6 +161,9 @@ Setting name (default value) What doe 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`. +`PYGMENTS_RST_OPTIONS` (``[]``) A list of default Pygments settings for your reStructuredText + code blocks. See :ref:`internal_pygments_options` for a list of + supported options. ===================================================================== ===================================================================== .. [#] Default is the system locale. diff --git a/pelican/rstdirectives.py b/pelican/rstdirectives.py index 33ed2f03..1bf6971c 100644 --- a/pelican/rstdirectives.py +++ b/pelican/rstdirectives.py @@ -7,6 +7,8 @@ from pygments.formatters import HtmlFormatter from pygments import highlight from pygments.lexers import get_lexer_by_name, TextLexer import re +import six +import pelican.settings as pys class Pygments(Directive): @@ -41,9 +43,19 @@ class Pygments(Directive): # no lexer found - use the text one instead of an exception lexer = TextLexer() + # Fetch the defaults + if pys.PYGMENTS_RST_OPTIONS is not None: + for k, v in six.iteritems(pys.PYGMENTS_RST_OPTIONS): + # Locally set options overrides the defaults + if k not in self.options: + self.options[k] = v + if ('linenos' in self.options and self.options['linenos'] not in ('table', 'inline')): - self.options['linenos'] = 'table' + if self.options['linenos'] == 'none': + self.options.pop('linenos') + else: + self.options['linenos'] = 'table' for flag in ('nowrap', 'nobackground', 'anchorlinenos'): if flag in self.options: diff --git a/pelican/settings.py b/pelican/settings.py index 1c2db677..99828935 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -107,12 +107,15 @@ DEFAULT_CONFIG = { 'SUMMARY_MAX_LENGTH': 50, 'PLUGIN_PATH': '', 'PLUGINS': [], + 'PYGMENTS_RST_OPTIONS': {}, 'TEMPLATE_PAGES': {}, 'IGNORE_FILES': ['.#*'], 'SLUG_SUBSTITUTIONS': (), 'INTRASITE_LINK_REGEX': '[{|](?P.*?)[|}]', } +PYGMENTS_RST_OPTIONS = None + def read_settings(path=None, override=None): if path: @@ -131,7 +134,14 @@ def read_settings(path=None, override=None): if override: local_settings.update(override) - return configure_settings(local_settings) + parsed_settings = configure_settings(local_settings) + # This is because there doesn't seem to be a way to pass extra + # parameters to docutils directive handlers, so we have to have a + # variable here that we'll import from within Pygments.run (see + # rstdirectives.py) to see what the user defaults were. + global PYGMENTS_RST_OPTIONS + PYGMENTS_RST_OPTIONS = parsed_settings.get('PYGMENTS_RST_OPTIONS', None) + return parsed_settings def get_settings_from_module(module=None, default_settings=DEFAULT_CONFIG): diff --git a/pelican/tests/output/basic/category/misc.html b/pelican/tests/output/basic/category/misc.html index e0dfd4e4..5b8af887 100644 --- a/pelican/tests/output/basic/category/misc.html +++ b/pelican/tests/output/basic/category/misc.html @@ -86,11 +86,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 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"