mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
Python domain can link multiple types in a type field
This commit is contained in:
@@ -371,6 +371,13 @@ using the following syntax::
|
|||||||
:type point: tuple(float, float)
|
:type point: tuple(float, float)
|
||||||
:type point: tuple[float, float]
|
:type point: tuple[float, float]
|
||||||
|
|
||||||
|
Multiple types in a type field will be linked automatically if separated by
|
||||||
|
the word "or"::
|
||||||
|
|
||||||
|
:type an_arg: int or None
|
||||||
|
:vartype a_var: str or int
|
||||||
|
:rtype: float or str
|
||||||
|
|
||||||
.. _python-roles:
|
.. _python-roles:
|
||||||
|
|
||||||
Cross-referencing Python objects
|
Cross-referencing Python objects
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class PyXrefMixin(object):
|
|||||||
|
|
||||||
def make_xrefs(self, rolename, domain, target, innernode=nodes.emphasis,
|
def make_xrefs(self, rolename, domain, target, innernode=nodes.emphasis,
|
||||||
contnode=None):
|
contnode=None):
|
||||||
delims = '(\s*[\[\]\(\),]\s*)'
|
delims = '(\s*[\[\]\(\),](?:\s*or\s)?\s*|\s+or\s+)'
|
||||||
delims_re = re.compile(delims)
|
delims_re = re.compile(delims)
|
||||||
sub_targets = re.split(delims, target)
|
sub_targets = re.split(delims, target)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user