Convert FEED settings from %s to {slug} redux (#2432)

* Convert FEED settings from `%s` to `{slug}` redux

Closes #2106, Closes #2383
This commit is contained in:
MinchinWeb 2018-11-03 09:12:20 -06:00 committed by Justin Mayer
commit 3a0add4b6e
10 changed files with 165 additions and 102 deletions

View file

@ -4,6 +4,9 @@ Release history
Next release
============
* All settings for slugs now use ``{slug}`` and/or ``{lang}`` rather than
``%s``. If ``%s``-style settings are encountered, Pelican will emit a warning
and fallback to the default setting.
* New signal: ``feed_generated``
* Replace Fabric by Invoke and ``fabfile.py`` template by ``tasks.py``.
* Replace ``SLUG_SUBSTITUTIONS`` (and friends) by ``SLUG_REGEX_SUBSTITUTIONS``

View file

@ -60,7 +60,7 @@ which you map the signals to your plugin logic. Let's take a simple example::
from pelican import signals
def test(sender):
print "%s initialized !!" % sender
print("{} initialized !!".format(sender))
def register():
signals.initialized.connect(test)

View file

@ -879,59 +879,61 @@ the ``TAG_FEED_ATOM`` and ``TAG_FEED_RSS`` settings:
Relative URL of the all-posts RSS feed. If not set, ``FEED_ALL_RSS`` is used
both for save location and URL.
.. data:: CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
.. data:: CATEGORY_FEED_ATOM = 'feeds/{slug}.atom.xml'
The location to save the category Atom feeds. [2]_
.. data:: CATEGORY_FEED_ATOM_URL = None
Relative URL of the category Atom feeds, including the ``%s`` placeholder.
[2]_ If not set, ``CATEGORY_FEED_ATOM`` is used both for save location and
URL.
Relative URL of the category Atom feeds, including the ``{slug}``
placeholder. [2]_ If not set, ``CATEGORY_FEED_ATOM`` is used both for save
location and URL.
.. data:: CATEGORY_FEED_RSS = None, i.e. no RSS
The location to save the category RSS feeds, including the ``%s``
The location to save the category RSS feeds, including the ``{slug}``
placeholder. [2]_
.. data:: CATEGORY_FEED_RSS_URL = None
Relative URL of the category RSS feeds, including the ``%s`` placeholder.
[2]_ If not set, ``CATEGORY_FEED_RSS`` is used both for save location and
URL.
Relative URL of the category RSS feeds, including the ``{slug}``
placeholder. [2]_ If not set, ``CATEGORY_FEED_RSS`` is used both for save
location and URL.
.. data:: AUTHOR_FEED_ATOM = 'feeds/%s.atom.xml'
.. data:: AUTHOR_FEED_ATOM = 'feeds/{slug}.atom.xml'
The location to save the author Atom feeds. [2]_
.. data:: AUTHOR_FEED_ATOM_URL = None
Relative URL of the author Atom feeds, including the ``%s`` placeholder.
Relative URL of the author Atom feeds, including the ``{slug}`` placeholder.
[2]_ If not set, ``AUTHOR_FEED_ATOM`` is used both for save location and
URL.
.. data:: AUTHOR_FEED_RSS = 'feeds/%s.rss.xml'
.. data:: AUTHOR_FEED_RSS = 'feeds/{slug}.rss.xml'
The location to save the author RSS feeds. [2]_
.. data:: AUTHOR_FEED_RSS_URL = None
Relative URL of the author RSS feeds, including the ``%s`` placeholder. [2]_
If not set, ``AUTHOR_FEED_RSS`` is used both for save location and URL.
Relative URL of the author RSS feeds, including the ``{slug}`` placeholder.
[2]_ If not set, ``AUTHOR_FEED_RSS`` is used both for save location and URL.
.. data:: TAG_FEED_ATOM = None, i.e. no tag feed
The location to save the tag Atom feed, including the ``%s`` placeholder.
[2]_
The location to save the tag Atom feed, including the ``{slug}``
placeholder. [2]_
.. data:: TAG_FEED_ATOM_URL = None
Relative URL of the tag Atom feed, including the ``%s`` placeholder. [2]_
Relative URL of the tag Atom feed, including the ``{slug}`` placeholder.
[2]_
.. data:: TAG_FEED_RSS = None, i.e. no RSS tag feed
Relative URL to output the tag RSS feed, including the ``%s`` placeholder.
If not set, ``TAG_FEED_RSS`` is used both for save location and URL.
Relative URL to output the tag RSS feed, including the ``{slug}``
placeholder. If not set, ``TAG_FEED_RSS`` is used both for save location and
URL.
.. data:: FEED_MAX_ITEMS
@ -946,7 +948,7 @@ the ``TAG_FEED_ATOM`` and ``TAG_FEED_RSS`` settings:
If you don't want to generate some or any of these feeds, set the above variables to ``None``.
.. [2] ``%s`` is replaced by name of the category / author / tag.
.. [2] ``{slug}`` is replaced by name of the category / author / tag.
FeedBurner
@ -1050,13 +1052,13 @@ more information.
of one another. May be a string or a collection of strings. Set to ``None``
or ``False`` to disable the identification of translations.
.. data:: TRANSLATION_FEED_ATOM = 'feeds/all-%s.atom.xml'
.. data:: TRANSLATION_FEED_ATOM = 'feeds/all-{lang}.atom.xml'
The location to save the Atom feed for translations. [3]_
.. data:: TRANSLATION_FEED_ATOM_URL = None
Relative URL of the Atom feed for translations, including the ``%s``
Relative URL of the Atom feed for translations, including the ``{lang}``
placeholder. [3]_ If not set, ``TRANSLATION_FEED_ATOM`` is used both for
save location and URL.
@ -1066,11 +1068,11 @@ more information.
.. data:: TRANSLATION_FEED_RSS_URL = None
Relative URL of the RSS feed for translations, including the ``%s``
Relative URL of the RSS feed for translations, including the ``{lang}``
placeholder. [3]_ If not set, ``TRANSLATION_FEED_RSS`` is used both for save
location and URL.
.. [3] %s is the language
.. [3] {lang} is the language code
Ordering content