Skip to content

Commit

Permalink
Generate documentation redirects for lowercase rule codes (#15564)
Browse files Browse the repository at this point in the history
## 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
```
  • Loading branch information
InSyncWithFoo authored Jan 18, 2025
1 parent 9d845ec commit 9730ff3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions scripts/generate_mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import shutil
import subprocess
from collections.abc import Sequence
from itertools import chain
from pathlib import Path
from typing import NamedTuple

Expand Down Expand Up @@ -257,10 +258,18 @@ def main() -> None:
config["plugins"].append(
{
"redirects": {
"redirect_maps": {
f"rules/{rule['code']}.md": f"rules/{rule['name']}.md"
for rule in rules
},
"redirect_maps": dict(
chain.from_iterable(
[
(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
)
),
},
},
)
Expand Down

0 comments on commit 9730ff3

Please sign in to comment.