diff options
| author | sitandr <60141933+sitandr@users.noreply.github.com> | 2023-08-10 22:36:05 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-10 21:36:05 +0200 |
| commit | 2f81089995c87efdbce6c94bb29647cd1f213cfd (patch) | |
| tree | b240bcfab9b6107545cd5758186625ad449880dd | |
| parent | 88bcb8769a07d1bad57b77fa9443b598fd1a6b61 (diff) | |
Fix single prime in subscript (#1909)
* Fix single prime in subscript (a_' producing wrong result)
* Clippy
| -rw-r--r-- | crates/typst-syntax/src/ast.rs | 4 | ||||
| -rw-r--r-- | tests/ref/math/opticalsize.png | bin | 11317 -> 12126 bytes | |||
| -rw-r--r-- | tests/typ/math/opticalsize.typ | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/crates/typst-syntax/src/ast.rs b/crates/typst-syntax/src/ast.rs index 2ea318a7..65a91629 100644 --- a/crates/typst-syntax/src/ast.rs +++ b/crates/typst-syntax/src/ast.rs @@ -848,9 +848,9 @@ impl MathAttach { .find_map(SyntaxNode::cast) } - /// Extract primes if present. + /// Extract attached primes if present. pub fn primes(&self) -> Option<MathPrimes> { - self.0.cast_first_match() + self.0.children().nth(1).and_then(|n| n.cast()) } } diff --git a/tests/ref/math/opticalsize.png b/tests/ref/math/opticalsize.png Binary files differindex 905d3389..bd67542b 100644 --- a/tests/ref/math/opticalsize.png +++ b/tests/ref/math/opticalsize.png diff --git a/tests/typ/math/opticalsize.typ b/tests/typ/math/opticalsize.typ index 6edd2419..07027cbb 100644 --- a/tests/typ/math/opticalsize.typ +++ b/tests/typ/math/opticalsize.typ @@ -43,3 +43,7 @@ $a'_b^c$, $a_b'^c$, $a_b^c'$, $a_b'^c'^d'$ $(a'_b')^(c'_d')$, $a'/b'$, $a_b'/c_d'$ $∫'$, $∑'$, $ ∑'_S' $ + +--- +// Test attaching primes only +$a' = a^', a_', a_'''^''^'$
\ No newline at end of file |
