Skip to content

Commit

Permalink
Merge pull request #13 from harishmohanraj/sort-api-reference
Browse files Browse the repository at this point in the history
Sort the API reference navigation
  • Loading branch information
harishmohanraj authored Dec 18, 2024
2 parents 6c50e15 + 87b9282 commit b0fa589
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions website/process_api_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,20 @@ def create_nav_structure(paths: List[str], parent_groups: List[str] = None) -> L
subpath = "/".join(parts[1:])
groups.setdefault(group, []).append(subpath)

result = [
# Sort directories and create their structures
sorted_groups = [
{
"group": ".".join(parent_groups + [group]) if parent_groups else group,
"pages": create_nav_structure(subpaths, parent_groups + [group]),
}
for group, subpaths in groups.items()
] + pages
for group, subpaths in sorted(groups.items())
]

return result
# Sort pages
sorted_pages = sorted(pages)

# Return directories first, then files
return sorted_groups + sorted_pages


def update_nav(mint_json_path: Path, new_nav_pages: List[Any]) -> None:
Expand Down

0 comments on commit b0fa589

Please sign in to comment.