summary refs log tree commit diff stats
path: root/src/new/mod.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/mod.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/mod.rs')
-rw-r--r--src/new/mod.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/new/mod.rs b/src/new/mod.rs
index 8d8193c..04b75ef 100644
--- a/src/new/mod.rs
+++ b/src/new/mod.rs
@@ -4,6 +4,7 @@ use convert_case::{Case, Casing};
 use deunicode::deunicode;
 
 pub mod chapter;
+pub mod replacement;
 pub mod section;
 
 #[derive(PartialEq, Eq, PartialOrd, Ord)]
@@ -29,6 +30,10 @@ impl MangledName {
     pub fn as_str(&self) -> &str {
         &self.0
     }
+
+    pub fn try_unmangle(self) -> String {
+        self.0.to_case(Case::Title)
+    }
 }
 impl Display for MangledName {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {