docs: store prefixes in redirects
This allows us to link to articles that are using pretty-URLs without adding an ugly "/index.html"-suffix to them. Reviewed-by: Eric Engestrom <eric@engestrom.ch> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6862>
This commit is contained in:

committed by
Marge Bot

parent
12760d0480
commit
d2dfbf0e66
@@ -1,8 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
redirects = [
|
redirects = [
|
||||||
('llvmpipe', 'gallium/drivers/llvmpipe'),
|
('llvmpipe', 'gallium/drivers/llvmpipe.html'),
|
||||||
('postprocess', 'gallium/postprocess')
|
('postprocess', 'gallium/postprocess.html')
|
||||||
]
|
]
|
||||||
|
|
||||||
def create_redirect(dst):
|
def create_redirect(dst):
|
||||||
@@ -14,9 +14,8 @@ def create_redirects(app, docname):
|
|||||||
return
|
return
|
||||||
for src, dst in redirects:
|
for src, dst in redirects:
|
||||||
path = os.path.join(app.outdir, '{0}.html'.format(src))
|
path = os.path.join(app.outdir, '{0}.html'.format(src))
|
||||||
url = '{0}.html'.format(dst)
|
|
||||||
with open(path, 'w') as f:
|
with open(path, 'w') as f:
|
||||||
f.write(create_redirect(url))
|
f.write(create_redirect(dst))
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
app.connect('build-finished', create_redirects)
|
app.connect('build-finished', create_redirects)
|
||||||
|
Reference in New Issue
Block a user