From d86a5e8a1f469dd79abf3137dba77a71fae2a774 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 3 Feb 2021 21:30:36 +0100 Subject: =?UTF-8?q?Tidy=20up=20raw=20blocks=20=F0=9F=A7=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Better trimming (only trim at the end if necessary) - Fixed block-level layouting - Improved pretty printing - Flip inline variable to block - Flip inline variable to display for math formulas --- src/syntax/mod.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/syntax/mod.rs') diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index 409e8cbf..2a8c4dbb 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -64,9 +64,18 @@ mod tests { // Raw. roundtrip("``"); - roundtrip("`lang 1`"); - test("``` hi```", "`hi`"); - test("``` ` ```", "```"); + roundtrip("`nolang 1`"); + roundtrip("```lang 1```"); + roundtrip("```lang 1 ```"); + roundtrip("```hi line ```"); + roundtrip("```py\ndef\n```"); + roundtrip("```\n line \n```"); + roundtrip("```\n`\n```"); + roundtrip("``` ` ```"); + test("```1 ```", "``"); + test("``` 1```", "`1`"); + test("``` 1 ```", "`1 `"); + test("```` ` ````", "``` ` ```"); } #[test] @@ -77,12 +86,12 @@ mod tests { roundtrip("{true}"); roundtrip("{10}"); roundtrip("{3.14}"); - roundtrip("{10pt}"); + roundtrip("{10.0pt}"); roundtrip("{14.1deg}"); - roundtrip("{20%}"); + roundtrip("{20.0%}"); roundtrip("{#abcdef}"); roundtrip(r#"{"hi"}"#); - test(r#"{"let's go"}"#, r#"{"let\'s go"}"#); + test(r#"{"let's \" go"}"#, r#"{"let's \" go"}"#); // Arrays. roundtrip("{()}"); -- cgit v1.2.3