MCPcopy Create free account
hub / github.com/ipython/ipython / ghcommit_role

Function ghcommit_role

docs/sphinxext/github.py:116–144  ·  view source on GitHub ↗

Link to a GitHub commit. Returns 2 part tuple containing list of nodes to insert into the document and a list of system messages. Both are allowed to be empty. :param name: The role name used in the document. :param rawtext: The entire markup snippet, with role. :param tex

(name, rawtext, text, lineno, inliner, options={}, content=[])

Source from the content-addressed store, hash-verified

114 return [node], []
115
116def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
117 """Link to a GitHub commit.
118
119 Returns 2 part tuple containing list of nodes to insert into the
120 document and a list of system messages. Both are allowed to be
121 empty.
122
123 :param name: The role name used in the document.
124 :param rawtext: The entire markup snippet, with role.
125 :param text: The text marked with the role.
126 :param lineno: The line number where rawtext appears in the input.
127 :param inliner: The inliner instance that called us.
128 :param options: Directive options for customization.
129 :param content: The directive content for customization.
130 """
131 app = inliner.document.settings.env.app
132 #info('user link %r' % text)
133 try:
134 base = app.config.github_project_url
135 if not base:
136 raise AttributeError
137 if not base.endswith('/'):
138 base += '/'
139 except AttributeError as err:
140 raise ValueError('github_project_url configuration value is not set (%s)' % str(err))
141
142 ref = base + text
143 node = nodes.reference(rawtext, text[:6], refuri=ref, **options)
144 return [node], []
145
146
147def setup(app):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected