| from docutils.nodes import reference |
| from docutils.parsers.rst.roles import set_classes |
|
|
|
|
| |
| |
|
|
|
|
| def gh_role(name, rawtext, text, lineno, inliner, options={}, content=[]): |
| """Link to a GitHub issue.""" |
| try: |
| |
| int(text) |
| except ValueError: |
| |
| slug = text |
| else: |
| slug = "issues/" + text |
| text = "#" + text |
| ref = "https://github.com/NeuroTechX/moabb/" + slug |
| set_classes(options) |
| node = reference(rawtext, text, refuri=ref, **options) |
| return [node], [] |
|
|
|
|
| def setup(app): |
| app.add_role("gh", gh_role) |
| return {"parallel_read_safe": True} |
|
|