2020from docutils import nodes , utils
2121from docutils .parsers .rst .roles import set_classes
2222
23+
2324def make_link_node (rawtext , app , type , slug , options ):
2425 """Create a link to a github resource.
2526
@@ -37,7 +38,8 @@ def make_link_node(rawtext, app, type, slug, options):
3738 if not base .endswith ('/' ):
3839 base += '/'
3940 except AttributeError as err :
40- raise ValueError ('github_project_url configuration value is not set (%s)' % str (err ))
41+ raise ValueError (
42+ f'github_project_url configuration value is not set ({ err } )' )
4143
4244 ref = base + type + '/' + slug + '/'
4345 set_classes (options )
@@ -48,6 +50,7 @@ def make_link_node(rawtext, app, type, slug, options):
4850 ** options )
4951 return node
5052
53+
5154def ghissue_role (name , rawtext , text , lineno , inliner , options = {}, content = []):
5255 """Link to a GitHub issue.
5356
@@ -88,6 +91,7 @@ def ghissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
8891 node = make_link_node (rawtext , app , category , str (issue_num ), options )
8992 return [node ], []
9093
94+
9195def ghuser_role (name , rawtext , text , lineno , inliner , options = {}, content = []):
9296 """Link to a GitHub user.
9397
@@ -107,7 +111,9 @@ def ghuser_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
107111 node = nodes .reference (rawtext , text , refuri = ref , ** options )
108112 return [node ], []
109113
110- def ghcommit_role (name , rawtext , text , lineno , inliner , options = {}, content = []):
114+
115+ def ghcommit_role (
116+ name , rawtext , text , lineno , inliner , options = {}, content = []):
111117 """Link to a GitHub commit.
112118
113119 Returns 2 part tuple containing list of nodes to insert into the
@@ -130,7 +136,8 @@ def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
130136 if not base .endswith ('/' ):
131137 base += '/'
132138 except AttributeError as err :
133- raise ValueError ('github_project_url configuration value is not set (%s)' % str (err ))
139+ raise ValueError (
140+ f'github_project_url configuration value is not set ({ err } )' )
134141
135142 ref = base + text
136143 node = nodes .reference (rawtext , text [:6 ], refuri = ref , ** options )
0 commit comments