use std::path::Path; use crate::{ config_file::Config, file_tree::{FileTree, GeneratedFile}, }; use super::{replacement::untemplatize_figure, MangledName}; pub fn generate_new_figure( config: &Config, name: String, project_root: &Path, ) -> anyhow::Result { let mut file_tree = FileTree::new(); let new_figure_text = untemplatize_figure(&config.templates.figure, &name); file_tree.add_file(GeneratedFile::new_clobber( project_root .join("figures") .join(format!("{}.tex", MangledName::new(&name))), new_figure_text, false, )); Ok(file_tree) }