From 9a644d701730cbec1a8f4d7caa94a72f21ea8e72 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 21 Oct 2020 13:50:11 +0200 Subject: [PATCH] docs: specify redirects in conf.py instead This makes it much easier to discover these. Reviewed-by: Eric Anholt Part-of: --- docs/_exts/redirects.py | 9 ++------- docs/conf.py | 6 ++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/_exts/redirects.py b/docs/_exts/redirects.py index 04308b711bd..90d69efee5f 100644 --- a/docs/_exts/redirects.py +++ b/docs/_exts/redirects.py @@ -2,12 +2,6 @@ import os import pathlib from urllib.parse import urlparse -redirects = [ - ('llvmpipe', 'gallium/drivers/llvmpipe.html'), - ('postprocess', 'gallium/postprocess.html'), - ('webmaster', 'https://www.mesa3d.org/website/') -] - def create_redirect(dst): tpl = '' return tpl.format(dst) @@ -15,7 +9,7 @@ def create_redirect(dst): def create_redirects(app, docname): if not app.builder.name == 'html': return - for src, dst in redirects: + for src, dst in app.config.html_redirects: path = os.path.join(app.outdir, '{0}.html'.format(src)) os.makedirs(os.path.dirname(path), exist_ok=True) @@ -29,4 +23,5 @@ def create_redirects(app, docname): f.write(create_redirect(dst)) def setup(app): + app.add_config_value('html_redirects', [], '') app.connect('build-finished', create_redirects) diff --git a/docs/conf.py b/docs/conf.py index a03fc165e0e..1d16c5a8a65 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -135,6 +135,12 @@ html_extra_path = [ 'README.WIN32', ] +html_redirects = [ + ('llvmpipe', 'gallium/drivers/llvmpipe.html'), + ('postprocess', 'gallium/postprocess.html'), + ('webmaster', 'https://www.mesa3d.org/website/'), +] + # -- Options for HTMLHelp output ------------------------------------------