-
Notifications
You must be signed in to change notification settings - Fork 117
Open
Labels
Description
Currently, page_sidebar() and page_navbar() take an explicit sidebar argument.
However, for page_auto(), which is used in Express mode, there's no sidebar argument (because children can't be passed as named arguments in Express). Instead, we inspect the *args, pull out any Sidebar objects, and then explicitly pass them to the sidebar argument.
Lines 529 to 530 in a020af6
| page_fn = page_sidebar # pyright: ignore[reportGeneralTypeIssues] | |
| args = tuple(sidebars + [x for x in args if x not in sidebars]) |
Also, because of how Python handles named and unnamed ages:
- For
page_sidebar(), the signature ispage_sidebar(sidebar, *args). This means that the sidebar must be the first argument and must not be named. - For
page_navbar(), the signature ispage_navbar(*args, sidebar). This means that the sidebar must not be the first argument, and must be named.
I think we should remove the sidebar parameter from these functions and simply inspect the *args for Sidebar objects -- essentially, take the logic from page_auto() and move it into page_sidebar() and page_navbar().