From: Vladimír Vondruš Date: Tue, 24 Oct 2017 12:30:44 +0000 (+0200) Subject: plugins: prefix config options by plugin name. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=95c568eb5220e4559b8cc4d40b1d143cec6d40a0;p=blog.git plugins: prefix config options by plugin name. So it's clear what is what. --- diff --git a/doc/plugins/htmlsanity.rst b/doc/plugins/htmlsanity.rst index 79314ef1..09d142bb 100644 --- a/doc/plugins/htmlsanity.rst +++ b/doc/plugins/htmlsanity.rst @@ -49,8 +49,8 @@ including the ``m/`` directory into one of your :py:`PLUGIN_PATHS` and add .. code:: python PLUGINS += ['m.htmlsanity'] - HTMLSANITY_SMART_QUOTES = True - HTMLSANITY_HYPHENATION = True + M_HTMLSANITY_SMART_QUOTES = True + M_HTMLSANITY_HYPHENATION = True `What it does`_ =============== @@ -130,7 +130,7 @@ on top. See for yourself: The default language is of course taken from the standard :py:`DEFAULT_LANG` option, which defaults to :py:`'en'`. This feature is controlled by the -:py:`HTMLSANITY_SMART_QUOTES` option, which, similarly to the builtin +:py:`M_HTMLSANITY_SMART_QUOTES` option, which, similarly to the builtin :py:`TYPOGRIFY` option, defaults to :py:`False`. .. note-warning:: @@ -200,7 +200,7 @@ that are candidates for a word break: Thanks to Unicode magic this is either hidden or converted to a real hyphen and *doesn't* break search or SEO. This feature is controlled by the -:py:`HTMLSANITY_HYPHENATION` option, which also defaults to :py:`False`. +:py:`M_HTMLSANITY_HYPHENATION` option, which also defaults to :py:`False`. .. note-success:: @@ -229,8 +229,8 @@ settings). Just pipe your variable through the ``render_rst`` filter: The filter is fully equivalent to the builtin reST rendering and the above -:py:`HTMLSANITY_SMART_QUOTES` and :py:`HTMLSANITY_HYPHENATION` options affect -it as well. +:py:`M_HTMLSANITY_SMART_QUOTES` and :py:`M_HTMLSANITY_HYPHENATION` options +affect it as well. .. note-warning:: @@ -292,7 +292,7 @@ items), use the ``hyphenate`` filter: -The hyphenation is by default controlled by the :py:`HTMLSANITY_HYPHENATION` +The hyphenation is by default controlled by the :py:`M_HTMLSANITY_HYPHENATION` option. If you want to control this separately, pass a boolean variable or simply :py:`True` to the filter ``enable`` argument. The language is by default taken from the standard :py:`DEFAULT_LANG` option, if you want to override it, diff --git a/doc/plugins/links.rst b/doc/plugins/links.rst index 42dcff2a..5711cb7c 100644 --- a/doc/plugins/links.rst +++ b/doc/plugins/links.rst @@ -137,20 +137,20 @@ including the ``m/`` directory into one of your :py:`PLUGIN_PATHS` and add :py:`m.dox` package to your plugins in ``pelicanconf.py``. The plugin uses Doxygen tag files to get a list of linkable symbols and you need to provide list of 3-tuples containing tag file path, URL prefix and list of implicitly -prepended namespaces in :py:`DOXYGEN_TAGFILES` configuration to make the plugin +prepended namespaces in :py:`M_DOX_TAGFILES` configuration to make the plugin work. Example configuration: .. code:: python PLUGINS += ['m.dox'] - DOXYGEN_TAGFILES = [ + M_DOX_TAGFILES = [ ('doxygen/corrade.tag', 'http://doc.magnum.graphics/corrade/', ['Corrade::']), ('doxygen/magnum.tag', 'http://doc.magnum.graphics/magnum/', ['Magnum::'])] Use the :rst:`:dox:` interpreted text role for linking to documented symbols. All link targets understood by Doxygen's ``@ref`` or ``@link`` commands are understood by this plugin as well. In order to save you some typing, the -leading namespace(s) mentioned in the :py:`DOXYGEN_TAGFILES` setting can be +leading namespace(s) mentioned in the :py:`M_DOX_TAGFILES` setting can be omitted when linking to given symbol. If a symbol can't be found, a warning is printed to output and the link text is rendered in monospace font. diff --git a/pelican-plugins/m/dox.py b/pelican-plugins/m/dox.py index 7165972b..ecc9a5ea 100644 --- a/pelican-plugins/m/dox.py +++ b/pelican-plugins/m/dox.py @@ -39,7 +39,7 @@ symbol_prefixes = [''] def init(pelicanobj): global symbol_mapping, symbol_prefixes - tagfiles = pelicanobj.settings.get('DOXYGEN_TAGFILES', []) + tagfiles = pelicanobj.settings.get('M_DOX_TAGFILES', []) # Pre-round to populate subclasses diff --git a/pelican-plugins/m/htmlsanity.py b/pelican-plugins/m/htmlsanity.py index b6bf9426..77fb7053 100644 --- a/pelican-plugins/m/htmlsanity.py +++ b/pelican-plugins/m/htmlsanity.py @@ -713,8 +713,8 @@ def configure_pelican(pelicanobj): global enable_hyphenation, smart_quotes, hyphenation_lang, \ docutils_settings, intrasite_link_regex - enable_hyphenation = pelicanobj.settings.get('HTMLSANITY_HYPHENATION', False) - smart_quotes = pelicanobj.settings.get('HTMLSANITY_SMART_QUOTES', False) + enable_hyphenation = pelicanobj.settings.get('M_HTMLSANITY_HYPHENATION', False) + smart_quotes = pelicanobj.settings.get('M_HTMLSANITY_SMART_QUOTES', False) hyphenation_lang = pelicanobj.settings['DEFAULT_LANG'] docutils_settings = pelicanobj.settings['DOCUTILS_SETTINGS'] intrasite_link_regex = pelicanobj.settings['INTRASITE_LINK_REGEX'] diff --git a/site/pelicanconf.py b/site/pelicanconf.py index d79f2575..a290b32e 100644 --- a/site/pelicanconf.py +++ b/site/pelicanconf.py @@ -126,10 +126,9 @@ CSS_FILES = ['https://fonts.googleapis.com/css?family=Source+Code+Pro:400,400i,6 FORMATTED_FIELDS = ['summary', 'landing'] -HTMLSANITY_SMART_QUOTES = True -HTMLSANITY_HYPHENATION = True - -DOXYGEN_TAGFILES = [ +M_HTMLSANITY_SMART_QUOTES = True +M_HTMLSANITY_HYPHENATION = True +M_DOX_TAGFILES = [ ('../doc/doxygen/corrade.tag', 'http://doc.magnum.graphics/corrade/', ['Corrade::'])] DIRECT_TEMPLATES = []