mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Role names are case-insensitive. #24.
This commit is contained in:
parent
b4d0a9dc9a
commit
8ccd4ace64
2
CHANGES
2
CHANGES
@ -118,6 +118,8 @@ Bugs fixed
|
|||||||
|
|
||||||
* Fix LaTeX build for some description environments with ``:noindex:``.
|
* Fix LaTeX build for some description environments with ``:noindex:``.
|
||||||
|
|
||||||
|
* Don't crash on weird casing of role names (like ``:Class:``).
|
||||||
|
|
||||||
|
|
||||||
Release 0.4.3 (Oct 8, 2008)
|
Release 0.4.3 (Oct 8, 2008)
|
||||||
===========================
|
===========================
|
||||||
|
@ -41,6 +41,8 @@ def indexmarkup_role(typ, rawtext, etext, lineno, inliner, options={}, content=[
|
|||||||
env = inliner.document.settings.env
|
env = inliner.document.settings.env
|
||||||
if not typ:
|
if not typ:
|
||||||
typ = env.config.default_role
|
typ = env.config.default_role
|
||||||
|
else:
|
||||||
|
typ = typ.lower()
|
||||||
text = utils.unescape(etext)
|
text = utils.unescape(etext)
|
||||||
targetid = 'index-%s' % env.index_num
|
targetid = 'index-%s' % env.index_num
|
||||||
env.index_num += 1
|
env.index_num += 1
|
||||||
@ -112,6 +114,8 @@ def xfileref_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
|||||||
env = inliner.document.settings.env
|
env = inliner.document.settings.env
|
||||||
if not typ:
|
if not typ:
|
||||||
typ = env.config.default_role
|
typ = env.config.default_role
|
||||||
|
else:
|
||||||
|
typ = typ.lower()
|
||||||
text = utils.unescape(text)
|
text = utils.unescape(text)
|
||||||
# if the first character is a bang, don't cross-reference at all
|
# if the first character is a bang, don't cross-reference at all
|
||||||
if text[0:1] == '!':
|
if text[0:1] == '!':
|
||||||
@ -190,7 +194,7 @@ _litvar_re = re.compile('{([^}]+)}')
|
|||||||
def emph_literal_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
def emph_literal_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||||
text = utils.unescape(text)
|
text = utils.unescape(text)
|
||||||
pos = 0
|
pos = 0
|
||||||
retnode = nodes.literal(role=typ)
|
retnode = nodes.literal(role=typ.lower())
|
||||||
for m in _litvar_re.finditer(text):
|
for m in _litvar_re.finditer(text):
|
||||||
if m.start() > pos:
|
if m.start() > pos:
|
||||||
txt = text[pos:m.start()]
|
txt = text[pos:m.start()]
|
||||||
|
@ -62,6 +62,8 @@ Stuff [#]_
|
|||||||
|
|
||||||
This is a side note.
|
This is a side note.
|
||||||
|
|
||||||
|
This tests :CLASS:`role names in uppercase`.
|
||||||
|
|
||||||
.. centered:: LICENSE AGREEMENT
|
.. centered:: LICENSE AGREEMENT
|
||||||
|
|
||||||
.. acks::
|
.. acks::
|
||||||
|
Loading…
Reference in New Issue
Block a user