summaryrefslogtreecommitdiff
path: root/src/syntax/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-02-03 21:30:36 +0100
committerLaurenz <laurmaedje@gmail.com>2021-02-03 21:34:49 +0100
commitd86a5e8a1f469dd79abf3137dba77a71fae2a774 (patch)
treefc7ab35d999322b9d124e41ab80948df23965d26 /src/syntax/mod.rs
parent6fcef9973be4253e5b377251dd9d1921f9738fc1 (diff)
Tidy up raw blocks 🧹
- 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
Diffstat (limited to 'src/syntax/mod.rs')
-rw-r--r--src/syntax/mod.rs21
1 files changed, 15 insertions, 6 deletions
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("{()}");