Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 502b311

Browse filesBrowse files
authored
Merge pull request #27200 from timhoffm/doc-type-ref
DOC: Add role for custom informal types like color
2 parents 2ea5c58 + 689ab84 commit 502b311
Copy full SHA for 502b311

File tree

Expand file treeCollapse file tree

2 files changed

+16
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-1
lines changed

‎doc/sphinxext/custom_roles.py

Copy file name to clipboardExpand all lines: doc/sphinxext/custom_roles.py
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,23 @@ def rcparam_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
6464
return node_list, messages
6565

6666

67+
def mpltype_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
68+
mpltype = text
69+
type_to_link_target = {
70+
'color': 'colors_def',
71+
}
72+
if mpltype not in type_to_link_target:
73+
raise ValueError(f"Unknown mpltype: {mpltype!r}")
74+
75+
ref_nodes, messages = inliner.interpreted(
76+
mpltype, f'{mpltype} <{type_to_link_target[mpltype]}>', 'ref', lineno)
77+
node_list = [ref_nodes]
78+
return node_list, messages
79+
80+
6781
def setup(app):
6882
app.add_role("rc", rcparam_role)
83+
app.add_role("mpltype", mpltype_role)
6984
app.add_node(
7085
QueryReference,
7186
html=(visit_query_reference_node, depart_query_reference_node),

‎lib/matplotlib/widgets.py

Copy file name to clipboardExpand all lines: lib/matplotlib/widgets.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def __init__(self, ax, label, image=None,
191191
image : array-like or PIL Image
192192
The image to place in the button, if not *None*. The parameter is
193193
directly forwarded to `~.axes.Axes.imshow`.
194-
color : color
194+
color : :mpltype:`color`
195195
The color of the button when not activated.
196196
hovercolor : color
197197
The color of the button when the mouse is over it.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.