##// END OF EJS Templates
Do not use mutables as default arguments
Dimitri Papadopoulos -
Show More
@@ -51,7 +51,7 b' def make_link_node(rawtext, app, type, slug, options):'
51 51 **options)
52 52 return node
53 53
54 def ghissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
54 def ghissue_role(name, rawtext, text, lineno, inliner, options=None, content=None):
55 55 """Link to a GitHub issue.
56 56
57 57 Returns 2 part tuple containing list of nodes to insert into the
@@ -66,6 +66,8 b' def ghissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]):'
66 66 :param options: Directive options for customization.
67 67 :param content: The directive content for customization.
68 68 """
69 if options is None:
70 options = {}
69 71
70 72 try:
71 73 issue_num = int(text)
@@ -92,7 +94,7 b' def ghissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]):'
92 94 node = make_link_node(rawtext, app, category, str(issue_num), options)
93 95 return [node], []
94 96
95 def ghuser_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
97 def ghuser_role(name, rawtext, text, lineno, inliner, options=None, content=None):
96 98 """Link to a GitHub user.
97 99
98 100 Returns 2 part tuple containing list of nodes to insert into the
@@ -107,13 +109,16 b' def ghuser_role(name, rawtext, text, lineno, inliner, options={}, content=[]):'
107 109 :param options: Directive options for customization.
108 110 :param content: The directive content for customization.
109 111 """
112 if options is None:
113 options = {}
114
110 115 app = inliner.document.settings.env.app
111 116 #info('user link %r' % text)
112 117 ref = 'https://www.github.com/' + text
113 118 node = nodes.reference(rawtext, text, refuri=ref, **options)
114 119 return [node], []
115 120
116 def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
121 def ghcommit_role(name, rawtext, text, lineno, inliner, options=None, content=None):
117 122 """Link to a GitHub commit.
118 123
119 124 Returns 2 part tuple containing list of nodes to insert into the
@@ -128,6 +133,9 b' def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]):'
128 133 :param options: Directive options for customization.
129 134 :param content: The directive content for customization.
130 135 """
136 if options is None:
137 options = {}
138
131 139 app = inliner.document.settings.env.app
132 140 #info('user link %r' % text)
133 141 try:
General Comments 0
You need to be logged in to leave comments. Login now