Commit af0bf169 authored by Ben Gamari's avatar Ben Gamari 🐢
Browse files

user-guide: Allow build with sphinx < 1.8

Apparently the override argument to add_directive_to_domain was added in sphinx

(cherry picked from commit a257782f)
parent 5ed9c861
......@@ -46,9 +46,11 @@
from docutils import nodes
from docutils.parsers.rst import Directive, directives
import sphinx
from sphinx import addnodes
from import GenericObject
from sphinx.errors import SphinxError
from distutils.version import LooseVersion
from utils import build_table_from_list
### Settings
......@@ -597,15 +599,18 @@ def purge_flags(app, env, docname):
### Initialization
def setup(app):
# The override argument to add_directive_to_domain is only supported by >= 1.8
sphinx_version = LooseVersion(sphinx.__version__)
override_arg = {'override': True} if sphinx_version >= LooseVersion('1.8') else {}
# Add ghc-flag directive, and override the class with our own
app.add_object_type('ghc-flag', 'ghc-flag')
app.add_directive_to_domain('std', 'ghc-flag', Flag, override=True)
app.add_directive_to_domain('std', 'ghc-flag', Flag, **override_arg)
# Add extension directive, and override the class with our own
app.add_object_type('extension', 'extension')
app.add_directive_to_domain('std', 'extension', LanguageExtension,
# NB: language-extension would be misinterpreted by sphinx, and produce
# lang="extensions" XML attributes
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment