Revert "Merge branch 'doc/use_sphinx_reredirect_extension' into 'master'"

This reverts merge request !13293
This commit is contained in:
Krzysztof Budzynski
2021-04-23 13:44:40 +08:00
parent 0d6482b8ee
commit 632b5c40e6
5 changed files with 82 additions and 13 deletions

View File

@@ -55,8 +55,8 @@ extensions = ['breathe',
'sphinxcontrib.rackdiag',
'sphinxcontrib.packetdiag',
'sphinxcontrib.cairosvgconverter',
'sphinx_reredirects',
'extensions.html_redirects',
'extensions.toctree_filter',
'extensions.list_filter',
'extensions.google_analytics',
@@ -260,24 +260,16 @@ project_homepage = 'https://github.com/espressif/esp-idf'
# -- Options for HTML output ----------------------------------------------
# Add redirections for sphinx_reredirects extension
# Custom added feature to allow redirecting old URLs
#
# sphinx_reredirects requires extensions be specified in a Dictionary called 'redirects'
# See https://pypi.org/project/sphinx-reredirects/ for more details
# Redirects should be listed in page_redirects.xt
#
# We need to read the redirections from page_redirects.txt that are spaced separated
# and convert them into a Dict
redirects = {}
with open('../page_redirects.txt') as f:
lines = [re.sub(' +', ' ', line.strip()) for line in f.readlines() if line.strip() != '' and not line.startswith('#')]
for line in lines: # check for well-formed entries
if len(line.split(' ')) != 2:
raise RuntimeError('Invalid line in page_redirects.txt: %s' % line)
else:
old_path = line.split(' ')[0]
new_path = line.split(' ')[1]
redirects[old_path] = new_path
html_redirect_pages = [tuple(line.split(' ')) for line in lines]
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.