#!/usr/bin/env python3 # Doc URLs may change with time because they depend on Doxygen machinery. # This is unfortunate because it is good practice to keep valid URLs. # See: “Cool URIs don’t change” at https://www.w3.org/Provider/Style/URI.html. # # There is no built-in solution in Doxygen that we are aware of. # The solution proposed here is to maintain a registry of all URLs and manage # legacy URLs as redirections to their canonical page. import argparse from enum import IntFlag import glob from itertools import chain from pathlib import Path from string import Template from typing import NamedTuple, Sequence import yaml class Update(NamedTuple): new: str old: str class ExitCode(IntFlag): NORMAL = 0 INVALID_UPDATES = 1 << 4 MISSING_UPDATES = 1 << 5 THIS_SCRIPT_PATH = Path(__file__) RELATIVE_SCRIPT_PATH = THIS_SCRIPT_PATH.relative_to(THIS_SCRIPT_PATH.parent.parent) REDIRECTION_DELAY = 6 # in seconds. Note: at least 6s for accessibility # NOTE: The redirection works with the HTML tag: . # See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#http-equiv # # NOTE: This page is a simplified version of the Doxygen-generated ones. # It does use the current stylesheets, but it may break if the theme is updated. # Ideally, we would just let Doxygen generate them, but I (Wismill) could not # find a way to do this with the redirection feature. REDIRECTION_PAGE_TEMPLATE = Template( """
This page has been moved.
If you are not redirected automatically, follow the link to the current page.