diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-05-20 09:11:26 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-05-20 10:13:20 -0700 |
commit | 5dc917da3ed997c6e48e22bde242f0f8e1ae5333 (patch) | |
tree | 0816d3315b0130f5868511a873d239f59224676e /src | |
parent | 183ce584779b344ad6a6a3e085ddfdb00faf62aa (diff) | |
download | pandoc-5dc917da3ed997c6e48e22bde242f0f8e1ae5333.tar.gz |
LaTeX reader siunitx: add leading 0 to numbers starting with .
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX/SIunitx.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs index 5e140ef7a..1474329d4 100644 --- a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs +++ b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs @@ -83,8 +83,11 @@ parseNumPart = parseExp, parseSpace :: Parser Text () Inlines parseDecimalNum = try $ do pref <- option mempty $ (mempty <$ char '+') <|> ("\x2212" <$ char '-') - basenum <- (pref <>) . T.pack - <$> many1 (satisfy (\c -> isDigit c || c == '.')) + basenum' <- many1 (satisfy (\c -> isDigit c || c == '.')) + let basenum = pref <> T.pack + (case basenum' of + '.':_ -> '0':basenum' + _ -> basenum') uncertainty <- option mempty $ T.pack <$> parseParens if T.null uncertainty then return $ str basenum |