summary refs log tree commit diff stats
path: root/src/new/chapter.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-09-29 10:11:35 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-09-29 10:11:35 +0200
commitd0fe56f4e98fa552c5e271713a815d2382e614f7 (patch)
tree5564085c201fdac129e96fa6036c3da0b1c11a0b /src/new/chapter.rs
parentfeat(bundle): Support bundling a document into one TeX file (diff)
downloadlpm-d0fe56f4e98fa552c5e271713a815d2382e614f7.tar.gz
lpm-d0fe56f4e98fa552c5e271713a815d2382e614f7.zip
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.
Diffstat (limited to 'src/new/chapter.rs')
-rw-r--r--src/new/chapter.rs7
1 files changed, 2 insertions, 5 deletions
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