MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _rcparam_role

Function _rcparam_role

lib/matplotlib/sphinxext/roles.py:97–126  ·  view source on GitHub ↗

Sphinx role ``:rc:`` to highlight and link ``rcParams`` entries. Usage: Give the desired ``rcParams`` key as parameter. :code:`:rc:`figure.dpi`` will render as: :rc:`figure.dpi`

(name, rawtext, text, lineno, inliner, options=None, content=None)

Source from the content-addressed store, hash-verified

95
96
97def _rcparam_role(name, rawtext, text, lineno, inliner, options=None, content=None):
98 """
99 Sphinx role ``:rc:`` to highlight and link ``rcParams`` entries.
100
101 Usage: Give the desired ``rcParams`` key as parameter.
102
103 :code:`:rc:`figure.dpi`` will render as: :rc:`figure.dpi`
104 """
105 # Generate a pending cross-reference so that Sphinx will ensure this link
106 # isn't broken at some point in the future.
107 title = f'rcParams["{text}"]'
108 rc_param_name = _RC_WILDCARD_LINK_MAPPING.get(text, text)
109 target = f'rcparam_{rc_param_name.replace(".", "_")}'
110 ref_nodes, messages = inliner.interpreted(title, f'{title} <{target}>',
111 'ref', lineno)
112
113 qr = _QueryReference(rawtext, highlight=text)
114 qr += ref_nodes
115 node_list = [qr]
116
117 # The default backend would be printed as "agg", but that's not correct (as
118 # the default is actually determined by fallback).
119 if text in rcParamsDefault and text != "backend":
120 node_list.extend([
121 nodes.Text(' (default: '),
122 nodes.literal('', repr(rcParamsDefault[text])),
123 nodes.Text(')'),
124 ])
125
126 return node_list, messages
127
128
129def _mpltype_role(name, rawtext, text, lineno, inliner, options=None, content=None):

Callers

nothing calls this directly

Calls 2

_QueryReferenceClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…