Move environment

This commit is contained in:
Pierre HUBERT 2023-03-01 10:24:30 +01:00
parent 306f695617
commit 3f17842a91

View File

@ -208,11 +208,13 @@ fn tex_export(tree: &TreeNode) -> String {
// JSON export // JSON export
out.push_str(&format!("\\newsavebox{{{box_name}}}\n")); out.push_str(&format!("\\newsavebox{{{box_name}}}\n"));
out.push_str(&format!("\\begin{{lrbox}}{{{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"); out.push_str("\\begin{lstlisting}[language=json]\n");
let json_doc = serde_json::to_string_pretty(&tree.example_value(1)).unwrap(); let json_doc = serde_json::to_string_pretty(&tree.example_value(1)).unwrap();
let replace_key = serde_json::to_string(REF_OBJECT).unwrap(); let replace_key = serde_json::to_string(REF_OBJECT).unwrap();
out.push_str(&json_doc.replace(&format!("{replace_key}:"), "$ref")); out.push_str(&json_doc.replace(&format!("{replace_key}:"), "$ref"));
out.push_str("\n\\end{lstlisting}\n"); out.push_str("\n\\end{lstlisting}\n");
out.push_str("\\end{jsonsample}\n");
out.push_str("\\end{lrbox}\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("\\end{schemaprops}\n");
out.push_str("\\begin{jsonsample}\n");
out.push_str(&format!("\\usebox{{{box_name}}}\n")); out.push_str(&format!("\\usebox{{{box_name}}}\n"));
out.push_str("\\end{jsonsample}\n");
out.push_str("\\end{schemabody}\n"); out.push_str("\\end{schemabody}\n");
} }
_ => tex_export_inner( _ => tex_export_inner(