Documentation/conf.py: make the conf build again

This commit is contained in:
Adrien Bourmault 2024-03-13 13:52:20 +01:00
parent 15d8088da8
commit 3f04a5026c
Signed by: neox
GPG Key ID: 95F65F55F682A17A
1 changed files with 21 additions and 4 deletions

View File

@ -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,