1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Template-to-file-tree generation system
//!
//! This module provides functionality for generating complete file trees from templates
//! with support for RDF annotations, variable substitution, and directory structure
//! creation. It enables generating entire project structures from declarative templates.
//!
//! ## Features
//!
//! - **File Tree Generation**: Generate complete directory structures from templates
//! - **RDF Annotations**: Template metadata stored in RDF format
//! - **Variable Substitution**: Dynamic path and content generation
//! - **Template Formats**: Support for multiple template formats (YAML, TOML, JSON)
//! - **Frozen Sections**: Preserve manual edits in generated files
//! - **Business Logic Separation**: Separate template structure from business logic
//! - **Tera Integration**: Full integration with Tera template engine
//!
//! ## Template Format
//!
//! Templates can be defined in YAML, TOML, or JSON format with support for:
//! - File and directory nodes
//! - Inline content or template file references
//! - Variable substitution in paths and content
//! - RDF metadata annotations
//! - Frozen section markers for manual edits
//!
//! ## Examples
//!
//! ### Generating a File Tree
//!
//! ```rust,no_run
//! use crate::templates::{generate_file_tree, TemplateContext};
//! use std::path::Path;
//!
//! # fn main() -> crate::utils::error::Result<()> {
//! let template_path = Path::new("project.tree.toml");
//! let output_dir = Path::new("output");
//! let mut ctx = TemplateContext::new();
//! ctx.insert("project_name", "my-app");
//!
//! let result = generate_file_tree(template_path, output_dir, &ctx)?;
//! println!("Generated {} files", result.files_created);
//! # Ok(())
//! # }
//! ```
//!
//! ### Using Template Parser
//!
//! ```rust,no_run
//! use crate::templates::{TemplateParser, TemplateFormat};
//! use std::path::Path;
//!
//! # fn main() -> crate::utils::error::Result<()> {
//! let parser = TemplateParser::new();
//! let template = parser.parse_file(Path::new("project.tree.toml"), TemplateFormat::Toml)?;
//!
//! println!("Template has {} nodes", template.nodes.len());
//! # Ok(())
//! # }
//! ```
pub use BusinessLogicSeparator;
pub use TemplateContext;
pub use ;
pub use ;
pub use ;
pub use ;