aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2024-02-04 22:37:37 -0800
committerJohn MacFarlane <[email protected]>2024-02-04 22:37:37 -0800
commit3ef74d1fd2fa7937da841f90d3ff3d8dc87488c8 (patch)
treedf27e0980f3b4b8f5c39de038c8c54f73d4cc7aa
parent1e05f32ead3da5bf8c81f78f2c7ccb2971e69044 (diff)
Typst reader: fix handling of `dot()`, `tilde()`, `ddot()`.
See jgm/typst-hs#38.
-rw-r--r--src/Text/Pandoc/Readers/Typst/Math.hs5
-rw-r--r--test/typst-reader.native8
2 files changed, 6 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Typst/Math.hs b/src/Text/Pandoc/Readers/Typst/Math.hs
index e06e1c680..7d61d893c 100644
--- a/src/Text/Pandoc/Readers/Typst/Math.hs
+++ b/src/Text/Pandoc/Readers/Typst/Math.hs
@@ -31,8 +31,6 @@ import Text.Pandoc.Readers.Typst.Parsing
( P, pTok, ignored, pWithContents, getField, chunks )
import Typst.Types
--- import Debug.Trace
-
withGroup :: [Exp] -> Exp
withGroup [x] = x
withGroup xs = EGrouped xs
@@ -91,6 +89,9 @@ handleMath tok =
base <- getField "base" fields >>= pMathGrouped
acc <- getField "accent" fields >>= pMathGrouped
let acc' = case acc of
+ ESymbol _ "\8901" -> ESymbol Accent "\775" -- \dot
+ ESymbol _ "\168" -> ESymbol Accent "\776" -- \ddot
+ ESymbol _ "\8764" -> ESymbol Accent "\771" -- \tilde
ESymbol _ t -> ESymbol Accent t
_ -> acc
pure $ EOver False base acc'
diff --git a/test/typst-reader.native b/test/typst-reader.native
index 3095cea29..74a0ad8de 100644
--- a/test/typst-reader.native
+++ b/test/typst-reader.native
@@ -1847,8 +1847,7 @@ Pandoc
[ Para
[ Span
( "" , [ "box" ] , [] )
- [ Math
- InlineMath "\\overset{\\cdot}{a}"
+ [ Math InlineMath "\\dot{a}"
, Str "\8192"
, Code ( "" , [] , [] ) "dot(a)"
]
@@ -1862,8 +1861,7 @@ Pandoc
[ Para
[ Span
( "" , [ "box" ] , [] )
- [ Math
- InlineMath "\\overset{\\sim}{a}"
+ [ Math InlineMath "\\widetilde{a}"
, Str "\8192"
, Code ( "" , [] , [] ) "tilde(a)"
]
@@ -1895,7 +1893,7 @@ Pandoc
[ Para
[ Span
( "" , [ "box" ] , [] )
- [ Math InlineMath "\\overset{\168}{a}"
+ [ Math InlineMath "\\ddot{a}"
, Str "\8192"
, Code ( "" , [] , [] ) "diaer(a)"
]