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")
|
||||
}
|
||||
|
||||
fn tex_export_inner(tree: &ObjectChild, out: &mut String, required: bool) {
|
||||
let type_str = match &tree.node.r#type {
|
||||
fn tex_type_str(t: &TreeNode) -> String {
|
||||
match &t.r#type {
|
||||
NodeType::Null => "NULL".to_string(),
|
||||
NodeType::Boolean => "bool".to_string(),
|
||||
NodeType::Array { item } => format!("{}[]", item.name),
|
||||
NodeType::Object { .. } => tree.node.name.to_string(),
|
||||
NodeType::Array { item } => format!("{}[]", tex_type_str(&item)),
|
||||
NodeType::Object { .. } => t.name.to_string(),
|
||||
NodeType::String => "string".to_string(),
|
||||
NodeType::Number => "number".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!(
|
||||
out,
|
||||
|
Loading…
Reference in New Issue
Block a user