diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-03-27 16:52:17 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-03-27 16:52:17 -0700 |
commit | 2138ef823921ae58a71c6ca367ccfac4e9367ff9 (patch) | |
tree | eaa5c5cf4669fd12bc4d759bdbb97bb5f31bf637 /src/Text/Pandoc | |
parent | 47aaad705af05514f30f4e85577b991afbf9eb8d (diff) | |
download | pandoc-2138ef823921ae58a71c6ca367ccfac4e9367ff9.tar.gz |
ipynb reader: avoid introducing spurious `.0` on integers in metadata.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Ipynb.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Ipynb.hs b/src/Text/Pandoc/Readers/Ipynb.hs index 58277be7a..6c8708409 100644 --- a/src/Text/Pandoc/Readers/Ipynb.hs +++ b/src/Text/Pandoc/Readers/Ipynb.hs @@ -23,6 +23,7 @@ import Data.List (isPrefixOf) import Data.Maybe (fromMaybe) import Data.Digest.Pure.SHA (sha1, showDigest) import Text.Pandoc.Options +import qualified Data.Scientific as Scientific import qualified Text.Pandoc.Builder as B import Text.Pandoc.Logging import Text.Pandoc.Definition @@ -209,7 +210,9 @@ jsonMetaToMeta = M.mapKeys T.unpack . M.map valueToMetaValue Success xs -> MetaList $ map valueToMetaValue xs valueToMetaValue (Bool b) = MetaBool b valueToMetaValue (String t) = MetaString (T.unpack t) - valueToMetaValue (Number n) = MetaString (show n) + valueToMetaValue (Number n) + | Scientific.isInteger n = MetaString (show (floor n :: Integer)) + | otherwise = MetaString (show n) valueToMetaValue Aeson.Null = MetaString "" jsonMetaToPairs :: JSONMeta -> [(String, String)] |