aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorMarc Schreiber <schrieveslaach@online.de>2018-03-18 04:59:20 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2018-03-17 20:59:20 -0700
commit155a2ac0391e8b800d8d2ff0fb3ebe5e049ca278 (patch)
tree1f5cad382b91025f73334114deaa0fc7924b39f7 /src/Text/Pandoc/Readers
parent14cc82bcc7097351872dc233351627c90fb2a514 (diff)
downloadpandoc-155a2ac0391e8b800d8d2ff0fb3ebe5e049ca278.tar.gz
Add support to parse unit string of \SI command (closes #4296).
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 57d2803ba..7252a2da7 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -666,7 +666,7 @@ dosiunitx = do
skipopts
value <- tok
valueprefix <- option "" $ bracketed tok
- unit <- tok
+ unit <- inlineCommand' <|> tok
let emptyOr160 "" = ""
emptyOr160 _ = "\160"
return . mconcat $ [valueprefix,
@@ -675,6 +675,12 @@ dosiunitx = do
emptyOr160 unit,
unit]
+-- siunitx's \square command
+dosquare :: PandocMonad m => LP m Inlines
+dosquare = do
+ unit <- inlineCommand' <|> tok
+ return . mconcat $ [unit, "\178"]
+
lit :: String -> LP m Inlines
lit = pure . str
@@ -1468,6 +1474,13 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
, ("acsp", doAcronymPlural "abbrv")
-- siuntix
, ("SI", dosiunitx)
+ -- units of siuntix
+ , ("celsius", lit "°C")
+ , ("degreeCelsius", lit "°C")
+ , ("gram", lit "g")
+ , ("meter", lit "m")
+ , ("milli", lit "m")
+ , ("square", dosquare)
-- hyphenat
, ("bshyp", lit "\\\173")
, ("fshyp", lit "/\173")