mirror of
https://github.com/typst/typst
synced 2025-06-28 08:12:53 +08:00
Fix delimiter unparen syntax (#5739)
This commit is contained in:
parent
b3fb6c2326
commit
f7bd03dd76
@ -442,10 +442,10 @@ fn math_unparen(p: &mut Parser, m: Marker) {
|
|||||||
if first.text() == "(" && last.text() == ")" {
|
if first.text() == "(" && last.text() == ")" {
|
||||||
first.convert_to_kind(SyntaxKind::LeftParen);
|
first.convert_to_kind(SyntaxKind::LeftParen);
|
||||||
last.convert_to_kind(SyntaxKind::RightParen);
|
last.convert_to_kind(SyntaxKind::RightParen);
|
||||||
|
// Only convert if we did have regular parens.
|
||||||
|
node.convert_to_kind(SyntaxKind::Math);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node.convert_to_kind(SyntaxKind::Math);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The unicode math class of a string. Only returns `Some` if `text` has
|
/// The unicode math class of a string. Only returns `Some` if `text` has
|
||||||
|
BIN
tests/ref/math-lr-unparen.png
Normal file
BIN
tests/ref/math-lr-unparen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 493 B |
@ -125,3 +125,11 @@ $ lr(size: #3em, |)_a^b lr(size: #3em, zws|)_a^b
|
|||||||
--- issue-4188-lr-corner-brackets ---
|
--- issue-4188-lr-corner-brackets ---
|
||||||
// Test positioning of U+231C to U+231F
|
// Test positioning of U+231C to U+231F
|
||||||
$⌜a⌟⌞b⌝$ = $⌜$$a$$⌟$$⌞$$b$$⌝$
|
$⌜a⌟⌞b⌝$ = $⌜$$a$$⌟$$⌞$$b$$⌝$
|
||||||
|
|
||||||
|
--- math-lr-unparen ---
|
||||||
|
// Test that unparen with brackets stays as an LrElem.
|
||||||
|
#let item = $limits(sum)_i$
|
||||||
|
$
|
||||||
|
1 / ([item]) quad
|
||||||
|
1 / [item]
|
||||||
|
$
|
||||||
|
Loading…
x
Reference in New Issue
Block a user