aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-29 03:31:44 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-29 03:31:44 +0800
commitff70307869a547b13850d1eec3f72e8ca3bca265 (patch)
treea6cc55e7cb993697dce95b3d449538ec296693fc /src/lib.rs
parent03003aec99fc00c2a079bad9fb4e721432a6e6f0 (diff)
feat: add display block support and refactor tests
Deprecate old macros in favor of new deprecated module, replace the external file-based test with inline unit tests, and introduce the `??? >>>` / `??? <<<` display block syntax for conditional content inclusion per arm or globally.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs49
1 files changed, 4 insertions, 45 deletions
diff --git a/src/lib.rs b/src/lib.rs
index cf9d66e..7ff77f5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -50,50 +50,9 @@ mod template;
pub use template::*; // Re-export template to just_template
pub mod expand;
-pub mod test;
-
-#[macro_export]
-macro_rules! tmpl_param {
- ($template:ident, $($key:ident = $value:expr),* $(,)?) => {{
- $(
- $template.insert_param(stringify!($key).to_string(), $value.to_string());
- )*
- }};
-}
-#[macro_export]
-macro_rules! tmpl {
- ($template:ident, $($name:ident {
- $($key:ident = $value:expr),* $(,)?
- }),* $(,)?) => {{
- $(
- let $name = $template.add_impl(stringify!($name).to_string());
- $(
- $name.push({
- let mut params = std::collections::HashMap::new();
- params.insert(stringify!($key).to_string(), $value.to_string());
- params
- });
- )*
- )*
- }};
+#[cfg(test)]
+pub mod test;
- // Old syntax
- ($template:ident += {
- $($name:ident {
- $(($($key:ident = $value:expr),* $(,)?)),*
- $(,)?
- }),*
- }) => {{
- $(
- let $name = $template.add_impl(stringify!($name).to_string());
- $(
- $name.push({
- let mut params = std::collections::HashMap::new();
- $(params.insert(stringify!($key).to_string(), $value.to_string());)*
- params
- });
- )*
- )*
- }};
-}
+#[deprecated]
+pub mod deprecated;