Skip to content

Commit

Permalink
Use latest dev typst-hs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Jul 5, 2023
1 parent e09c560 commit d3e485f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/jgm/typst-hs
tag: cd2583f638033cdedda2460642c93315fbc11979
tag: be9e946616b1564106255a4de7e69a70c5be848b
-- when time for a release:
-- Release new skylighting, skylighting-core and depend on them
16 changes: 1 addition & 15 deletions src/Text/Pandoc/Readers/Typst.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import Text.TeXMath (writeTeX)
import Text.TeXMath.Shared (getSpaceChars)
import Text.Pandoc.Readers.Typst.Math (pMathMany)
import Text.Pandoc.Readers.Typst.Parsing (pTok, ignored, chunks, getField, P)
import Typst.Methods (applyPureFunction, formatNumber)
import Typst.Methods (formatNumber, applyPureFunction)
import Typst.Types

-- import Debug.Trace
Expand Down Expand Up @@ -309,12 +309,6 @@ handleBlock tok = do
pure $ B.plain . B.text . mconcat . map toNum $ V.toList nums
Elt "footnote.entry" _ fields ->
getField "body" fields >>= pWithContents pBlocks
Elt "style" _ fields -> do
Function f <- getField "func" fields
case applyPureFunction (Function f) [VStyles] of
Success (VContent cs) -> pWithContents pBlocks cs
Success x -> pure $ B.para $ B.text $ repr x
Failure e -> fail e
Elt (Identifier tname) _ _ -> do
ignored ("unknown block element " <> tname)
pure mempty
Expand All @@ -335,7 +329,6 @@ pParBreak =
isInline :: Content -> Bool
isInline (Lab {}) = True
isInline (Txt {}) = True
isInline (Elt "style" _ _) = True -- can be block or inline
isInline (Elt "place" _ _) = True -- can be block or inline
isInline (Elt "align" _ _) = True -- can be block or inline
isInline x = not (isBlock x)
Expand Down Expand Up @@ -383,7 +376,6 @@ isBlock (Elt name _ fields) =
"v" -> True
"xml" -> True
"yaml" -> True
"style" -> True
_ -> False

pWithContents :: PandocMonad m => P m a -> Seq Content -> P m a
Expand Down Expand Up @@ -515,12 +507,6 @@ handleInline tok =
LExact x LPt -> toRational x / 12
_ -> 1 / 3 -- guess!
pure $ B.text $ getSpaceChars em
Elt "style" _ fields -> do
Function f <- getField "func" fields
case applyPureFunction (Function f) [VStyles] of
Success (VContent cs) -> pWithContents pInlines cs
Success x -> pure $ B.text $ repr x
Failure e -> fail e
Elt "place" _pos fields -> do
ignored "parameters of place"
getField "body" fields >>= pWithContents pInlines
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extra-deps:
- typst-symbols-0.1.2
- toml-parser-1.1.1.0
- git: https://github.com/jgm/typst-hs
commit: cd2583f638033cdedda2460642c93315fbc11979
commit: be9e946616b1564106255a4de7e69a70c5be848b
- git: https://github.com/jgm/pandoc-types
commit: 2b68c905e75c65e66eaa4635e4c1bd6aabd6302f

Expand Down

0 comments on commit d3e485f

Please sign in to comment.