docs/conf: use extension ExtLinks

This commit is contained in:
Unai Martinez-Corral 2022-02-13 18:44:04 +01:00
parent 4d3c60d1fe
commit 3b6dbc5278
1 changed files with 17 additions and 5 deletions

View File

@ -23,7 +23,7 @@
# list see the documentation: # list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html # 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, # 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 # 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('.')) sys_path.insert(0, os_path.abspath('.'))
# -- Project information ----------------------------------------------------- # -- Project information --------------------------------------------------------------------------
project = 'F4PGA examples' project = 'F4PGA examples'
authors = 'F4PGA Authors' authors = 'F4PGA Authors'
copyright = f'{authors}, 2020 - 2022' copyright = f'{authors}, 2020 - 2022'
# -- General configuration --------------------------------------------------- # -- General configuration ------------------------------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = [ extensions = [
'sphinx.ext.extlinks',
'sphinx_tabs.tabs', 'sphinx_tabs.tabs',
'sphinxcontrib.jinja', 'sphinxcontrib.jinja',
] ]
@ -59,7 +60,7 @@ templates_path = ['_templates']
# This pattern also affects html_static_path and html_extra_path. # This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output ------------------------------------------------- # -- Options for HTML output ----------------------------------------------------------------------
html_show_sourcelink = True html_show_sourcelink = True
@ -81,7 +82,7 @@ html_static_path = ['_static']
html_logo = str(Path(html_static_path[0]) / 'logo.svg') html_logo = str(Path(html_static_path[0]) / 'logo.svg')
html_favicon = str(Path(html_static_path[0]) / 'favicon.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 from collect_readmes import full_name_lut, families, fill_context
@ -104,3 +105,14 @@ for family in families:
key = '_'.join((family, example.name)) key = '_'.join((family, example.name))
jinja_contexts[key] = {'blocks': fill_context(text)} 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', '')
}