diff options
| author | bluebear94 <uruwi@protonmail.com> | 2023-06-24 08:26:06 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-24 14:26:06 +0200 |
| commit | 622cef8e0052532e9b71f7a2484e6637095b9b79 (patch) | |
| tree | 70008558e044643d2c1116d61d96c6a044fcf21a | |
| parent | e1d76960eb67443fbe58e5af0cc6da2facee26a1 (diff) | |
layout::par::collect: Treat linebreak element as whitespace (#1542)
Fixes #1540.
| -rw-r--r-- | library/src/layout/par.rs | 5 | ||||
| -rw-r--r-- | tests/ref/bugs/smartquotes-on-newline.png | bin | 0 -> 1625 bytes | |||
| -rw-r--r-- | tests/typ/bugs/smartquotes-on-newline.typ | 7 |
3 files changed, 11 insertions, 1 deletions
diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs index 6170a34d..2d6bd96d 100644 --- a/library/src/layout/par.rs +++ b/library/src/layout/par.rs @@ -609,7 +609,10 @@ fn collect<'a>( elem.text().chars().next() } else if child.is::<SmartQuoteElem>() { Some('"') - } else if child.is::<SpaceElem>() || child.is::<HElem>() { + } else if child.is::<SpaceElem>() + || child.is::<HElem>() + || child.is::<LinebreakElem>() + { Some(SPACING_REPLACE) } else { Some(OBJ_REPLACE) diff --git a/tests/ref/bugs/smartquotes-on-newline.png b/tests/ref/bugs/smartquotes-on-newline.png Binary files differnew file mode 100644 index 00000000..fdf4623a --- /dev/null +++ b/tests/ref/bugs/smartquotes-on-newline.png diff --git a/tests/typ/bugs/smartquotes-on-newline.typ b/tests/typ/bugs/smartquotes-on-newline.typ new file mode 100644 index 00000000..3180350e --- /dev/null +++ b/tests/typ/bugs/smartquotes-on-newline.typ @@ -0,0 +1,7 @@ +// Test that smart quotes are inferred correctly across newlines. + +--- +"test"#linebreak()"test" + +"test"\ +"test" |
