Tex export: fix array support
This commit is contained in:
parent
b5cf85adc7
commit
caa4b23d5f
14
src/main.rs
14
src/main.rs
@ -106,16 +106,20 @@ fn tex_escape_str(s: &str) -> String {
|
|||||||
.replace('\n', "\\newline\n")
|
.replace('\n', "\\newline\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tex_export_inner(tree: &ObjectChild, out: &mut String, required: bool) {
|
fn tex_type_str(t: &TreeNode) -> String {
|
||||||
let type_str = match &tree.node.r#type {
|
match &t.r#type {
|
||||||
NodeType::Null => "NULL".to_string(),
|
NodeType::Null => "NULL".to_string(),
|
||||||
NodeType::Boolean => "bool".to_string(),
|
NodeType::Boolean => "bool".to_string(),
|
||||||
NodeType::Array { item } => format!("{}[]", item.name),
|
NodeType::Array { item } => format!("{}[]", tex_type_str(&item)),
|
||||||
NodeType::Object { .. } => tree.node.name.to_string(),
|
NodeType::Object { .. } => t.name.to_string(),
|
||||||
NodeType::String => "string".to_string(),
|
NodeType::String => "string".to_string(),
|
||||||
NodeType::Number => "number".to_string(),
|
NodeType::Number => "number".to_string(),
|
||||||
NodeType::Integer => "integer".to_string(),
|
NodeType::Integer => "integer".to_string(),
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn tex_export_inner(tree: &ObjectChild, out: &mut String, required: bool) {
|
||||||
|
let type_str = tex_type_str(&tree.node);
|
||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
out,
|
out,
|
||||||
|
Loading…
Reference in New Issue
Block a user