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

Function make_link_node

docs/sphinxext/github.py:28–54  ·  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

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

Callers 1

ghissue_roleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…