You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.6 KiB
36 lines
1.6 KiB
6 years ago
|
--- ghc-8.6.3/docs/users_guide/flags.py~ 2018-09-21 06:18:23.000000000 +0800
|
||
|
+++ ghc-8.6.3/docs/users_guide/flags.py 2019-03-05 10:20:38.639782096 +0800
|
||
|
@@ -49,6 +49,8 @@
|
||
|
import sphinx
|
||
6 years ago
|
from sphinx import addnodes
|
||
|
from sphinx.domains.std import GenericObject
|
||
|
+from sphinx.domains import ObjType
|
||
|
+from sphinx.roles import XRefRole
|
||
|
from sphinx.errors import SphinxError
|
||
6 years ago
|
from distutils.version import LooseVersion
|
||
6 years ago
|
from utils import build_table_from_list
|
||
6 years ago
|
@@ -603,14 +605,21 @@
|
||
|
sphinx_version = LooseVersion(sphinx.__version__)
|
||
|
override_arg = {'override': True} if sphinx_version >= LooseVersion('1.8') else {}
|
||
6 years ago
|
|
||
|
+ # Yuck: We can't use app.add_object_type since we need to provide the
|
||
|
+ # Directive instance ourselves.
|
||
|
+ std_object_types = app.registry.domain_object_types.setdefault('std', {})
|
||
6 years ago
|
+
|
||
6 years ago
|
# Add ghc-flag directive, and override the class with our own
|
||
|
- app.add_object_type('ghc-flag', 'ghc-flag')
|
||
6 years ago
|
app.add_directive_to_domain('std', 'ghc-flag', Flag, **override_arg)
|
||
6 years ago
|
+ app.add_role_to_domain('std', 'ghc-flag', XRefRole())
|
||
|
+ std_object_types['ghc-flag'] = ObjType('ghc-flag', 'ghc-flag')
|
||
|
|
||
|
# Add extension directive, and override the class with our own
|
||
|
- app.add_object_type('extension', 'extension')
|
||
6 years ago
|
app.add_directive_to_domain('std', 'extension', LanguageExtension,
|
||
|
**override_arg)
|
||
6 years ago
|
+ app.add_role_to_domain('std', 'extension', XRefRole())
|
||
|
+ std_object_types['extension'] = ObjType('ghc-flag', 'ghc-flag')
|
||
|
+
|
||
|
# NB: language-extension would be misinterpreted by sphinx, and produce
|
||
|
# lang="extensions" XML attributes
|
||
|
|