Resolver
docforge.nav.resolver
This module contains the logic for resolving a NavSpec against the physical filesystem. It expands globs and validates that all referenced documents actually exist on disk.
ResolvedNav
ResolvedNav(home: str | None, groups: Dict[str, List[Path]], docs_root: Path | None = None)
Represents a navigation structure where all patterns and paths have been resolved against the actual filesystem contents.
Attributes:
| Name | Type | Description |
|---|---|---|
home |
Optional[str]
|
Resolved relative path to the home page. |
groups |
Dict[str, List[Path]]
|
Mapping of group titles to lists of absolute or relative Path objects. |
Initialize a ResolvedNav instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
home |
str | None
|
The relative path to the project home page. |
required |
groups |
Dict[str, List[Path]]
|
A mapping of group names to their resolved filesystem paths. |
required |
docs_root |
Path | None
|
The root documentation directory. |
None
|
all_files
all_files() -> Iterable[Path]
Get an iterable of all resolved files in the navigation structure.
Returns:
| Type | Description |
|---|---|
Iterable[Path]
|
An iterable of Path objects. |
resolve_nav
resolve_nav(spec: NavSpec, docs_root: Path) -> ResolvedNav
Create a ResolvedNav by processing a NavSpec against the filesystem. This expands globs and validates the existence of referenced files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec |
NavSpec
|
The navigation specification to resolve. |
required |
docs_root |
Path
|
The root directory for documentation files. |
required |
Returns:
| Type | Description |
|---|---|
ResolvedNav
|
A ResolvedNav instance. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If a pattern doesn't match any files or the docs_root doesn't exist. |