From 8db6eb1a838dd31a12fa2bd14e79d4fb5c70975c Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Tue, 17 Feb 2026 09:27:04 +0100 Subject: [PATCH] Dynamically issues version in `rheo init` template --- src/rs/init.rs | 5 +++-- src/templates/init/rheo.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rs/init.rs b/src/rs/init.rs index c29a1ab..46ef2da 100644 --- a/src/rs/init.rs +++ b/src/rs/init.rs @@ -42,9 +42,10 @@ pub fn init_project(path: &Path) -> Result<()> { fs::create_dir_all(path.join("content/img")) .map_err(|e| crate::RheoError::io(e, "creating content/img directory"))?; - // Write template files + // Write template files, replacing version placeholder in rheo.toml + let rheo_toml = RHEO_TOML.replace("{{VERSION}}", env!("CARGO_PKG_VERSION")); let files: &[(&str, &str)] = &[ - ("rheo.toml", RHEO_TOML), + ("rheo.toml", &rheo_toml), ("style.css", STYLE_CSS), ("content/index.typ", INDEX_TYP), ("content/about.typ", ABOUT_TYP), diff --git a/src/templates/init/rheo.toml b/src/templates/init/rheo.toml index a213c61..2f4d389 100644 --- a/src/templates/init/rheo.toml +++ b/src/templates/init/rheo.toml @@ -1,4 +1,4 @@ -version = "0.1.1" +version = "{{VERSION}}" content_dir = "content" [pdf.spine]