typst 0.11 → 0.11.0.1
raw patch · 5 files changed
+58/−3 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- src/Typst/Module/Calc.hs +3/−2
- test/typ/regression/issue-102.out +46/−0
- test/typ/regression/issue-102.typ +4/−0
- typst.cabal +1/−1
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for typst-hs +## 0.11.0.1++ * Fix `calc.pow` so it accepts negative exponents (#102).+ ## 0.11 * Fall back on defaults for settable element fields (#100).
src/Typst/Module/Calc.hs view
@@ -146,11 +146,12 @@ base <- nthArg 1 ex <- nthArg 2 case (base, ex) of- (VInteger x, VInteger y) -> pure $ VInteger $ x ^ y+ (VInteger x, VInteger y)+ | y >= 0 -> pure $ VInteger $ x ^ y _ -> do (base' :: Double) <- fromVal base (ex' :: Integer) <- fromVal ex- pure $ VFloat $ (base') ^ (ex')+ pure $ VFloat $ (base') ^^ (ex') ), ( "quo", makeFunction $ do
+ test/typ/regression/issue-102.out view
@@ -0,0 +1,46 @@+--- parse tree ---+[ Code+ "typ/regression/issue-102.typ"+ ( line 1 , column 2 )+ (Let+ (BasicBind (Just (Identifier "r")))+ (FuncCall+ (FieldAccess+ (Ident (Identifier "pow")) (Ident (Identifier "calc")))+ [ NormalArg (Literal (Float 1.125))+ , NormalArg (Negated (Literal (Int 2)))+ ]))+, SoftBreak+, Code+ "typ/regression/issue-102.typ"+ ( line 2 , column 2 )+ (Let+ (BasicBind (Just (Identifier "s")))+ (FuncCall+ (FieldAccess+ (Ident (Identifier "pow")) (Ident (Identifier "calc")))+ [ NormalArg (Literal (Int 1))+ , NormalArg (Negated (Literal (Int 2)))+ ]))+, SoftBreak+, Code+ "typ/regression/issue-102.typ"+ ( line 3 , column 2 )+ (Ident (Identifier "r"))+, SoftBreak+, Code+ "typ/regression/issue-102.typ"+ ( line 4 , column 2 )+ (Ident (Identifier "s"))+, ParBreak+]+--- evaluated ---+document(body: { text(body: [+]), + text(body: [+]), + text(body: [0.7901234567901234]), + text(body: [+]), + text(body: [1.0]), + parbreak() })
+ test/typ/regression/issue-102.typ view
@@ -0,0 +1,4 @@+#let r = calc.pow(1.125, -2)+#let s = calc.pow(1, -2)+#r+#s
typst.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: typst-version: 0.11+version: 0.11.0.1 synopsis: Parsing and evaluating typst syntax. description: A library for parsing and evaluating typst syntax. Typst (<https://typst.app>) is a document layout and