aboutsummaryrefslogtreecommitdiff
path: root/just_template/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'just_template/src/lib.rs')
-rw-r--r--just_template/src/lib.rs60
1 files changed, 8 insertions, 52 deletions
diff --git a/just_template/src/lib.rs b/just_template/src/lib.rs
index 7ff77f5..2b4f986 100644
--- a/just_template/src/lib.rs
+++ b/just_template/src/lib.rs
@@ -1,58 +1,14 @@
//! Template struct for storing template strings and their parameters.
-//!
-//! The template supports two types of parameters:
-//! - Simple parameters: key-value pairs used to replace simple placeholders (`<<<key>>>` format) in the template.
-//! - Implementation parameters: for implementation blocks (`>>>>>>>>> block_name` and `@@@ >>> block_name` format),
-//! can contain multiple parameter sets, each corresponding to an implementation instance.
-//!
-//! # Examples
-//! ```
-//! use just_template::Template;
-//!
-//! let mut tmpl = Template::from("Hello, <<<name>>>!".to_string());
-//! tmpl.insert_param("name".to_string(), "World".to_string());
-//! assert_eq!(tmpl.to_string(), "Hello, World!");
-//! ```
-//!
-//! Using the `tmpl_param!` macro makes it easier to add simple parameters:
-//! ```
-//! use just_template::{Template, tmpl_param};
-//!
-//! let mut tmpl = Template::from("<<<a>>> + <<<b>>> = <<<c>>>".to_string());
-//! tmpl_param!(tmpl, a = 1, b = 2, c = 3);
-//! assert_eq!(tmpl.to_string(), "1 + 2 = 3");
-//! ```
-//!
-//! Using the `tmpl!` macro adds implementation block parameters:
-//! ```
-//! use just_template::{Template, tmpl};
-//!
-//! let mut tmpl = Template::from("
-//! >>>>>>>>>> arms
-//! @@@ >>> arms
-//! <<<crate_name>>> => Some(<<<crate_name>>>::exec(data, params).await),
-//! @@@ <<<
-//! ".trim().to_string());
-//! tmpl!(tmpl,
-//! arms {
-//! crate_name = "my",
-//! crate_name = "you",
-//! }
-//! );
-//! // Output the expanded template
-//! let expanded = tmpl.to_string();
-//! assert_eq!(expanded, "
-//! my => Some(my::exec(data, params).await),
-//! you => Some(you::exec(data, params).await),
-//! ".trim().to_string());
-//! ```
+
+mod expand;
+
mod template;
-pub use template::*; // Re-export template to just_template
+pub use template::*; // Re-export template
-pub mod expand;
+pub use just_template_macros::*; // Re-export macros
#[cfg(test)]
-pub mod test;
+pub mod test_expand;
-#[deprecated]
-pub mod deprecated;
+#[cfg(test)]
+pub mod test_macros;