Skip to content

Commit

Permalink
Typst reader: fix handling of dot(), tilde(), ddot().
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Feb 5, 2024
1 parent 1e05f32 commit 3ef74d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/Text/Pandoc/Readers/Typst/Math.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
8 changes: 3 additions & 5 deletions test/typst-reader.native
Original file line number Diff line number Diff line change
Expand Up @@ -1847,8 +1847,7 @@ Pandoc
[ Para
[ Span
( "" , [ "box" ] , [] )
[ Math
InlineMath "\\overset{\\cdot}{a}"
[ Math InlineMath "\\dot{a}"
, Str "\8192"
, Code ( "" , [] , [] ) "dot(a)"
]
Expand All @@ -1862,8 +1861,7 @@ Pandoc
[ Para
[ Span
( "" , [ "box" ] , [] )
[ Math
InlineMath "\\overset{\\sim}{a}"
[ Math InlineMath "\\widetilde{a}"
, Str "\8192"
, Code ( "" , [] , [] ) "tilde(a)"
]
Expand Down Expand Up @@ -1895,7 +1893,7 @@ Pandoc
[ Para
[ Span
( "" , [ "box" ] , [] )
[ Math InlineMath "\\overset{\168}{a}"
[ Math InlineMath "\\ddot{a}"
, Str "\8192"
, Code ( "" , [] , [] ) "diaer(a)"
]
Expand Down

0 comments on commit 3ef74d1

Please sign in to comment.