diff --git a/Documentation/conf.py b/Documentation/conf.py index 85df9ea5..1282b8c6 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -1,7 +1,19 @@ # -*- coding: utf-8 -*- +import sphinx import subprocess from recommonmark.parser import CommonMarkParser +# Get Sphinx version +version_major = 0 +version_minor = 0 +version_patch = 0 +version = sphinx.__version__.split(".") +if len(version) > 2: + version_patch = int(version[2]) +if len(version) > 1: + version_major = int(version[0]) + version_minor = int(version[1]) + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -25,6 +37,12 @@ release = subprocess.check_output(('git', 'describe')).decode("utf-8") # The short X.Y version. version = release.split("-")[0] +extensions = [] + +# Load recommonmark +if version_major >= 2 or (version_major == 1 and version_minor >= 8): + extensions += ['recommonmark'] + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # @@ -63,9 +81,9 @@ html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] html_context = { - 'css_files': [ + 'css_files': [ '_static/theme_overrides.css', # override wide tables in RTD theme - ], + ], } # Output file base name for HTML help builder. @@ -121,7 +139,7 @@ latex_documents = [ # # latex_appendices = [] -# If false, will not define \strong, \code, itleref, \crossref ... but only +# If false, will not define \strong, \code, itleref, \crossref ... but only # \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added # packages. # @@ -185,7 +203,6 @@ class MyCommonMarkParser(CommonMarkParser): def setup(app): from recommonmark.transform import AutoStructify - app.add_source_parser('.md', MyCommonMarkParser) app.add_config_value('recommonmark_config', { 'enable_auto_toc_tree': True,