texmath 0.13.2 → 0.13.2.1
raw patch · 7 files changed
+45/−24 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +12/−0
- src/Text/TeXMath/Readers/TeX.hs +1/−1
- src/Text/TeXMath/Writers/StarMath.hs +4/−19
- src/Text/TeXMath/Writers/Typst.hs +9/−2
- test/regression/291.test +6/−0
- test/regression/293.test +11/−0
- texmath.cabal +2/−2
changelog.md view
@@ -1,3 +1,15 @@+texmath (0.13.2.1)++ * Speed up test suite by running tests in parallel.++ * Fix regression in TeX parsing from 1.13.0.1 (#293).+ The changes introduced by commit 804490e led to failures parsing+ some "ignorable" content -- e.g., `\tag`, `\label`, and comments.++ * StarMath writer: fix compiler warnings.++ * Typst writer: Fix spacing after escaped expressions (#291, Filip V.)+ texmath (0.13.2) * Require typst-symbols 0.3
src/Text/TeXMath/Readers/TeX.hs view
@@ -77,7 +77,7 @@ , enclosure , hyperref , command- ]+ ] <* ignorable -- | Parse a formula, returning a list of 'Exp'. readTeX :: Text -> Either Text [Exp]
src/Text/TeXMath/Writers/StarMath.hs view
@@ -149,10 +149,11 @@ "}" -> Just "{" _ -> Nothing + go :: Int -> [Exp] -> [Exp] -> Maybe ([Exp], Exp) go _ _ [] = Nothing go depth inner (e : rest) = case (openTxt, e) of- (Just open, ESymbol Close c)+ (Just _, ESymbol Close c) | c == closeTxt -> go (depth + 1) (e : inner) rest (Just open, ESymbol Open o)@@ -177,7 +178,7 @@ collectBareDelimited :: T.Text -> [Exp] -> [Exp] -> Maybe ([Exp], Maybe (Exp -> Exp), [Exp])-collectBareDelimited _ acc [] = Nothing+collectBareDelimited _ _ [] = Nothing collectBareDelimited sym acc (y:ys) | matchesBareBar sym y = Just (reverse acc, Nothing, ys) | Just apply <- scriptedBareBar sym y = Just (reverse acc, Just apply, ys)@@ -811,11 +812,6 @@ TextFraktur -> "bold " <> styleArg body TextDoubleStruck -> "bold nitalic " <> styleArg body _ -> body- where- styleArg t- | T.null t = "{}"- | T.length t == 1 = t- | otherwise = "{" <> t <> "}" renderUnicodeSerifStyled :: TextType -> [Exp] -> Maybe T.Text renderUnicodeSerifStyled sty xs =@@ -1460,12 +1456,8 @@ "↑" -> " uparrow " "↓" -> " downarrow " "↦" -> " mapsto "- "\8230 " -> " dotslow "- "… " -> " dotslow " "\8230" -> " dotslow "- "…" -> " dotslow " "\8943" -> " dotsaxis "- "⋯" -> " dotsaxis " "⋮" -> " dotsvert " "⋱" -> " dotsdown " "⋰" -> " dotsup "@@ -1484,9 +1476,7 @@ "≈" -> " approx " "≡" -> " equiv " "\8810" -> " ll "- "≪" -> " ll " "\8811" -> " gg "- "≫" -> " gg " "∝" -> " prop " "∥" -> " parallel " "⊥" -> " ortho "@@ -1554,12 +1544,7 @@ ESymbol Op "\8719" -> Just "prod" ESymbol Op "\8899" -> Just "oper ∪" ESymbol Op "\8898" -> Just "oper ∩"- ESymbol Op "∫" -> Just "int"- ESymbol Op "∭" -> Just "iiint"- ESymbol Op "∑" -> Just "sum"- ESymbol Op "∏" -> Just "prod"- ESymbol Op "⋃" -> Just "oper ∪"- ESymbol Op "⋂" -> Just "oper ∩"+ ESymbol Op "\8749" -> Just "iiint" _ -> Nothing limitOpName :: Exp -> Maybe T.Text
src/Text/TeXMath/Writers/Typst.hs view
@@ -44,16 +44,23 @@ where go (a : b : es) | Just (bstart, _) <- T.uncons b- , Just (astart, _) <- T.uncons a , Just (_, aend) <- T.unsnoc a , bstart == '\'' -- avoid space before a prime #239- || bstart == '|' || aend == '|' || bstart == '\\' || astart == '\\' -- #286+ || bstart == '|' || aend == '|'+ || bstart == '\\' || isStandaloneEscape a -- #291, #286 = a <> go (b:es) go (a : as) = a <> if null as then mempty else " " <> go as go [] = mempty++ -- A compound expression may start with an escape but end in an identifier.+ -- Only a standalone escape suppresses the following space (#291).+ isStandaloneEscape t =+ case T.uncons t of+ Just ('\\', rest) -> T.length rest == 1+ _ -> False inParens :: Text -> Text inParens s = "(" <> s <> ")"
+ test/regression/291.test view
@@ -0,0 +1,6 @@+<<< tex+)^n k \qquad+(\mathbf x)^\top\mathbf A \qquad+\mathcal G=\langle\mathcal N,(\mathcal A_i)_i,(u_i)_i\rangle+>>> typst+\)^n k #h(2em)\(upright(bold(x))\)^top upright(bold(A)) #h(2em) cal(G) = chevron.l cal(N)\,\(cal(A)_i\)_i\,\(u_i\)_i chevron.r
+ test/regression/293.test view
@@ -0,0 +1,11 @@+<<< tex+x = y \tag{1}+>>> mml+<?xml version='1.0' ?>+<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">+ <mrow>+ <mi>x</mi>+ <mo>=</mo>+ <mi>y</mi>+ </mrow>+</math>
texmath.cabal view
@@ -1,5 +1,5 @@ Name: texmath-Version: 0.13.2+Version: 0.13.2.1 Cabal-Version: >= 1.10 Build-type: Simple Synopsis: Conversion between math formats.@@ -184,4 +184,4 @@ tasty-golden, tagged Default-Language: Haskell2010- Ghc-Options: -Wall -threaded+ Ghc-Options: -Wall -threaded -rtsopts "-with-rtsopts=-N -A64m"