From 800ffaf658c3defe165dd24c3ecd65ceabc7096a Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sun, 29 Sep 2024 11:48:59 +0200 Subject: feat(new/figure)!: Init BREAKING CHANGE: The config file now needs to contain an `templates.figure` key. You can simply add this. --- src/new/replacement.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/new/replacement.rs') diff --git a/src/new/replacement.rs b/src/new/replacement.rs index 6878e61..0e9f27f 100644 --- a/src/new/replacement.rs +++ b/src/new/replacement.rs @@ -4,7 +4,7 @@ use chrono::{Local, TimeDelta, TimeZone}; use log::debug; use crate::constants::{ - DATE, REPLACEMENT_CHAPTER, REPLACEMENT_CHAPTER_SECTION, REPLACMENT_SECTION_TITLE, + DATE, REPLACEMENT_CHAPTER, REPLACEMENT_CHAPTER_SECTION, REPLACEMENT_FIGURE, REPLACMENT_SECTION, }; fn get_current_date() -> String { @@ -36,7 +36,7 @@ fn get_current_date() -> String { pub fn untemplatize_section(input: &str, new_section_name: &str, new_chapter_name: &str) -> String { input .replace(REPLACEMENT_CHAPTER_SECTION, &new_chapter_name) - .replace(REPLACMENT_SECTION_TITLE, &new_section_name) + .replace(REPLACMENT_SECTION, &new_section_name) .replace(DATE, &get_current_date()) } @@ -45,3 +45,8 @@ pub fn untemplatize_chapter(input: &str, new_chapter_name: &str) -> String { .replace(REPLACEMENT_CHAPTER, &new_chapter_name) .replace(DATE, &get_current_date()) } +pub fn untemplatize_figure(input: &str, new_figure_name: &str) -> String { + input + .replace(REPLACEMENT_FIGURE, &new_figure_name) + .replace(DATE, &get_current_date()) +} -- cgit 1.4.1