Classes
TemplateRegistry
Registry for discovering and managing site templates.
The registry scans the sibling directories o…
TemplateRegistry
Registry for discovering and managing site templates.
The registry scans the sibling directories of this file for template
packages that expose aTEMPLATEvariable.
Methods 3
get
Get a template by its identifier.
get
def get(self, template_id: str) -> SiteTemplate | None
Get a template by its identifier.
Parameters 1
template_id |
str |
The template ID (e.g. |
Returns
The matching :class:SiteTemplate | None
— SiteTemplateorNoneif not found.
list
List all templates as ``(id, description)`` tuples.
list
def list(self) -> list[tuple[str, str]]
List all templates as(id, description)tuples.
Returns
list[tuple[str, str]]
exists
Return True if a template with ``template_id`` exists.
exists
def exists(self, template_id: str) -> bool
Return True if a template withtemplate_idexists.
Parameters 1
template_id |
str |
Returns
bool
Internal Methods 4
__init__
__init__
def __init__(self) -> None
_discover_templates
Discover all available templates in the built‑in package tree.
Prefers skeleto…
_discover_templates
def _discover_templates(self) -> None
Discover all available templates in the built‑in package tree.
Prefers skeleton.yaml manifests when available, falls back to Python templates.
_load_skeleton_template
Load a template from a skeleton manifest.
_load_skeleton_template
def _load_skeleton_template(self, skeleton_path: Path, template_id: str) -> SiteTemplate | None
Load a template from a skeleton manifest.
Parameters 2
skeleton_path |
Path |
Path to skeleton.yaml file |
template_id |
str |
Template identifier (directory name) |
Returns
SiteTemplate instance or None if loading failsSiteTemplate | None
—
_skeleton_to_site_template
Convert a Skeleton manifest to a SiteTemplate.
_skeleton_to_site_template
def _skeleton_to_site_template(self, skeleton: Skeleton, template_id: str) -> SiteTemplate
Convert a Skeleton manifest to a SiteTemplate.
Parameters 2
skeleton |
Skeleton |
Skeleton instance from manifest |
template_id |
str |
Template identifier |
Returns
SiteTemplate instanceSiteTemplate
—
Functions
_get_registry
Get or create the global registry instance (singleton).
_get_registry
def _get_registry() -> TemplateRegistry
Get or create the global registry instance (singleton).
Returns
TemplateRegistry
get_template
Convenience wrapper to get a template by ID from the global registry.
get_template
def get_template(template_id: str) -> SiteTemplate | None
Convenience wrapper to get a template by ID from the global registry.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
template_id |
str |
— |
Returns
SiteTemplate | None
list_templates
Convenience wrapper to list all available templates.
list_templates
def list_templates() -> list[tuple[str, str]]
Convenience wrapper to list all available templates.
Returns
list[tuple[str, str]]
register_template
Register a custom template with the global registry.
This allows applications and plugins to add t…
register_template
def register_template(template: SiteTemplate) -> None
Register a custom template with the global registry.
This allows applications and plugins to add templates at runtime.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
template |
SiteTemplate |
— |