From 3b6dbc5278165b14c0cc533f79e5fcc3f412d771 Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Sun, 13 Feb 2022 18:44:04 +0100 Subject: [PATCH] docs/conf: use extension ExtLinks --- docs/conf.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 00ca661..6297807 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,7 +23,7 @@ # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html -# -- Path setup -------------------------------------------------------------- +# -- Path setup ----------------------------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -35,18 +35,19 @@ from pathlib import Path sys_path.insert(0, os_path.abspath('.')) -# -- Project information ----------------------------------------------------- +# -- Project information -------------------------------------------------------------------------- project = 'F4PGA examples' authors = 'F4PGA Authors' copyright = f'{authors}, 2020 - 2022' -# -- General configuration --------------------------------------------------- +# -- General configuration ------------------------------------------------------------------------ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ + 'sphinx.ext.extlinks', 'sphinx_tabs.tabs', 'sphinxcontrib.jinja', ] @@ -59,7 +60,7 @@ templates_path = ['_templates'] # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] -# -- Options for HTML output ------------------------------------------------- +# -- Options for HTML output ---------------------------------------------------------------------- html_show_sourcelink = True @@ -81,7 +82,7 @@ html_static_path = ['_static'] html_logo = str(Path(html_static_path[0]) / 'logo.svg') html_favicon = str(Path(html_static_path[0]) / 'favicon.svg') -# -- Collect READMEs from examples -------------------------------------------- +# -- Collect READMEs from examples ----------------------------------------------------------------- from collect_readmes import full_name_lut, families, fill_context @@ -104,3 +105,14 @@ for family in families: key = '_'.join((family, example.name)) jinja_contexts[key] = {'blocks': fill_context(text)} + +# -- Sphinx.Ext.ExtLinks --------------------------------------------------------------------------- + +extlinks = { + 'wikipedia': ('https://en.wikipedia.org/wiki/%s', 'wikipedia:'), + 'gh': ('https://github.com/%s', 'gh:'), + 'ghsharp': ('https://github.com/chipsalliance/f4pga-examples/issues/%s', '#'), + 'ghissue': ('https://github.com/chipsalliance/f4pga-examples/issues/%s', 'issue #'), + 'ghpull': ('https://github.com/chipsalliance/f4pga-examples/pull/%s', 'pull request #'), + 'ghsrc': ('https://github.com/chipsalliance/f4pga-examples/blob/master/%s', '') +}