ipynb reader: avoid introducing spurious .0
on integers in metadata.
This commit is contained in:
parent
47aaad705a
commit
2138ef8239
2 changed files with 5 additions and 1 deletions
|
@ -375,6 +375,7 @@ library
|
|||
random >= 1 && < 1.2,
|
||||
pandoc-types >= 1.17.5 && < 1.18,
|
||||
aeson >= 0.7 && < 1.5,
|
||||
scientific >= 0.3 && < 0.4,
|
||||
aeson-pretty >= 0.8.5 && < 0.9,
|
||||
tagsoup >= 0.14.6 && < 0.15,
|
||||
base64-bytestring >= 0.1 && < 1.1,
|
||||
|
|
|
@ -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)]
|
||||
|
|
Loading…
Add table
Reference in a new issue