diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-02-28 23:05:35 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-02-28 23:05:35 -0800 |
commit | 6a6291d9e3c1ce9c3453318d87239b6f9260d924 (patch) | |
tree | a2f18fc4cff1a0db262a6600dfc8b3f2dd18ceef /src/Text/Pandoc/Readers | |
parent | 12b47656d4913bfa8161bcbe6440951e98b7704f (diff) | |
download | pandoc-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')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 11 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX/SIunitx.hs | 21 |
2 files changed, 16 insertions, 16 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index e63fbc185..304584072 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -62,7 +62,7 @@ import Text.Pandoc.Readers.LaTeX.Math (dollarsMath, inlineEnvironments, import Text.Pandoc.Readers.LaTeX.Table (tableEnvironments) import Text.Pandoc.Readers.LaTeX.Lang (polyglossiaLangToBCP47, babelLangToBCP47, setDefaultLanguage) -import Text.Pandoc.Readers.LaTeX.SIunitx +import Text.Pandoc.Readers.LaTeX.SIunitx (siunitxCommands) import Text.Pandoc.Shared import qualified Text.Pandoc.Translations as Translations import Text.Pandoc.Walk @@ -426,6 +426,7 @@ inlineCommands = M.union inlineLanguageCommands $ M.union (accentCommands tok) $ M.union (citationCommands inline) $ + M.union (siunitxCommands tok) $ M.fromList [ ("emph", extractSpaces emph <$> tok) , ("textit", extractSpaces emph <$> tok) @@ -594,14 +595,6 @@ inlineCommands = , ("Acfp", doAcronymPlural "full") , ("Acsp", doAcronymPlural "abbrv") , ("Aclp", doAcronymPlural "long") - -- siuntix - , ("si", skipopts *> dosi tok) - , ("SI", doSI tok) - , ("SIrange", doSIrange True tok) - , ("numrange", doSIrange False tok) - , ("numlist", doSInumlist) - , ("num", doSInum) - , ("ang", doSIang) -- hyphenat , ("bshyp", lit "\\\173") , ("fshyp", lit "/\173") 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 |