From 3eeeac68414577dfb0eccd27f8305de4a60fa944 Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Tue, 7 Feb 2023 14:52:30 +0100 Subject: [PATCH] Add array examples --- src/main.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index b819236..d365ca9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -143,9 +143,12 @@ fn tex_export_inner(tree: &ObjectChild, out: &mut String, required: bool) { None => "".to_string(), Some(d) => tex_escape_str(d), }, - match tree.node.examples.get(0) { - None => "".to_string(), - Some(e) => tex_escape_str(e), + match (&tree.node.r#type, tree.node.examples.get(0)) { + (_, Some(e)) => tex_escape_str(e), + (NodeType::Array { item }, _) if !item.examples.is_empty() => { + format!("[{}]", &item.examples.get(0).unwrap()) + } + _ => "".to_string(), } ) .unwrap();