diff --git a/Cargo.lock b/Cargo.lock index 7520a34..5a6f1bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -224,7 +224,7 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "openapi-parser" -version = "0.3.0" +version = "0.4.0" dependencies = [ "clap", "env_logger", diff --git a/src/main.rs b/src/main.rs index 34909be..9eae5b1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 } => {