diff --git a/doc/requirements.txt b/doc/requirements.txt index bfe78dea5..27cc8b9f6 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -5,3 +5,6 @@ sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD openstackdocstheme>=1.18.1 # Apache-2.0 reno>=2.5.0 # Apache-2.0 sphinxcontrib-apidoc>=0.2.0 # BSD + +# redirect tests in docs +whereto>=0.3.0 # Apache-2.0 diff --git a/doc/source/_extra/.htaccess b/doc/source/_extra/.htaccess new file mode 100644 index 000000000..bdff533e2 --- /dev/null +++ b/doc/source/_extra/.htaccess @@ -0,0 +1,10 @@ +# The following is generated with: +# +# git log --follow --name-status --format='%H' ac25ae6fee.. -- doc/source/ | \ +# grep ^R | grep .rst | cut -f2- | \ +# sed -e 's|doc/source/|redirectmatch 301 ^/python-novaclient/([^/]+)/|' -e 's|doc/source/|/python-novaclient/$1/|' -e 's/.rst/.html$/' -e 's/.rst/.html/' | \ +# sort + +redirectmatch 301 ^/python-novaclient/([^/]+)/api.html$ /python-novaclient/$1/reference/api/index.html +redirectmatch 301 ^/python-novaclient/([^/]+)/man/nova.html$ /python-novaclient/$1/cli/nova.html +redirectmatch 301 ^/python-novaclient/([^/]+)/shell.html$ /python-novaclient/$1/user/shell.html diff --git a/doc/source/conf.py b/doc/source/conf.py index 42d2176e5..3d4d898ea 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -70,6 +70,10 @@ pygments_style = 'sphinx' # Sphinx are currently 'default' and 'sphinxdoc'. html_theme = 'openstackdocs' +# Add any paths that contain "extra" files, such as .htaccess or +# robots.txt. +html_extra_path = ['_extra'] + # -- Options for openstackdocstheme ------------------------------------------- repository_name = 'openstack/python-novaclient' diff --git a/doc/test/redirect-tests.txt b/doc/test/redirect-tests.txt new file mode 100644 index 000000000..0959ec54f --- /dev/null +++ b/doc/test/redirect-tests.txt @@ -0,0 +1,3 @@ +/python-novaclient/latest/api.html 301 /python-novaclient/latest/reference/api/index.html +/python-novaclient/latest/man/nova.html 301 /python-novaclient/latest/cli/nova.html +/python-novaclient/latest/shell.html 301 /python-novaclient/latest/user/shell.html diff --git a/tox.ini b/tox.ini index a6eaefbde..508966826 100644 --- a/tox.ini +++ b/tox.ini @@ -46,7 +46,9 @@ deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf doc/build - sphinx-build -W -b html doc/source doc/build/html + sphinx-build -W -b html -d doc/build/doctrees doc/source doc/build/html + # Test the redirects. This must run after the main docs build + whereto doc/build/html/.htaccess doc/test/redirect-tests.txt [testenv:releasenotes] basepython = python3