Skip to content

Commit 005c1fe

Browse files
committed
Refactor section title handling to use instance checks for improved clarity
1 parent 25e22b9 commit 005c1fe

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@ jobs:
114114
- name: Run repository checks
115115
if: always()
116116
run: pre-commit run --all-files --show-diff-on-failure
117-
- name: Check with mypy
118-
if: always()
119-
run: hatch run types:check
120117

121118
package:
122119
runs-on: ubuntu-latest

mkdocs/structure/nav.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def _get_by_type(nav, t: type[T]) -> list[T]:
254254

255255
def _add_parent_links(nav) -> None:
256256
for item in nav:
257-
if item.is_section:
257+
if isinstance(item, Section):
258258
for child in item.children:
259259
child.parent = item
260260
_add_parent_links(item.children)
@@ -281,10 +281,10 @@ def _set_section_titles_from_index_pages(items: list[StructureItem]) -> None:
281281
been read/rendered, so its title is known from metadata or headings).
282282
"""
283283
for item in items:
284-
if not item.is_section:
284+
if not isinstance(item, Section):
285285
continue
286286
for child in item.children:
287-
if child.is_page and child.is_index and child.title is not None:
287+
if isinstance(child, Page) and child.is_index and child.title is not None:
288288
item.title = child.title
289289
break
290290
_set_section_titles_from_index_pages(item.children)

0 commit comments

Comments
 (0)