aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/LaTeX
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-02-28 23:05:35 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-02-28 23:05:35 -0800
commit6a6291d9e3c1ce9c3453318d87239b6f9260d924 (patch)
treea2f18fc4cff1a0db262a6600dfc8b3f2dd18ceef /src/Text/Pandoc/Readers/LaTeX
parent12b47656d4913bfa8161bcbe6440951e98b7704f (diff)
downloadpandoc-6a6291d9e3c1ce9c3453318d87239b6f9260d924.tar.gz
Change T.P.Readers.LaTeX.SIunitx to export a command map...
instead of individual commands.
Diffstat (limited to 'src/Text/Pandoc/Readers/LaTeX')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX/SIunitx.hs21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs
index db9c276e7..1952f4e1a 100644
--- a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs
@@ -1,12 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
module Text.Pandoc.Readers.LaTeX.SIunitx
- ( dosi
- , doSI
- , doSIrange
- , doSInum
- , doSInumlist
- , doSIang
- )
+ ( siunitxCommands )
where
import Text.Pandoc.Builder
import Text.Pandoc.Readers.LaTeX.Parsing
@@ -21,6 +15,19 @@ import Data.Text (Text)
import qualified Data.Text as T
import Data.List (intersperse)
+
+siunitxCommands :: PandocMonad m
+ => LP m Inlines -> M.Map Text (LP m Inlines)
+siunitxCommands tok = M.fromList
+ [ ("si", skipopts *> dosi tok)
+ , ("SI", doSI tok)
+ , ("SIrange", doSIrange True tok)
+ , ("numrange", doSIrange False tok)
+ , ("numlist", doSInumlist)
+ , ("num", doSInum)
+ , ("ang", doSIang)
+ ]
+
dosi :: PandocMonad m => LP m Inlines -> LP m Inlines
dosi tok = grouped (siUnit tok) <|> siUnit tok