mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-12 16:32:10 -05:00
Fix #3960: default_role = guilabel not functioning
This commit is contained in:
1 parent
ea03e27fb8
commit
fa9ad8552d
2 files changed
+17
-1
No files matched your search
@@ -21,7 +21,8 @@ Bugs fixed
|
|||||||
|
|
||||||
* #3924: docname lost after dynamically parsing RST in extension
|
* #3924: docname lost after dynamically parsing RST in extension
|
||||||
* #3946: Typo in sphinx.sty (this was a bug with no effect in default context)
|
* #3946: Typo in sphinx.sty (this was a bug with no effect in default context)
|
||||||
* Fix :pep: and :rfc: does not supports ``default-role`` directive (refs: #3960)
|
* :pep: and :rfc: does not supports ``default-role`` directive (refs: #3960)
|
||||||
|
* #3960: default_role = 'guilabel' not functioning
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ def indexmarkup_role(typ, rawtext, text, lineno, inliner, options={}, content=[]
|
|||||||
typ = env.temp_data['default_role'].lower()
|
typ = env.temp_data['default_role'].lower()
|
||||||
else:
|
else:
|
||||||
typ = typ.lower()
|
typ = typ.lower()
|
||||||
|
|
||||||
has_explicit_title, title, target = split_explicit_title(text)
|
has_explicit_title, title, target = split_explicit_title(text)
|
||||||
title = utils.unescape(title)
|
title = utils.unescape(title)
|
||||||
target = utils.unescape(target)
|
target = utils.unescape(target)
|
||||||
@@ -250,6 +251,13 @@ _amp_re = re.compile(r'(?<!&)&(?![&\s])')
|
|||||||
|
|
||||||
def menusel_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
def menusel_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||||
# type: (unicode, unicode, unicode, int, Inliner, Dict, List[unicode]) -> Tuple[List[nodes.Node], List[nodes.Node]] # NOQA
|
# type: (unicode, unicode, unicode, int, Inliner, Dict, List[unicode]) -> Tuple[List[nodes.Node], List[nodes.Node]] # NOQA
|
||||||
|
env = inliner.document.settings.env
|
||||||
|
if not typ:
|
||||||
|
assert env.temp_data['default_role']
|
||||||
|
typ = env.temp_data['default_role'].lower()
|
||||||
|
else:
|
||||||
|
typ = typ.lower()
|
||||||
|
|
||||||
text = utils.unescape(text)
|
text = utils.unescape(text)
|
||||||
if typ == 'menuselection':
|
if typ == 'menuselection':
|
||||||
text = text.replace('-->', u'\N{TRIANGULAR BULLET}')
|
text = text.replace('-->', u'\N{TRIANGULAR BULLET}')
|
||||||
@@ -281,6 +289,13 @@ _litvar_re = re.compile('{([^}]+)}')
|
|||||||
def emph_literal_role(typ, rawtext, text, lineno, inliner,
|
def emph_literal_role(typ, rawtext, text, lineno, inliner,
|
||||||
options={}, content=[]):
|
options={}, content=[]):
|
||||||
# type: (unicode, unicode, unicode, int, Inliner, Dict, List[unicode]) -> Tuple[List[nodes.Node], List[nodes.Node]] # NOQA
|
# type: (unicode, unicode, unicode, int, Inliner, Dict, List[unicode]) -> Tuple[List[nodes.Node], List[nodes.Node]] # NOQA
|
||||||
|
env = inliner.document.settings.env
|
||||||
|
if not typ:
|
||||||
|
assert env.temp_data['default_role']
|
||||||
|
typ = env.temp_data['default_role'].lower()
|
||||||
|
else:
|
||||||
|
typ = typ.lower()
|
||||||
|
|
||||||
text = utils.unescape(text)
|
text = utils.unescape(text)
|
||||||
pos = 0
|
pos = 0
|
||||||
retnode = nodes.literal(role=typ.lower(), classes=[typ])
|
retnode = nodes.literal(role=typ.lower(), classes=[typ])
|
||||||
|
|||||||
Reference in new issue
Block a user