docs: bring docforge docstrings and wiki to GSDFC standard
- fix GSDFC spec contradictions in __init__ docstring (parenthesized types, fenced-block rule) and sync generated README - rewrite docstrings across loaders, models, nav, servers, renderers, cli; sync .pyi stubs - add pydoclint (google style) gate to dev extras and pyproject config - fix mcp nav resources doc:// -> docs:// - refresh docs/lib and docs/mcp, drop stale docforge/ duplicate group - update wiki pages and add GSDFC + MCP guides under 05_development
This commit is contained in:
@@ -4,8 +4,19 @@ Navigation specification model.
|
||||
This module defines the ``NavSpec`` class, which represents the navigation
|
||||
structure defined by the user in the doc-forge navigation specification
|
||||
(typically ``docforge.nav.yml``).
|
||||
|
||||
---
|
||||
|
||||
Notes:
|
||||
- The spec file supports an optional ``icon`` mapping for MkDocs theme
|
||||
customization.
|
||||
- All file references in ``groups`` are relative to the documentation root.
|
||||
|
||||
---
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
@@ -38,10 +49,13 @@ class NavSpec:
|
||||
Initialize a NavSpec instance.
|
||||
|
||||
Args:
|
||||
home: Relative path to the home document.
|
||||
groups: Mapping of group names to lists of path patterns
|
||||
home (str | None):
|
||||
Relative path to the home document.
|
||||
groups (dict[str, list[str]]):
|
||||
Mapping of group names to lists of path patterns
|
||||
(glob expressions).
|
||||
icon: Optional mapping of theme icon entries applied to the
|
||||
icon (dict[str, str] | None):
|
||||
Optional mapping of theme icon entries applied to the
|
||||
generated MkDocs configuration.
|
||||
"""
|
||||
self.home = home
|
||||
@@ -49,15 +63,17 @@ class NavSpec:
|
||||
self.icon = icon
|
||||
|
||||
@classmethod
|
||||
def load(cls, path: Path) -> "NavSpec":
|
||||
def load(cls, path: Path) -> NavSpec:
|
||||
"""
|
||||
Load a navigation specification from a YAML file.
|
||||
|
||||
Args:
|
||||
path: Filesystem path to the navigation specification file.
|
||||
path (Path):
|
||||
Filesystem path to the navigation specification file.
|
||||
|
||||
Returns:
|
||||
A ``NavSpec`` instance representing the parsed configuration.
|
||||
NavSpec:
|
||||
A ``NavSpec`` instance representing the parsed configuration.
|
||||
|
||||
Raises:
|
||||
FileNotFoundError: If the specified file does not exist.
|
||||
@@ -105,8 +121,9 @@ class NavSpec:
|
||||
Return all path patterns referenced by the specification.
|
||||
|
||||
Returns:
|
||||
A list containing the home document (if defined) and all
|
||||
group pattern entries.
|
||||
list[str]:
|
||||
A list containing the home document (if defined) and all
|
||||
group pattern entries.
|
||||
"""
|
||||
patterns: list[str] = []
|
||||
|
||||
@@ -127,10 +144,12 @@ def load_nav_spec(path: Path) -> NavSpec:
|
||||
corresponding ``NavSpec`` instance.
|
||||
|
||||
Args:
|
||||
path: Path to the navigation specification file.
|
||||
path (Path):
|
||||
Path to the navigation specification file.
|
||||
|
||||
Returns:
|
||||
A ``NavSpec`` instance representing the parsed specification.
|
||||
NavSpec:
|
||||
A ``NavSpec`` instance representing the parsed specification.
|
||||
|
||||
Raises:
|
||||
FileNotFoundError: If the specification file does not exist.
|
||||
|
||||
Reference in New Issue
Block a user