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)
| 26 | |
| 27 | |
| 28 | def 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 | |
| 57 | def ghissue_role(name, rawtext, text, lineno, inliner, options=None, content=None): |
no outgoing calls
no test coverage detected
searching dependent graphs…