blob: 3099f94da16c453c1d017a2b9e9d18643545e8bf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
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<FileTree> {
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)
}
|