aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-05-03 22:41:24 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-05-03 22:41:24 -0700
commitc4a81fb941adf6c3bf524916c46623685d276f32 (patch)
tree1a541449e51ecd3df94c8528eb740a719c908ab5
parent8478997980cd5b9d791f8ab4af441786919cef5b (diff)
downloadpandoc-c4a81fb941adf6c3bf524916c46623685d276f32.tar.gz
metaToJSON: treat digits starting with 0 as a string...
not a number. Closes #5479.
-rw-r--r--src/Text/Pandoc/Writers/Shared.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
index 948308b50..e99758cba 100644
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -109,6 +109,9 @@ metaValueToJSON blockWriter inlineWriter (MetaMap metamap) = toJSON <$>
metaValueToJSON blockWriter inlineWriter (MetaList xs) = toJSON <$>
Traversable.mapM (metaValueToJSON blockWriter inlineWriter) xs
metaValueToJSON _ _ (MetaBool b) = return $ toJSON b
+metaValueToJSON _ inlineWriter (MetaString s@('0':_)) =
+ -- don't treat string with leading 0 as string (#5479)
+ toJSON <$> inlineWriter (Builder.toList (Builder.text s))
metaValueToJSON _ inlineWriter (MetaString s) =
case safeRead s of
Just (n :: Scientific) -> return $ Aeson.Number n