@@ -33,6 +33,7 @@ module Text.Pandoc.Readers.Markdown ( readMarkdown,
34import Data.List ( transpose, sortBy, findIndex, intersperse, intercalate )
34import Data.List ( transpose, sortBy, findIndex, intersperse, intercalate )
35import qualified Data.Map as M
35import qualified Data.Map as M
36+import Data.Scientific (coefficient, base10Exponent)
36import Data.Ord ( comparing )
37import Data.Ord ( comparing )
37import Data.Char ( isAlphaNum, toLower )
38import Data.Char ( isAlphaNum, toLower )
38import Data.Maybe
39import Data.Maybe
@@ -285,7 +286,11 @@ toMetaValue opts x =
286yamlToMeta :: ReaderOptions -> Yaml.Value -> MetaValue
287yamlToMeta :: ReaderOptions -> Yaml.Value -> MetaValue
287yamlToMeta opts (Yaml.String t) = toMetaValue opts t
288yamlToMeta opts (Yaml.String t) = toMetaValue opts t
288−yamlToMeta _ (Yaml.Number n) = MetaString $ show n
289+yamlToMeta _ (Yaml.Number n)
290+ -- avoid decimal points for numbers that don't need them:
291+ | base10Exponent n >= 0 = MetaString $ show
292+ $ coefficient n * (10 ^ base10Exponent n)
293+ | otherwise = MetaString $ show n
289yamlToMeta _ (Yaml.Bool b) = MetaBool b
294yamlToMeta _ (Yaml.Bool b) = MetaBool b
290yamlToMeta opts (Yaml.Array xs) = B.toMetaValue $ map (yamlToMeta opts)
295yamlToMeta opts (Yaml.Array xs) = B.toMetaValue $ map (yamlToMeta opts)
291 $ V.toList xs
296 $ V.toList xs