From a30559c72296680dc3b6de5c878e74e4a7f3712e Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 29 Jun 2026 04:08:35 +0800 Subject: chore: add package metadata and symlinks for publishing Centralize package metadata in the workspace `Cargo.toml` and inherit it in sub-crates. Add license symlinks and README symlinks to the workspace root. Set `documentation` URLs for library crates. --- Cargo.lock | 13 +++++- Cargo.toml | 9 +++- just_template/Cargo.toml | 8 +++- just_template/LICENSE-APACHE | 1 + just_template/LICENSE-MIT | 1 + just_template/README.md | 1 + just_template_macros/Cargo.toml | 8 ++++ just_template_macros/LICENSE-APACHE | 1 + just_template_macros/LICENSE-MIT | 1 + just_template_macros/README.md | 93 +++++++++++++++++++++++++++++++++++++ 10 files changed, 132 insertions(+), 4 deletions(-) create mode 120000 just_template/LICENSE-APACHE create mode 120000 just_template/LICENSE-MIT create mode 120000 just_template/README.md create mode 120000 just_template_macros/LICENSE-APACHE create mode 120000 just_template_macros/LICENSE-MIT create mode 100644 just_template_macros/README.md diff --git a/Cargo.lock b/Cargo.lock index 2560cb5..06e13d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,7 +13,7 @@ name = "just_template" version = "0.2.0" dependencies = [ "just_fmt", - "just_template_macros", + "just_template_macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -25,6 +25,17 @@ dependencies = [ "syn", ] +[[package]] +name = "just_template_macros" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1471eb68722ecefeb71debdde2859e8725341f171d3f42b3a98a0862ad19416e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "proc-macro2" version = "1.0.106" diff --git a/Cargo.toml b/Cargo.toml index b0aed88..fab3550 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,13 @@ description = "A tool for code gen via templatese" authors = ["Weicao-CatilGrass "] edition = "2024" +homepage = "https://github.com/catilgrass/just_template" +repository = "https://github.com/catilgrass/just_template" +license = "MIT OR Apache-2.0" +keywords = ["template", "code-generation", "codegen"] +categories = ["template-engine"] + [workspace.dependencies] just_template = { path = "just_template" } -just_template_macros = { path = "just_template_macros" } +just_template_macros = "0.2.0" +# just_template_macros = { path = "just_template_macros" } diff --git a/just_template/Cargo.toml b/just_template/Cargo.toml index 1536e0b..c791b43 100644 --- a/just_template/Cargo.toml +++ b/just_template/Cargo.toml @@ -4,10 +4,14 @@ version.workspace = true description.workspace = true authors.workspace = true edition.workspace = true +homepage.workspace = true +repository.workspace = true +license.workspace = true +keywords.workspace = true +categories.workspace = true readme = "README.md" -license = "MIT OR Apache-2.0" -repository = "https://github.com/catilgrass/just_template" +documentation = "https://docs.rs/just_template" [dependencies] just_template_macros.workspace = true diff --git a/just_template/LICENSE-APACHE b/just_template/LICENSE-APACHE new file mode 120000 index 0000000..e2a4dc6 --- /dev/null +++ b/just_template/LICENSE-APACHE @@ -0,0 +1 @@ +D:/just_template/LICENSE-APACHE \ No newline at end of file diff --git a/just_template/LICENSE-MIT b/just_template/LICENSE-MIT new file mode 120000 index 0000000..fa1766a --- /dev/null +++ b/just_template/LICENSE-MIT @@ -0,0 +1 @@ +D:/just_template/LICENSE-MIT \ No newline at end of file diff --git a/just_template/README.md b/just_template/README.md new file mode 120000 index 0000000..7f83ffb --- /dev/null +++ b/just_template/README.md @@ -0,0 +1 @@ +D:/just_template/README.md \ No newline at end of file diff --git a/just_template_macros/Cargo.toml b/just_template_macros/Cargo.toml index c033d1b..894c5f2 100644 --- a/just_template_macros/Cargo.toml +++ b/just_template_macros/Cargo.toml @@ -4,6 +4,14 @@ version.workspace = true description.workspace = true authors.workspace = true edition.workspace = true +homepage.workspace = true +repository.workspace = true +license.workspace = true +keywords.workspace = true +categories.workspace = true + +readme = "README.md" +documentation = "https://docs.rs/just_template_macros" [lib] proc-macro = true diff --git a/just_template_macros/LICENSE-APACHE b/just_template_macros/LICENSE-APACHE new file mode 120000 index 0000000..e2a4dc6 --- /dev/null +++ b/just_template_macros/LICENSE-APACHE @@ -0,0 +1 @@ +D:/just_template/LICENSE-APACHE \ No newline at end of file diff --git a/just_template_macros/LICENSE-MIT b/just_template_macros/LICENSE-MIT new file mode 120000 index 0000000..fa1766a --- /dev/null +++ b/just_template_macros/LICENSE-MIT @@ -0,0 +1 @@ +D:/just_template/LICENSE-MIT \ No newline at end of file diff --git a/just_template_macros/README.md b/just_template_macros/README.md new file mode 100644 index 0000000..a45d77d --- /dev/null +++ b/just_template_macros/README.md @@ -0,0 +1,93 @@ +# just_template_macros + +> Proc-macro crate for [`just_template`](https://crates.io/crates/just_template). +> Provides the `tmpl!` macro. + +## `tmpl!` macro + +A unified macro for setting both simple parameters and implementation blocks +on a [`Template`](https://docs.rs/just_template). + +### Simple parameters + +```rust +use just_template::{Template, tmpl}; + +let mut tmpl = Template::from("Hello, <<>>!".to_string()); + +tmpl!(tmpl, name = "World"); +// or, when the variable is named `tmpl`: +tmpl! { name = "World" }; + +assert_eq!(tmpl.expand().unwrap(), "Hello, World!"); +``` + +### Implementation blocks with arms + +```rust +use just_template::{Template, tmpl}; + +let mut tmpl = Template::from(r#" +>>>>>>>>>> arms +@@@ >>> arms + <<>> => println!("<<>>"), +@@@ <<< +"#.trim().to_string()); + +tmpl! { + arms { + value = "a", + value = "b", + } +}; + +let out = tmpl.expand().unwrap(); +// out contains: +// a => println!("a"), +// b => println!("b"), +``` + +### Mixed with multi-param arms + +```rust +use just_template::{Template, tmpl}; + +let mut tmpl = Template::from(r#" +>>>>>>>>>> arms +@@@ >>> arms + <<>>: <<>> +??? >>> extra + <<>>.extra() +??? <<< +@@@ <<< +"#.trim().to_string()); + +tmpl! { + arms { + name = "foo", value = "1", + { + name = "bar", + value = "2", + extra = "" // enables the `extra` display block for this arm + } + } +}; + +let out = tmpl.expand().unwrap(); +// out contains: +// foo: 1 +// bar: 2 +// bar.extra() +``` + +### Call forms + +| Form | Example | Template variable | +|---|---|---| +| Explicit | `tmpl!(tmpl, key = val)` | First argument | +| Implicit | `tmpl! { key = val }` | Defaults to `tmpl` | + +Both forms accept the same body syntax: simple params (`key = val`), +implementation blocks (`name { arms }`), or a mix of both. + +For more details, see the [`just_template` documentation](https://docs.rs/just_template). -- cgit