diff --git a/cabal.project b/cabal.project index 9b6dc762c..d17c71e8f 100644 --- a/cabal.project +++ b/cabal.project @@ -11,7 +11,7 @@ constraints: skylighting-format-blaze-html >= 0.1.2, source-repository-package type: git location: https://github.com/jgm/texmath.git - tag: 170899673ee31de9096e178605e8da31a36e4185 + tag: e5d689366e4d480f96e9453f455d1a4362fad880 source-repository-package type: git @@ -21,7 +21,12 @@ source-repository-package source-repository-package type: git location: https://github.com/jgm/typst-hs.git - tag: 4ceec2da687ac25fd5b7a373d2554ff2f4beff64 + tag: 1a94f1fd69841fd4039441afa3e1ed330db8e334 + +source-repository-package + type: git + location: https://github.com/jgm/typst-symbols.git + tag: 928839de6742b61ee601ce4510cf4dcfd044354d source-repository-package type: git diff --git a/data/templates/default.typst b/data/templates/default.typst index 54264b71c..cfb71623d 100644 --- a/data/templates/default.typst +++ b/data/templates/default.typst @@ -1,5 +1,3 @@ -#let horizontalrule = line(start: (25%,0%), end: (75%,0%)) - #set terms(hanging-indent: 1.5em) #set table( diff --git a/src/Text/Pandoc/Readers/Typst.hs b/src/Text/Pandoc/Readers/Typst.hs index c320dbb07..1096c223e 100644 --- a/src/Text/Pandoc/Readers/Typst.hs +++ b/src/Text/Pandoc/Readers/Typst.hs @@ -388,6 +388,7 @@ blockHandlers = M.fromList >> M.lookup "angle" fields ) of Nothing -> pure B.horizontalRule _ -> pure mempty) + ,("divider", \_ _ _fields -> pure B.horizontalRule) ,("numbering", \_ _ fields -> do numStyle <- getField "numbering" fields (nums :: V.Vector Integer) <- getField "numbers" fields diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs index 25f99c015..63eb5352b 100644 --- a/src/Text/Pandoc/Writers/Typst.hs +++ b/src/Text/Pandoc/Writers/Typst.hs @@ -235,7 +235,7 @@ blockToTypst block = contents <- blocksToTypst blocks return $ "#quote(block: true)[" $$ chomp contents $$ "]" $$ blankline HorizontalRule -> - return $ blankline <> "#horizontalrule" <> blankline + return $ blankline <> "#divider()" <> blankline OrderedList attribs items -> do let addBlock = case attribs of (1, DefaultStyle, DefaultDelim) -> id diff --git a/stack.yaml b/stack.yaml index 9269d05e2..e94502cba 100644 --- a/stack.yaml +++ b/stack.yaml @@ -27,20 +27,21 @@ extra-deps: - commonmark-pandoc-0.3 - citeproc-0.13.0.1 - pandoc-types-1.23.1.2 -- typst-symbols-0.2 - emojis-0.1.5 - git: https://github.com/jgm/texmath.git - commit: 170899673ee31de9096e178605e8da31a36e4185 + commit: e5d689366e4d480f96e9453f455d1a4362fad880 - git: https://github.com/jgm/djoths.git commit: 7cabb69eef81d80688beb4fce6b604ad1ccc5941 - git: https://github.com/jgm/commonmark-hs commit: 73903fa7723ca2b1a1120063451e9647d1382754 subdirs: [commonmark-extensions] - git: https://github.com/jgm/typst-hs.git - commit: 4ceec2da687ac25fd5b7a373d2554ff2f4beff64 + commit: 1a94f1fd69841fd4039441afa3e1ed330db8e334 - git: https://github.com/jgm/skylighting.git commit: c196a0e4da03b7212db8fcc122a6a1c1fcdecb87 subdirs: [skylighting-format-blaze-html] +- git: https://github.com/jgm/typst-symbols.git + commit: 928839de6742b61ee601ce4510cf4dcfd044354d ghc-options: "$locals": -fhide-source-paths -Wno-missing-home-modules diff --git a/test/typst-reader.native b/test/typst-reader.native index 5055e3f1c..87f23e11e 100644 --- a/test/typst-reader.native +++ b/test/typst-reader.native @@ -1299,7 +1299,7 @@ Pandoc ( "" , [ "box" ] , [] ) [ Math InlineMath "\\cap" , Str "\8192" - , Code ( "" , [] , [] ) "sect" + , Code ( "" , [] , [] ) "inter" ] ] ] @@ -1595,7 +1595,7 @@ Pandoc ( "" , [ "box" ] , [] ) [ Math InlineMath "\1488" , Str "\8192" - , Code ( "" , [] , [] ) "alef" + , Code ( "" , [] , [] ) "aleph" ] ] ] @@ -3119,7 +3119,7 @@ Pandoc ( "" , [ "box" ] , [] ) [ Math InlineMath "\\partial" , Str "\8192" - , Code ( "" , [] , [] ) "diff" + , Code ( "" , [] , [] ) "partial" ] ] ] @@ -3150,7 +3150,7 @@ Pandoc ( "" , [ "box" ] , [] ) [ Math InlineMath "\\oplus" , Str "\8192" - , Code ( "" , [] , [] ) "plus.circle" + , Code ( "" , [] , [] ) "plus.o" ] ] ] @@ -3195,7 +3195,7 @@ Pandoc ( "" , [ "box" ] , [] ) [ Math InlineMath "\\ominus" , Str "\8192" - , Code ( "" , [] , [] ) "minus.circle" + , Code ( "" , [] , [] ) "minus.o" ] ] ] @@ -3209,8 +3209,7 @@ Pandoc ( "" , [ "box" ] , [] ) [ Math InlineMath "\295" , Str "\8192" - , Code - ( "" , [] , [] ) "planck.reduce" + , Code ( "" , [] , [] ) "planck" ] ] ] @@ -3241,7 +3240,7 @@ Pandoc ( "" , [ "box" ] , [] ) [ Math InlineMath "\\odot" , Str "\8192" - , Code ( "" , [] , [] ) "dot.circle" + , Code ( "" , [] , [] ) "dot.o" ] ] ] @@ -3288,7 +3287,7 @@ Pandoc ( "" , [ "box" ] , [] ) [ Math InlineMath "\\otimes" , Str "\8192" - , Code ( "" , [] , [] ) "times.circle" + , Code ( "" , [] , [] ) "times.o" ] ] ] @@ -3919,7 +3918,7 @@ Pandoc ( "" , [ "box" ] , [] ) [ Math InlineMath "\\bigcap" , Str "\8192" - , Code ( "" , [] , [] ) "sect.big" + , Code ( "" , [] , [] ) "inter.big" ] ] ] @@ -3970,7 +3969,8 @@ Pandoc [ Math InlineMath "\\langle\\rangle" , Str "\8192" , Code - ( "" , [] , [] ) "angle.l angle.r" + ( "" , [] , [] ) + "chevron.l chevron.r" ] ] ] diff --git a/test/undergradmath.typ b/test/undergradmath.typ index a5c21be3e..5a57a831c 100644 --- a/test/undergradmath.typ +++ b/test/undergradmath.typ @@ -167,13 +167,13 @@ Getting script letters is @unavailable. columns: 3, column-gutter: 1em, cell($union$, `union`), cell($RR$, [`RR`, `bb(R)`]), cell($forall$, `forall`), - cell($sect$, `sect`), cell($bb(Z)$, [`ZZ`, `bb(Z)`]), cell($exists$, `exists`), + cell($inter$, `inter`), cell($bb(Z)$, [`ZZ`, `bb(Z)`]), cell($exists$, `exists`), cell($subset$, `subset`), cell($bb(Q)$, [`QQ`, `bb(Q)`]), cell($not$, `not`), cell($subset.eq$, `subset.eq`), cell($bb(N)$, [`NN`, `bb(N)`]), cell($or$, `or`), cell($supset$, `supset`), cell($bb(C)$, [`CC`, `bb(C)`]), cell($and$, `and`), cell($supset.eq$, `supset.eq`), cell($diameter$, [`diameter`]), cell($tack.r$, `tack.r`), cell($in$, `in`), cell($nothing$, `nothing`), cell($models$, `models`), - cell($in.not$, `in.not`), cell($alef$, `alef`), cell($without$, `without`), + cell($in.not$, `in.not`), cell($aleph$, `aleph`), cell($without$, `without`), )) Negate an operator, as in $subset.not$, with `subset.not`. @@ -257,11 +257,11 @@ Just type them! cell($>>$, [`>>`, `gt.double`]), cell($tilde.equiv.not$, `tilde.equiv.not`), cell($divides$, `divides`), cell($approx$, `approx`), cell($tilde$, `tilde`), cell($divides.not$, `divides.not`), cell($\u{224D}$, [`\u{224D}` @tricky]), cell($tilde.eq$, `tilde.eq`), cell($n!$, `n!`), - cell($equiv$, `equiv`), cell($tilde.not$, `tilde.not`), cell($diff$, `diff`), - cell($prec$, `prec`), cell($plus.circle$, `plus.circle`), cell($nabla$, `nabla`), - cell($prec.eq$, `prec.eq`), cell($minus.circle$, `minus.circle`), cell($planck.reduce$, `planck.reduce`), - cell($succ$, `succ`), cell($dot.circle$, `dot.circle`), cell($circle.stroked.tiny$, `circle.stroked.tiny`), - cell($succ.eq$, `succ.eq`), cell($times.circle$, `times.circle`), cell($star$, `star`), + cell($equiv$, `equiv`), cell($tilde.not$, `tilde.not`), cell($partial$, `partial`), + cell($prec$, `prec`), cell($plus.o$, `plus.o`), cell($nabla$, `nabla`), + cell($prec.eq$, `prec.eq`), cell($minus.o$, `minus.o`), cell($planck$, `planck`), + cell($succ$, `succ`), cell($dot.o$, `dot.o`), cell($circle.stroked.tiny$, `circle.stroked.tiny`), + cell($succ.eq$, `succ.eq`), cell($times.o$, `times.o`), cell($star$, `star`), cell($prop$, `prop`), cell($\u{2298}$, [`\u{2298}` @tricky]), cell($sqrt("")$, `sqrt("")`), cell($\u{2250}$, [`\u{2250}` @tricky]), cell($harpoon.tr$, `harpoon.tr`), cell($checkmark$, `checkmark`), )) @@ -294,14 +294,14 @@ These do the same. #align(center, table( columns: 3, cell($integral$, `integral`), cell($integral.triple$, `integral.triple`), cell($union.big$, `union.big`), - cell($integral.double$, `integral.double`), cell($integral.cont$, `integral.cont`), cell($sect.big$, `sect.big`), + cell($integral.double$, `integral.double`), cell($integral.cont$, `integral.cont`), cell($inter.big$, `inter.big`), )) = Fences #align(center, table( columns: 3, column-gutter: 1.5em, - cell($()$, `()`), cell($angle.l angle.r$, `angle.l angle.r`), cell($abs("")$, `abs("")`), + cell($()$, `()`), cell($chevron.l chevron.r$, `chevron.l chevron.r`), cell($abs("")$, `abs("")`), cell($[]$, `[]`), cell($floor("")$, `floor("")`), cell($norm("")$, `norm("")`), cell(${}$, `{}`), cell($ceil("")$, `ceil("")`), )) @@ -322,7 +322,7 @@ To have them grow with the enclosed formula, also use the `lr` function. #align(center, table( columns: 2, column-gutter: 1em, - $ lr(angle.l i, 2^(2^i) angle.r) $, + $ lr(chevron.l i, 2^(2^i) chevron.r) $, ``` lr(angle.l i, 2^(2^i) angle.r) ```, @@ -507,4 +507,4 @@ See also the Typst Documentation at #link("https://typst.app/docs"). #block( line(length: 100%, stroke: headcolor) + text(headcolor)[johanvx (https://github.com/johanvx) #h(1fr) #date] -) \ No newline at end of file +) diff --git a/test/writer.typst b/test/writer.typst index 3bb866950..11c93995a 100644 --- a/test/writer.typst +++ b/test/writer.typst @@ -1,5 +1,3 @@ -#let horizontalrule = line(start: (25%,0%), end: (75%,0%)) - #set terms(hanging-indent: 1.5em) #set table( @@ -156,7 +154,7 @@ This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite. -#horizontalrule +#divider() = Headers @@ -180,7 +178,7 @@ with no blank line with no blank line -#horizontalrule +#divider() = Paragraphs @@ -194,7 +192,7 @@ Here's one with a bullet. \* criminey. There should be a hard line break \ here. -#horizontalrule +#divider() = Block Quotes @@ -233,7 +231,7 @@ This should not be a block quote: 2 \> 1. And a following paragraph. -#horizontalrule +#divider() = Code Blocks @@ -257,7 +255,7 @@ And: These should not be escaped: \$ \\ \> \[ \{ ``` -#horizontalrule +#divider() = Lists @@ -435,7 +433,7 @@ M.A.~2007 B. Williams -#horizontalrule +#divider() = Definition Lists @@ -600,7 +598,7 @@ Code: Hr's: -#horizontalrule +#divider() = Inline Markup @@ -629,7 +627,7 @@ Subscripts: H#sub[2]O, H#sub[23]O, H#sub[many~of~them]O. These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a\~b c\~d. -#horizontalrule +#divider() = Smart quotes, ellipses, dashes @@ -650,7 +648,7 @@ Dashes between numbers: 5--7, 255--66, 1987--1999. Ellipses…and…and…. -#horizontalrule +#divider() = LaTeX @@ -674,7 +672,7 @@ These shouldn't be math: Here's a LaTeX table: -#horizontalrule +#divider() = Special Characters @@ -728,7 +726,7 @@ Plus: + Minus: - -#horizontalrule +#divider() = Links @@ -807,7 +805,7 @@ Auto-links should not occur here: `` or here: ``` -#horizontalrule +#divider() = Images @@ -821,7 +819,7 @@ From "Voyage dans la Lune" by Georges Melies (1902): Here is a movie #box(image("movie.jpg", alt: "movie")) icon. -#horizontalrule +#divider() = Footnotes