10000 Backport PR #15244: Change documentation format of rcParams defaults · timhoffm/matplotlib@a853e40 · GitHub
[go: up one dir, main page]

Skip to content

Commit a853e40

Browse files
jklymaktimhoffm
authored andcommitted
Backport PR matplotlib#15244: Change documentation format of rcParams defaults
1 parent 42e257e commit a853e40

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

doc/sphinxext/custom_roles.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55

66
def rcparam_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
7-
param = rcParamsDefault.get(text)
8-
rendered = nodes.Text(f'rcParams["{text}"] = {param!r}')
7+
rendered = nodes.Text(f'rcParams["{text}"]')
98

109
source = inliner.document.attributes['source'].replace(sep, '/')
1110
rel_source = source.split('/doc/', 1)[1]
@@ -16,7 +15,10 @@ def rcparam_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
1615
f"?highlight={text}#a-sample-matplotlibrc-file")
1716

1817
ref = nodes.reference(rawtext, rendered, refuri=refuri)
19-
return [nodes.literal('', '', ref)], []
18+
node_list = [nodes.literal('', '', ref)]
19+
if text in rcParamsDefault:
20+
node_list.append(nodes.Text(f' (default: {rcParamsDefault[text]!r})'))
21+
return node_list, []
2022

2123

2224
def setup(app):

0 commit comments

Comments
 (0)
0