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

Function make_link_node

docs/sphinxext/github.py:26–52  ·  view source on GitHub ↗

Create a link to a github resource. :param rawtext: Text being replaced with link node. :param app: Sphinx application context :param type: Link type (issues, changeset, etc.) :param slug: ID of the thing to link to :param options: Options dictionary passed to role func.

(rawtext, app, type, slug, options)

Source from the content-addressed store, hash-verified

24info = getLogger(__name__).info
25
26def make_link_node(rawtext, app, type, slug, options):
27 """Create a link to a github resource.
28
29 :param rawtext: Text being replaced with link node.
30 :param app: Sphinx application context
31 :param type: Link type (issues, changeset, etc.)
32 :param slug: ID of the thing to link to
33 :param options: Options dictionary passed to role func.
34 """
35
36 try:
37 base = app.config.github_project_url
38 if not base:
39 raise AttributeError
40 if not base.endswith('/'):
41 base += '/'
42 except AttributeError as err:
43 raise ValueError('github_project_url configuration value is not set (%s)' % str(err))
44
45 ref = base + type + '/' + slug + '/'
46 set_classes(options)
47 prefix = "#"
48 if type == 'pull':
49 prefix = "PR " + prefix
50 node = nodes.reference(rawtext, prefix + utils.unescape(slug), refuri=ref,
51 **options)
52 return node
53
54def ghissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
55 """Link to a GitHub issue.

Callers 1

ghissue_roleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected