Test Lua filter converting display math to inline math
This commit is contained in:
parent
5ce91a7e01
commit
4139e3e92b
2 changed files with 18 additions and 1 deletions
|
@ -12,7 +12,8 @@ import Test.Tasty.QuickCheck (QuickCheckTests (..), ioProperty, testProperty)
|
|||
import Text.Pandoc.Arbitrary ()
|
||||
import Text.Pandoc.Builder (bulletList, divWith, doc, doubleQuoted, emph,
|
||||
header, linebreak, para, plain, rawBlock,
|
||||
singleQuoted, space, str, strong)
|
||||
singleQuoted, space, str, strong,
|
||||
math, displayMath)
|
||||
import Text.Pandoc.Class (runIOorExplode, setUserDataDir)
|
||||
import Text.Pandoc.Definition (Block (BlockQuote, Div, Para), Inline (Emph, Str),
|
||||
Attr, Meta, Pandoc, pandocTypesVersion)
|
||||
|
@ -48,6 +49,12 @@ tests = map (localOption (QuickCheckTests 20))
|
|||
(doc $ bulletList [plain (str "alfa"), plain (str "bravo")])
|
||||
(doc $ bulletList [para (str "alfa"), para (str "bravo")])
|
||||
|
||||
, testCase "convert display math to inline math" $
|
||||
assertFilterConversion "display math becomes inline math"
|
||||
"math.lua"
|
||||
(doc $ para (displayMath "5+5"))
|
||||
(doc $ para (math "5+5"))
|
||||
|
||||
, testCase "make hello world document" $
|
||||
assertFilterConversion "Document contains 'Hello, World!'"
|
||||
"hello-world-doc.lua"
|
||||
|
|
10
test/lua/math.lua
Normal file
10
test/lua/math.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
{
|
||||
Math = function (elem)
|
||||
if elem.mathtype == "DisplayMath" then
|
||||
elem.mathtype = "InlineMath"
|
||||
end
|
||||
return elem
|
||||
end,
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue