[Sphinx] Support older recommonmark versions.

The "new way" of enabling recommonmark is only supported in recommonmark
0.5 and later. Use the deprecated approach with versions of Sphinx that
still support it.

If I understand correctly there's no way to use older versions of
recommonmark (<0.5) with newer versions of Sphinx (>3.0) because the old
approach got removed.

Differential revision: https://reviews.llvm.org/D75284
This commit is contained in:
Jonas Devlieghere 2020-06-29 09:44:26 -07:00
parent da940b1a2d
commit 29ea1b4baa

View File

@ -26,7 +26,14 @@ from datetime import date
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo', 'recommonmark']
extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo']
import sphinx
if sphinx.version_info >= (3, 0):
# This requires 0.5 or later.
extensions.append('recommonmark')
else:
source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']