summaryrefslogtreecommitdiff
path: root/sphinx/util/rst.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-12-01 18:46:22 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-12-01 18:46:22 +0900
commite294b8e036ffbc5cc0147173fe555780e68cfbbc (patch)
treec83fe851d439aad16d6ad5b6ea50e86326a59b2d /sphinx/util/rst.py
parent48bc80209da4404285863bd27e611887929426b7 (diff)
downloadsphinx-git-e294b8e036ffbc5cc0147173fe555780e68cfbbc.tar.gz
Add role manipulator functions to sphinx.util.docutils
Diffstat (limited to 'sphinx/util/rst.py')
-rw-r--r--sphinx/util/rst.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sphinx/util/rst.py b/sphinx/util/rst.py
index a59b2b07e..8b8aca9ea 100644
--- a/sphinx/util/rst.py
+++ b/sphinx/util/rst.py
@@ -18,6 +18,7 @@ from docutils.parsers.rst.languages import en as english
from docutils.utils import Reporter
from sphinx.locale import __
+from sphinx.util import docutils
from sphinx.util import logging
if False:
@@ -43,10 +44,10 @@ def default_role(docname, name):
dummy_reporter = Reporter('', 4, 4)
role_fn, _ = roles.role(name, english, 0, dummy_reporter)
if role_fn:
- roles._roles[''] = role_fn
+ docutils.register_role('', role_fn)
else:
logger.warning(__('default role %s not found'), name, location=docname)
yield
- roles._roles.pop('', None) # if a document has set a local default role
+ docutils.unregister_role('')