docs: add a version switch.
This patch makes the theme include a JavaScript file that replaces the static version HTML with a `<select>` element. The list of versions is fetched from `<content root>/../versions.json` and is expected to adhere to the following format:
```json
[
{ "name": "1.2.3", "root_url": "/docs/amaranth/v1.2.3" },
{ "name": "1.2.2", "root_url": "/docs/amaranth/v1.2.2" }
]
```
This file is expected to be updated manually similarly to how updates are done for https://amaranth-lang.org/index.html. However, an automation could be built at a maintainer's request: for example, this file could be assembled anew when pushing from this repo's GitHub Actions workflow to https://github.com/amaranth-lang/amaranth-lang.github.io.
The appearance of the version switch matches that of the Read the Docs theme's version switch.
<img width="371" height="823" alt="image" src="https://github.com/user-attachments/assets/580844f6-1067-47ae-a3bf-d1e28b79ef29" />
Once this PR is merged, a follow-up PR should be created for https://github.com/amaranth-lang/amaranth-lang.github.io that adds this JavaScript file to all past versions of the documentation, together with the initial version of the `versions.json` file.
合并状态:未合并 3 条评论