diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2018-01-13 23:05:42 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2018-01-13 23:24:13 +0100 |
commit | 2c7160455484a625fd7398f018085f7b4aaf995a (patch) | |
tree | fce8de6ff64aca0ced2fc875da0f70cd3ddfd5e8 /test | |
parent | e0cb0dab1821e93e50e8b8006ef569bdeee9a248 (diff) | |
download | pandoc-2c7160455484a625fd7398f018085f7b4aaf995a.tar.gz |
data/pandoc.lua: add attr, listAttributes accessors
Elements with attributes got an additional `attr` accessor. Attributes
were accessible only via the `identifier`, `classes`, and `attributes`,
which was in conflict with the documentation, which indirectly states
that such elements have the an `attr` property.
Diffstat (limited to 'test')
-rw-r--r-- | test/Tests/Lua.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs index d728cb9d0..b25a6fa4a 100644 --- a/test/Tests/Lua.hs +++ b/test/Tests/Lua.hs @@ -12,8 +12,8 @@ import Text.Pandoc.Builder (bulletList, divWith, doc, doubleQuoted, emph, header, linebreak, para, plain, rawBlock, singleQuoted, space, str, strong, (<>)) import Text.Pandoc.Class (runIOorExplode, setUserDataDir) -import Text.Pandoc.Definition (Block (BlockQuote, Para), Inline (Emph, Str), - Meta, Pandoc, pandocTypesVersion) +import Text.Pandoc.Definition (Block (BlockQuote, Div, Para), Inline (Emph, Str), + Attr, Meta, Pandoc, pandocTypesVersion) import Text.Pandoc.Lua (runLuaFilter, runPandocLua) import Text.Pandoc.Options (def) import Text.Pandoc.Shared (pandocVersion) @@ -139,6 +139,13 @@ tests = map (localOption (QuickCheckTests 20)) Lua.peek Lua.stackTop ) + , testCase "Elements with Attr have `attr` accessor" . runPandocLua' $ do + Lua.push (Div ("hi", ["moin"], []) + [Para [Str "ignored"]]) + Lua.getfield Lua.stackTop "attr" + Lua.liftIO . assertEqual "no accessor" (("hi", ["moin"], []) :: Attr) + =<< Lua.peek Lua.stackTop + , testCase "informative error messages" . runPandocLua' $ do Lua.pushboolean True err <- Lua.peekEither Lua.stackTop :: Lua.Lua (Either String Pandoc) |