vibe.appendices¶
Appendices System for VIBE.
This module implements the core appendices functionality that allows templates to generate separate documents like appendices, annexes, or schedules.
Key Components: - AppendixReference: Lightweight reference object returned by appendix() calls - AppendixManager: Request-scoped manager for tracking and numbering appendices
Note: the user-facing appendix() function is in functions.py alongside insert()2
AppendixReference ¶
Lightweight reference object returned by appendix() calls.
Provides access to appendix properties like numbering and label through the appendix manager.
This object is what template authors get when they call:
AppendixManager ¶
Request-scoped manager for tracking appendices and calculating numbering.
This manager: - Tracks all appendices registered during template rendering - Builds a tree structure for hierarchical numbering - Calculates numbering schemes once after template completion - Caches numbering results for fast O(1) lookups - Detects circular dependencies - Stores rendered content for each appendix
__init__ ¶
__init__(numbering_style: str = 'alpha') -> None
Initialize the appendix manager.
| Parameters: |
|
|---|
register_appendix ¶
register_appendix(appendix_ref: AppendixReference) -> None
Register an appendix with the manager.
| Parameters: |
|
|---|
| Raises: |
|
|---|
get_numbering ¶
get_numbering(alias: str) -> str
Get the hierarchical numbering for an appendix.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_label ¶
get_label(alias: str) -> str
Get the label for an appendix from its component configuration.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_all_appendices ¶
get_all_appendices() -> list[AppendixReference]
Get all registered appendices in registration order.
get_root_appendices ¶
get_root_appendices() -> list[AppendixReference]
Get root appendices (no parent) in registration order.
get_children ¶
get_children(parent_alias: str) -> list[AppendixReference]
Get child appendices for a given parent.
set_rendered_content ¶
set_rendered_content(alias: str, content: str) -> None
Store rendered content for an appendix.
get_rendered_content ¶
get_rendered_content(alias: str) -> str | None
Get rendered content for an appendix.
get_appendix_manager ¶
get_appendix_manager() -> AppendixManager
Get the current request's appendix manager, creating one if needed.
| Returns: |
|
|---|
clear_appendix_manager ¶
clear_appendix_manager() -> None
Clear the current request's appendix manager (for testing).