Link to a GitHub commit. 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 tex
(name, rawtext, text, lineno, inliner, options={}, content=[])
| 114 | return [node], [] |
| 115 | |
| 116 | def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]): |
| 117 | """Link to a GitHub commit. |
| 118 | |
| 119 | Returns 2 part tuple containing list of nodes to insert into the |
| 120 | document and a list of system messages. Both are allowed to be |
| 121 | empty. |
| 122 | |
| 123 | :param name: The role name used in the document. |
| 124 | :param rawtext: The entire markup snippet, with role. |
| 125 | :param text: The text marked with the role. |
| 126 | :param lineno: The line number where rawtext appears in the input. |
| 127 | :param inliner: The inliner instance that called us. |
| 128 | :param options: Directive options for customization. |
| 129 | :param content: The directive content for customization. |
| 130 | """ |
| 131 | app = inliner.document.settings.env.app |
| 132 | #info('user link %r' % text) |
| 133 | try: |
| 134 | base = app.config.github_project_url |
| 135 | if not base: |
| 136 | raise AttributeError |
| 137 | if not base.endswith('/'): |
| 138 | base += '/' |
| 139 | except AttributeError as err: |
| 140 | raise ValueError('github_project_url configuration value is not set (%s)' % str(err)) |
| 141 | |
| 142 | ref = base + text |
| 143 | node = nodes.reference(rawtext, text[:6], refuri=ref, **options) |
| 144 | return [node], [] |
| 145 | |
| 146 | |
| 147 | def setup(app): |
nothing calls this directly
no outgoing calls
no test coverage detected