Fix issue with numbers
This commit is contained in:
parent
805b46e164
commit
07a955e654
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -224,7 +224,7 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
|
||||
|
||||
[[package]]
|
||||
name = "openapi-parser"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"env_logger",
|
||||
|
20
src/main.rs
20
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 } => {
|
||||
|
Loading…
Reference in New Issue
Block a user