@@ -42,8 +42,9 @@ import Text.DocTemplates (renderTemplate)
42
42
import Text.Pandoc.Extensions (Extension (.. ))
43
43
import Text.Collate.Lang (Lang (.. ), parseLang )
44
44
import Text.Printf (printf )
45
- import Data.Char (isAlphaNum , isDigit )
45
+ import Data.Char (isDigit )
46
46
import Data.Maybe (fromMaybe )
47
+ import Unicode.Char (isXIDContinue )
47
48
48
49
-- | Convert Pandoc to Typst.
49
50
writeTypst :: PandocMonad m => WriterOptions -> Pandoc -> m Text
@@ -110,7 +111,7 @@ pandocToTypst options (Pandoc meta blocks) = do
110
111
$ (if writerNumberSections options
111
112
then defField " section-numbering" (" 1.1.1.1.1" :: Text )
112
113
else id )
113
- $ metadata
114
+ metadata
114
115
return $ render colwidth $
115
116
case writerTemplate options of
116
117
Nothing -> main
@@ -121,15 +122,15 @@ pickTypstAttrs = foldr go ([],[])
121
122
where
122
123
go (k,v) =
123
124
case T. splitOn " :" k of
124
- " typst" : " text" : x : [ ] -> second ((x,v): )
125
- " typst" : x : [ ] -> first ((x,v): )
125
+ [ " typst" , " text" , x ] -> second ((x,v): )
126
+ [ " typst" , x ] -> first ((x,v): )
126
127
_ -> id
127
128
128
129
formatTypstProp :: (Text , Text ) -> Text
129
130
formatTypstProp (k,v) = k <> " : " <> v
130
131
131
132
toTypstPropsListSep :: [(Text , Text )] -> Doc Text
132
- toTypstPropsListSep = hsep . intersperse " ," . ( map $ literal . formatTypstProp)
133
+ toTypstPropsListSep = hsep . intersperse " ," . map ( literal . formatTypstProp)
133
134
134
135
toTypstPropsListTerm :: [(Text , Text )] -> Doc Text
135
136
toTypstPropsListTerm [] = " "
@@ -583,7 +584,7 @@ toLabel labelType ident
583
584
ident' = T. pack $ unEscapeString $ T. unpack ident
584
585
585
586
isIdentChar :: Char -> Bool
586
- isIdentChar c = isAlphaNum c || c == ' _' || c == ' -' || c == ' .' || c == ' :'
587
+ isIdentChar c = isXIDContinue c || c == ' _' || c == ' -' || c == ' .' || c == ' :'
587
588
588
589
toCite :: PandocMonad m => Citation -> TW m (Doc Text )
589
590
toCite cite = do
0 commit comments