From d0fe56f4e98fa552c5e271713a815d2382e614f7 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sun, 29 Sep 2024 10:11:35 +0200 Subject: feat(templates): Provide a consistent syntax for replacements All replacements now start with `lpm::` and thus provide a future way to extend them. This change also adds the ability to access the chapter name in a new section and the current data in a new chapter. --- src/new/chapter.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/new/chapter.rs') diff --git a/src/new/chapter.rs b/src/new/chapter.rs index 887855b..fcc075d 100644 --- a/src/new/chapter.rs +++ b/src/new/chapter.rs @@ -7,7 +7,7 @@ use crate::{ file_tree::{FileTree, GeneratedFile}, }; -use super::MangledName; +use super::{replacement::untemplatize_chapter, MangledName}; pub struct ChapterName { name: MangledName, @@ -125,10 +125,7 @@ fn new_chapter_file( project_root: &Path, last_chapter_number: u32, ) -> GeneratedFile { - let chapter_text = config - .templates - .chapter - .replace("REPLACEMENT_CHAPTER", &name); + let chapter_text = untemplatize_chapter(&config.templates.chapter, &name); GeneratedFile::new( project_root -- cgit 1.4.1