8000 Merge pull request #15129 from meeseeksmachine/auto-backport-of-pr-15… · matplotlib/matplotlib@d33d167 · 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 d33d167

Browse files
authored
Merge pull request #15129 from meeseeksmachine/auto-backport-of-pr-15115-on-v3.1.1-doc
Backport PR #15115 on branch v3.1.1-doc (Doc: highlight rcparams)
2 parents dc67fce + f86b832 commit d33d167

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Thumbs.db
5454
###################################
5555
lib/matplotlib/mpl-data/matplotlib.conf
5656
lib/matplotlib/mpl-data/matplotlibrc
57+
tutorials/intermediate/CL01.png
58+
tutorials/intermediate/CL02.png
5759

5860
# Documentation generated files #
5961
#################################

doc/_static/mpl.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,10 @@ span.linkdescr {
594594
font-size: 90%;
595595
}
596596

597+
.highlight span.c1 span.highlighted {
598+
background-color: #fce5a6;
599+
}
600+
597601
ul.search {
598602
margin: 10px 0 0 20px;
599603
padding: 0;

doc/sphinxext/custom_roles.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
from docutils import nodes
22
from os.path import sep
3+
from matplotlib import rcParamsDefault
34

45

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

810
source = inliner.document.attributes['source'].replace(sep, '/')
911
rel_source = source.split('/doc/', 1)[1]
1012

1113
levels = rel_source.count('/')
1214
refuri = ('../' * levels +
13-
'tutorials/introductory/customizing.html#matplotlib-rcparams')
15+
'tutorials/introductory/customizing.html' +
16+
f"?highlight={text}#a-sample-matplotlibrc-file")
1417

1518
ref = nodes.reference(rawtext, rendered, refuri=refuri)
1619
return [nodes.literal('', '', ref)], []

0 commit comments

Comments
 (0)
0