From 3f17842a91b5b307c98003e7922634738391bafc Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Wed, 1 Mar 2023 10:24:30 +0100 Subject: [PATCH] Move environment --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0dc0f0f..bbf5bdb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -208,11 +208,13 @@ fn tex_export(tree: &TreeNode) -> String { // JSON export out.push_str(&format!("\\newsavebox{{{box_name}}}\n")); out.push_str(&format!("\\begin{{lrbox}}{{{box_name}}}\n")); + out.push_str("\\begin{jsonsample}\n"); out.push_str("\\begin{lstlisting}[language=json]\n"); let json_doc = serde_json::to_string_pretty(&tree.example_value(1)).unwrap(); let replace_key = serde_json::to_string(REF_OBJECT).unwrap(); out.push_str(&json_doc.replace(&format!("{replace_key}:"), "$ref")); out.push_str("\n\\end{lstlisting}\n"); + out.push_str("\\end{jsonsample}\n"); out.push_str("\\end{lrbox}\n"); } @@ -250,9 +252,7 @@ fn tex_export(tree: &TreeNode) -> String { } out.push_str("\\end{schemaprops}\n"); - out.push_str("\\begin{jsonsample}\n"); out.push_str(&format!("\\usebox{{{box_name}}}\n")); - out.push_str("\\end{jsonsample}\n"); out.push_str("\\end{schemabody}\n"); } _ => tex_export_inner(