Configuration Loading
Configuration Loading
Section titled “Configuration Loading”Vyasac uses a layered configuration system to allow global defaults to be overridden by local folder settings.
Loading Order (Precedence)
Section titled “Loading Order (Precedence)”When compiling a file, the environment is built in this order (last one wins):
- Workspace Root
vyasac.toml: Global settings (e.g. Project Title, default structure). - Workspace Root
context.vy: Global definitions (Entities, Templates, Custom Commands). - Local
vyasac.toml: Folder-specific settings. - Local
context.vy: Folder-specific definitions. - In-File Definitions:
command-deforsetcommands at the top of the file.
Logic: config.rs
Section titled “Logic: config.rs”The apply_definitions function maps configuration nodes to the VyasaEnvironment. It handles:
command-def: Registers new commands (metadata, validation rules).alias-def: Creates shortcuts (e.g.p->paragraph).set entities: Populates the Entity Registry.set settings: Updates compiler flags (e.g.whitespace="preserve").
Structural vs Metadata
Section titled “Structural vs Metadata”- Flow Commands: If a command is defined with
category="flow"(e.g.chapter), encountering it updates the Context Stack (e.g.chapter.id=1). - URN Generation: If
urn="true", the command gets a unique ID generated from the active context and scheme.