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(