Generate documentation redirects for lowercase rule codes (#15564)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions

## Summary

Resolves #15016.

## Test Plan

Generate the docs with:

```console
uv run --with-requirements docs/requirements-insiders.txt scripts/generate_mkdocs.py
```

and, check whether the mapping was created in `mkdocs.generated.yml` and run the server using:

```console
uvx --with-requirements docs/requirements-insiders.txt -- mkdocs serve -f mkdocs.insiders.yml -o
```
This commit is contained in:
InSync 2025-01-18 11:39:23 +07:00 committed by GitHub
parent 9d845ec8f5
commit 9730ff3a25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,7 @@ import re
import shutil import shutil
import subprocess import subprocess
from collections.abc import Sequence from collections.abc import Sequence
from itertools import chain
from pathlib import Path from pathlib import Path
from typing import NamedTuple from typing import NamedTuple
@ -257,10 +258,18 @@ def main() -> None:
config["plugins"].append( config["plugins"].append(
{ {
"redirects": { "redirects": {
"redirect_maps": { "redirect_maps": dict(
f"rules/{rule['code']}.md": f"rules/{rule['name']}.md" chain.from_iterable(
for rule in rules [
}, (f"rules/{rule['code']}.md", f"rules/{rule['name']}.md"),
(
f"rules/{rule['code'].lower()}.md",
f"rules/{rule['name']}.md",
),
]
for rule in rules
)
),
}, },
}, },
) )