diff options
| author | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2020-09-20 19:38:33 +0200 |
|---|---|---|
| committer | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2020-09-24 22:58:19 +0200 |
| commit | 455b3d3c3145254228ce31d73d8964d13550527c (patch) | |
| tree | 6f5297420a8bef8d85e4924a5a1d39b966f57ce1 /docs/conf.py | |
| parent | 1ea521c51b0ed2967a9ff1d8ad41160043a8a981 (diff) | |
| download | python-setuptools-git-455b3d3c3145254228ce31d73d8964d13550527c.tar.gz | |
Add a :user: role in Sphinx
This change adds a role that links to the GitHub user Sponsors
page. If that page is not set up, it'll redirect to the GitHub user
profile page instead:
Links to https://github.com/sponsors/{{ username }} open as GitHub
Sponsors page if the target `username` has it enabled and redirect
to https://github.com/{{ username }} if it's disabled.
Diffstat (limited to 'docs/conf.py')
| -rw-r--r-- | docs/conf.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/docs/conf.py b/docs/conf.py index 673b6ba5..d5111391 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,9 +10,18 @@ import os cwd=os.path.join(os.path.dirname(__file__), os.path.pardir), ) +# -- Project information ----------------------------------------------------- + +github_url = 'https://github.com' +github_sponsors_url = f'{github_url}/sponsors' + # -- General configuration -- -extensions = ['jaraco.packaging.sphinx', 'rst.linker'] +extensions = [ + 'sphinx.ext.extlinks', # allows to create custom roles easily + 'jaraco.packaging.sphinx', + 'rst.linker', +] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -27,6 +36,11 @@ exclude_trees = [] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' +# -- Options for extlinks extension --------------------------------------- +extlinks = { + 'user': (f'{github_sponsors_url}/%s', '@'), # noqa: WPS323 +} + # -- Options for HTML output -- # The theme to use for HTML and HTML Help pages. Major themes that come with |
