8000 Include default rcparam in rc role · matplotlib/matplotlib@27ce832 · GitHub
[go: up one dir, main page]

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 27ce832

Browse files
Include default rcparam in rc role
1 parent 24cdef4 commit 27ce832

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

doc/sphinxext/custom_roles.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
from docutils import nodes
22
from os.path import sep
3-
3+
from matplotlib import rcParamsDefault
44

55
def rcparam_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
6-
rendered = nodes.Text(f'rcParams["{text}"]')
6+
7+
param = rcParamsDefault.get(text)
8+
if isinstance(param, str):
9+
txt = f' : "{param}"'
10+
else:
11+
txt = f' : {param}'
12+
rendered = nodes.Text(f'rcParams["{text}"]' + txt)
713

814
source = inliner.document.attributes['source'].replace(sep, '/')
915
rel_source = source.split('/doc/', 1)[1]

0 commit comments

Comments
 (0)
0