From 781dedec1fc3b8452d12f67f3c8ddd9d45f724f4 Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Tue, 17 Mar 2020 10:21:56 +0100 Subject: Align install.rst with current version (#2075) Using {PROJVERSION} and {PROJDATAVERSION} substitutes the macro for the current version numbers of PROJ and PROJ-data. Rephrased a few sections regarding grid packages. Closes #2072 Co-authored-by: Mike Taves --- docs/source/conf.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'docs/source/conf.py') diff --git a/docs/source/conf.py b/docs/source/conf.py index c37e7e17..e85e5dfb 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -69,6 +69,7 @@ copyright = u'1983-{0}'.format(now.year) # |version| and |release|, also used in various other places throughout the # built documents. version = '7.1.0' +data_version = '1.0' # use same |release| as |version| release = version @@ -120,6 +121,22 @@ highlight_language = 'none' # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False +# Replacement macros for use in code-blocks etc. With inspiration from +# https://github.com/sphinx-doc/sphinx/issues/4054#issuecomment-329097229 +def replace_words(app, docname, source): + result = source[0] + for key in app.config.replacements: + result = result.replace(key, app.config.replacements[key]) + source[0] = result + +replacements = { + "{PROJVERSION}" : "{version_number}".format(version_number=version), + "{PROJDATAVERSION}" : "{data_version_number}".format(data_version_number=data_version), +} + +def setup(app): + app.add_config_value('replacements', {}, True) + app.connect('source-read', replace_words) # -- Options for HTML output ---------------------------------------------- -- cgit v1.2.3