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