typst 0.8 → 0.8.0.1
raw patch · 5 files changed
+75/−9 lines, 5 files
Files
- CHANGELOG.md +4/−0
- src/Typst/Parse.hs +8/−8
- test/typ/compiler/set-08.out +60/−0
- test/typ/compiler/set-08.typ +2/−0
- typst.cabal +1/−1
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for typst-hs +## 0.8.0.1++ * Fix subtracting units, e.g. `1mm-0mm` (#71, Luke Grehan).+ ## 0.8 * Allow `json`, `toml`, `xml` to take either file path or bytes.
src/Typst/Parse.hs view
@@ -989,14 +989,14 @@ pUnit :: P Unit pUnit = (Percent <$ sym "%")- <|> (Pt <$ pKeyword "pt")- <|> (Mm <$ pKeyword "mm")- <|> (Cm <$ pKeyword "cm")- <|> (In <$ pKeyword "in")- <|> (Deg <$ pKeyword "deg")- <|> (Rad <$ pKeyword "rad")- <|> (Em <$ pKeyword "em")- <|> (Fr <$ pKeyword "fr")+ <|> (Pt <$ sym "pt")+ <|> (Mm <$ sym "mm")+ <|> (Cm <$ sym "cm")+ <|> (In <$ sym "in")+ <|> (Deg <$ sym "deg")+ <|> (Rad <$ sym "rad")+ <|> (Em <$ sym "em")+ <|> (Fr <$ sym "fr") pIdent :: P Expr pIdent = Ident <$> pIdentifier
+ test/typ/compiler/set-08.out view
@@ -0,0 +1,60 @@+--- parse tree ---+[ Code+ "typ/compiler/set-08.typ"+ ( line 1 , column 2 )+ (Let+ (BasicBind (Just (Identifier "test")))+ (FuncExpr+ [ NormalParam (Identifier "x") , NormalParam (Identifier "y") ]+ (Block+ (CodeBlock+ [ If+ [ ( Equals (Ident (Identifier "x")) (Ident (Identifier "y"))+ , Block (Content [ Text "\9989" ])+ )+ , ( Literal (Boolean True)+ , Block+ (Content+ [ Text "\10060"+ , Text "("+ , Code+ "typ/compiler/set-08.typ"+ ( line 1 , column 47 )+ (FuncCall+ (Ident (Identifier "repr"))+ [ NormalArg (Ident (Identifier "x")) ])+ , Space+ , Text "/"+ , Text "="+ , Space+ , Code+ "typ/compiler/set-08.typ"+ ( line 1 , column 59 )+ (FuncCall+ (Ident (Identifier "repr"))+ [ NormalArg (Ident (Identifier "y")) ])+ , Text ")"+ ])+ )+ ]+ ]))))+, SoftBreak+, Code+ "typ/compiler/set-08.typ"+ ( line 2 , column 2 )+ (Set+ (Ident (Identifier "page"))+ [ KeyValArg+ (Identifier "margin")+ (Minus (Literal (Numeric 1.0 Mm)) (Literal (Numeric 0.0 Mm)))+ ])+, SoftBreak+, Text "foo"+, ParBreak+]+--- evaluated ---+document(body: { text(body: [+]), + text(body: [+foo]), + parbreak() })
+ test/typ/compiler/set-08.typ view
@@ -0,0 +1,2 @@+#set page(margin: 1mm-0mm)+foo
typst.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: typst-version: 0.8+version: 0.8.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