git.iko.soy/typeable/pandoc
on master help sign in
Added support for MetaBool.
commit7d18770b008c12e13c324223304c6703e06f3a4a authorJohn MacFarlane <fiddlosopher@gmail.com> dateTue 6 Aug 2013, 23:31 (13 years ago) parent802a78b
3 files changed+4−1
src/Text/Pandoc/Readers/Markdown.hs+1−1 src/Text/Pandoc/Writers/Custom.hs+2 src/Text/Pandoc/Writers/Shared.hs+1
src/Text/Pandoc/Readers/Markdown.hs+1−1
@@ -278,7 +278,7 @@ toMetaValue opts x =
278278yamlToMeta :: ReaderOptions -> Yaml.Value -> MetaValue
279279yamlToMeta opts (Yaml.String t) = toMetaValue opts t
280280yamlToMeta _ (Yaml.Number n) = MetaString $ show n
281−yamlToMeta _ (Yaml.Bool b) = MetaString $ map toLower $ show b
281+yamlToMeta _ (Yaml.Bool b) = MetaBool b
282282yamlToMeta opts (Yaml.Array xs) = B.toMetaValue $ map (yamlToMeta opts)
283283 $ V.toList xs
284284yamlToMeta opts (Yaml.Object o) = MetaMap $ H.foldrWithKey (\k v m ->
src/Text/Pandoc/Writers/Custom.hs+2
@@ -110,12 +110,14 @@ instance StackValue [Block] where
110110instance StackValue MetaValue where
111111 push l (MetaMap m) = Lua.push l m
112112 push l (MetaList xs) = Lua.push l xs
113+ push l (MetaBool x) = Lua.push l x
113114 push l (MetaString s) = Lua.push l s
114115 push l (MetaInlines ils) = Lua.push l ils
115116 push l (MetaBlocks bs) = Lua.push l bs
116117 peek _ _ = undefined
117118 valuetype (MetaMap _) = Lua.TTABLE
118119 valuetype (MetaList _) = Lua.TTABLE
120+ valuetype (MetaBool _) = Lua.TBOOLEAN
119121 valuetype (MetaString _) = Lua.TSTRING
120122 valuetype (MetaInlines _) = Lua.TSTRING
121123 valuetype (MetaBlocks _) = Lua.TSTRING
src/Text/Pandoc/Writers/Shared.hs+1
@@ -74,6 +74,7 @@ metaValueToJSON blockWriter inlineWriter (MetaMap metamap) = liftM toJSON $
7474 Traversable.mapM (metaValueToJSON blockWriter inlineWriter) metamap
7575metaValueToJSON blockWriter inlineWriter (MetaList xs) = liftM toJSON $
7676 Traversable.mapM (metaValueToJSON blockWriter inlineWriter) xs
77+metaValueToJSON _ _ (MetaBool b) = return $ toJSON b
7778metaValueToJSON _ _ (MetaString s) = return $ toJSON s
7879metaValueToJSON blockWriter _ (MetaBlocks bs) = liftM toJSON $ blockWriter bs
7980metaValueToJSON _ inlineWriter (MetaInlines bs) = liftM toJSON $ inlineWriter bs