From 2b8c2e341e6761be1d5dab3daf2bc99d152ade71 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 3 Aug 2018 11:04:18 +1000 Subject: [PATCH] doc/user: add custom 404 pages for the old links Switching from doxygen to sphinx broke a bunch of links because doxygen used whatever the argument to @page was - and that usually had underscores. Sphinx uses filenames (which use dashes) so now we have a bunch of old links going to a 404. For the transition period at least, insert a custom 404 page for each of those to tell users this doesn't exist anymore. Signed-off-by: Peter Hutterer --- doc/user/404.rst | 9 ++++++ doc/user/meson.build | 68 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 doc/user/404.rst diff --git a/doc/user/404.rst b/doc/user/404.rst new file mode 100644 index 00000000..811fb772 --- /dev/null +++ b/doc/user/404.rst @@ -0,0 +1,9 @@ +:orphan: + +=== +404 +=== + +This page has permanently moved, probably to `<@TARGET@>`_ + +This placeholder page will be removed soon. diff --git a/doc/user/meson.build b/doc/user/meson.build index 4e497465..e617bc49 100644 --- a/doc/user/meson.build +++ b/doc/user/meson.build @@ -20,6 +20,72 @@ sphinx_conf_py = configure_file(input : 'conf.py.in', configuration : sphinx_config, install : false) +# 404 replacements for old URLs +# The switch to sphinx caused a few pages to be renamed, sphinx uses +# filename.html whereas doxygen used whatever the @page foo was. So old docs +# *mostly* used underscores, now we're consistent with dashes. +# We can't use htaccess on the server, so let's auto-generate a 404 list +# with a basic page telling users that the link has moved. This can be +# removed in a few months, towards the end of 2018. +# +# File list is: [current-sphinx-input-file, old-generated-page] +# If they're the same they'll be ignored. +src_404s = [ + [ 'absolute-axes.rst', 'absolute_axes.html'], + [ 'absolute-coordinate-ranges.rst', 'absolute_coordinate_ranges.html'], + [ 'architecture.rst', 'architecture.html'], + [ 'building.rst', 'building_libinput.html'], + [ 'button-debouncing.rst', 'button_debouncing.html'], + [ 'clickpad-softbuttons.rst', 'clickpad_softbuttons.html'], + [ 'configuration.rst', 'config_options.html'], + [ 'contributing.rst', 'contributing.html'], + [ 'development.rst', 'development.html'], + [ 'device-configuration-via-udev.rst', 'udev_config.html'], + [ 'device-quirks.rst', 'device-quirks.html'], + [ 'faqs.rst', 'faq.html'], + [ 'features.rst', 'features.html'], + [ 'gestures.rst', 'gestures.html'], + [ 'middle-button-emulation.rst', 'middle_button_emulation.html'], + [ 'normalization-of-relative-motion.rst', 'motion_normalization.html'], + [ 'palm-detection.rst', 'palm_detection.html'], + [ 'pointer-acceleration.rst', 'pointer-acceleration.html'], + [ 'reporting-bugs.rst', 'reporting_bugs.html'], + [ 'scrolling.rst', 'scrolling.html'], + [ 'seats.rst', 'seats.html'], + [ 'switches.rst', 'switches.html'], + [ 't440-support.rst', 't440_support.html'], + [ 'tablet-support.rst', 'tablet-support.html'], + [ 'tapping.rst', 'tapping.html'], + [ 'test-suite.rst', 'test-suite.html'], + [ 'timestamps.rst', 'timestamps.html'], + [ 'tools.rst', 'tools.html'], + [ 'touchpad-jitter.rst', 'touchpad_jitter.html'], + [ 'touchpad-jumping-cursors.rst', 'touchpad_jumping_cursor.html'], + [ 'touchpad-pressure.rst', 'touchpad_pressure.html'], + [ 'touchpads.rst', 'touchpads.html'], + [ 'trackpoints.rst', 'trackpoints.html'], + [ 'troubleshooting.rst', 'troubleshooting.html'], + [ 'what-is-libinput.rst', 'what_is_libinput.html'], +] + +dst_404s = [] +foreach s404 : src_404s + target = s404[0] + oldpage = s404[1] + tname = target.split('.rst')[0] + oname = oldpage.split('.html')[0] + + if tname != oname + config_404 = configuration_data() + config_404.set('TARGET', '@0@.html'.format(tname)) + c = configure_file(input : '404.rst', + output : '@0@.rst'.format(oname), + configuration : config_404, + install : false) + dst_404s += [c] + endif +endforeach + src_extra = [ # dot drawings 'dot/seats-sketch.gv', @@ -113,7 +179,7 @@ src_sphinx = custom_target('sphinx-sources', # do not use -j, it breaks on Ubuntu sphinx_output_dir = 'Documentation' custom_target('sphinx', - input : [ sphinx_conf_py, git_version_page ] + src_rst + src_extra, + input : [ sphinx_conf_py, git_version_page ] + src_rst + src_extra + dst_404s, output : [ sphinx_output_dir ], command : [ sphinx, '-q', '-b', 'html', '-a', meson.current_build_dir(), sphinx_output_dir],