Fix issue with numbers

This commit is contained in:
2023-02-06 10:03:51 +01:00
parent 805b46e164
commit 07a955e654
2 changed files with 20 additions and 2 deletions

View File

@ -138,10 +138,28 @@ fn tex_export_inner(tree: &ObjectChild, out: &mut String, required: bool) {
.unwrap();
}
fn tex_adapt_name(i: &str) -> String {
i.replace('0', "zero")
.replace('1', "one")
.replace('2', "two")
.replace('3', "three")
.replace('4', "four")
.replace('5', "five")
.replace('6', "six")
.replace('7', "seven")
.replace('8', "height")
.replace('9', "nine")
}
fn tex_export(tree: &TreeNode) -> String {
let mut out = String::new();
writeln!(out, "% START OF EXPORT OF SCHEMA {}", tree.name).unwrap();
writeln!(out, "\\newcommand{{\\schemadef{}}}{{", tree.name).unwrap();
writeln!(
out,
"\\newcommand{{\\schemadef{}}}{{",
tex_adapt_name(&tree.name)
)
.unwrap();
match &tree.r#type {
NodeType::Object { children, required } => {