git.iko.soy/typeable/pandoc
on master help sign in
Lua Utils module: improve stringify
1b15913Albert Krewinkel
src/Text/Pandoc/Lua/Module/Utils.hs+9−2
@@ -32,10 +32,11 @@ module Text.Pandoc.Lua.Module.Utils
32
32
33import Prelude
33import Prelude
34import Control.Applicative ((<|>))
34import Control.Applicative ((<|>))
35+import Data.Char (toLower)
35import Data.Default (def)
36import Data.Default (def)
36import Foreign.Lua (Peekable, Lua, NumResults)
37import Foreign.Lua (Peekable, Lua, NumResults)
37import Text.Pandoc.Class (runIO, setUserDataDir)
38import Text.Pandoc.Class (runIO, setUserDataDir)
38−import Text.Pandoc.Definition (Pandoc, Meta, MetaValue, Block, Inline)
39+import Text.Pandoc.Definition (Pandoc, Meta, MetaValue (..), Block, Inline)
39import Text.Pandoc.Lua.StackInstances ()
40import Text.Pandoc.Lua.StackInstances ()
40import Text.Pandoc.Lua.Util (addFunction)
41import Text.Pandoc.Lua.Util (addFunction)
41
42
@@ -111,7 +112,13 @@ stringify el = return $ case el of
111 InlineElement i -> Shared.stringify i
112 InlineElement i -> Shared.stringify i
112 BlockElement b -> Shared.stringify b
113 BlockElement b -> Shared.stringify b
113 MetaElement m -> Shared.stringify m
114 MetaElement m -> Shared.stringify m
115+ MetaValueElement m -> stringifyMetaValue m
116+
117+stringifyMetaValue :: MetaValue -> String
118+stringifyMetaValue mv = case mv of
119+ MetaBool b -> map toLower (show b)
120+ MetaString s -> s
114− MetaValueElement m -> Shared.stringify m
121+ _ -> Shared.stringify mv
115
122
116data AstElement
123data AstElement
117 = PandocElement Pandoc
124 = PandocElement Pandoc