aboutsummaryrefslogtreecommitdiff
path: root/test/lua
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2019-01-13 16:51:15 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2019-01-13 17:14:10 +0100
commit42a7b80c0479c83ed5300103a04545d5139f7a7e (patch)
tree4f3e314356eb68f62001da52d482b8183f541d45 /test/lua
parent9ac5b9d710b52395b43b04fb27ca80102268b547 (diff)
downloadpandoc-42a7b80c0479c83ed5300103a04545d5139f7a7e.tar.gz
data/pandoc.lua: auto-fix nested constructor arguments
Incorrect types to pandoc element constructors are automatically converted to the correct types when possible. This was already done for most constructors, but conversions are now also done for nested types (like lists of lists).
Diffstat (limited to 'test/lua')
-rw-r--r--test/lua/smart-constructors.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lua/smart-constructors.lua b/test/lua/smart-constructors.lua
new file mode 100644
index 000000000..6e579a12f
--- /dev/null
+++ b/test/lua/smart-constructors.lua
@@ -0,0 +1,10 @@
+-- Test that constructors are "smart" in that they autoconvert
+-- types where sensible.
+function Para (_)
+ return {
+ pandoc.BulletList{pandoc.Para "Hello", pandoc.Para "World"},
+ pandoc.DefinitionList{{"foo", pandoc.Para "placeholder"}},
+ pandoc.LineBlock{"Moin", "Welt"},
+ pandoc.OrderedList{pandoc.Plain{pandoc.Str "one"}, pandoc.Plain "two"}
+ }
+end