MCPcopy Index your code
hub / github.com/mkdocs/mkdocs / nest_paths

Function nest_paths

mkdocs/utils/__init__.py:338–355  ·  view source on GitHub ↗

Given a list of paths, convert them into a nested structure that will match the pages config.

(paths)

Source from the content-addressed store, hash-verified

336
337
338def nest_paths(paths):
339 """
340 Given a list of paths, convert them into a nested structure that will match
341 the pages config.
342 """
343 nested = []
344
345 for path in paths:
346 parts = PurePath(path).parent.parts
347
348 branch = nested
349 for part in parts:
350 part = dirname_to_title(part)
351 branch = find_or_create_node(branch, part)
352
353 branch.append(path)
354
355 return nested
356
357
358class DuplicateFilter:

Callers 1

get_navigationFunction · 0.90

Calls 3

dirname_to_titleFunction · 0.85
find_or_create_nodeFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…