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

Function ghissue_role

docs/sphinxext/github.py:54–93  ·  view source on GitHub ↗

Link to a GitHub issue. 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 text

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

Source from the content-addressed store, hash-verified

52 return node
53
54def ghissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
55 """Link to a GitHub issue.
56
57 Returns 2 part tuple containing list of nodes to insert into the
58 document and a list of system messages. Both are allowed to be
59 empty.
60
61 :param name: The role name used in the document.
62 :param rawtext: The entire markup snippet, with role.
63 :param text: The text marked with the role.
64 :param lineno: The line number where rawtext appears in the input.
65 :param inliner: The inliner instance that called us.
66 :param options: Directive options for customization.
67 :param content: The directive content for customization.
68 """
69
70 try:
71 issue_num = int(text)
72 if issue_num <= 0:
73 raise ValueError
74 except ValueError:
75 msg = inliner.reporter.error(
76 'GitHub issue number must be a number greater than or equal to 1; '
77 '"%s" is invalid.' % text, line=lineno)
78 prb = inliner.problematic(rawtext, rawtext, msg)
79 return [prb], [msg]
80 app = inliner.document.settings.env.app
81 #info('issue %r' % text)
82 if 'pull' in name.lower():
83 category = 'pull'
84 elif 'issue' in name.lower():
85 category = 'issues'
86 else:
87 msg = inliner.reporter.error(
88 'GitHub roles include "ghpull" and "ghissue", '
89 '"%s" is invalid.' % name, line=lineno)
90 prb = inliner.problematic(rawtext, rawtext, msg)
91 return [prb], [msg]
92 node = make_link_node(rawtext, app, category, str(issue_num), options)
93 return [node], []
94
95def ghuser_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
96 """Link to a GitHub user.

Callers

nothing calls this directly

Calls 2

make_link_nodeFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected