aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2020-09-21 00:48:31 +0200
committerGitHub <noreply@github.com>2020-09-20 15:48:31 -0700
commitacbea6b8c610dba4b63c0f6063c51b26ab9d2b76 (patch)
tree2140ee75afafc3d87ca3d50c4cd989efec221a51 /data
parentb2decdfd1370b5291a6c1be758d4e0bfeaf9fcc7 (diff)
downloadpandoc-acbea6b8c610dba4b63c0f6063c51b26ab9d2b76.tar.gz
Lua filters: add SimpleTable for backwards compatibility (#6575)
A new type `SimpleTable` is made available to Lua filters. It is similar to the `Table` type in pandoc versions before 2.10; conversion functions from and to the new Table type are provided. Old filters using tables now require minimal changes and can use, e.g., if PANDOC_VERSION > {2,10,1} then pandoc.Table = pandoc.SimpleTable end and function Table (tbl) tbl = pandoc.utils.to_simple_table(tbl) … return pandoc.utils.from_simple_table(tbl) end to work with the current pandoc version.
Diffstat (limited to 'data')
-rw-r--r--data/pandoc.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/data/pandoc.lua b/data/pandoc.lua
index d031bf5d0..35ca20a84 100644
--- a/data/pandoc.lua
+++ b/data/pandoc.lua
@@ -1058,6 +1058,30 @@ M.ListAttributes.behavior.__pairs = function(t)
return make_next_function(fields), t, nil
end
+--
+-- Legacy and compatibility types
+--
+
+--- Creates a simple (old style) table element.
+-- @function SimpleTable
+-- @tparam {Inline,...} caption table caption
+-- @tparam {AlignDefault|AlignLeft|AlignRight|AlignCenter,...} aligns alignments
+-- @tparam {int,...} widths column widths
+-- @tparam {Block,...} headers header row
+-- @tparam {{Block,...}} rows table rows
+-- @treturn Block table element
+M.SimpleTable = function(caption, aligns, widths, headers, rows)
+ return {
+ caption = ensureInlineList(caption),
+ aligns = List:new(aligns),
+ widths = List:new(widths),
+ headers = List:new(headers),
+ rows = List:new(rows),
+ tag = "SimpleTable",
+ t = "SimpleTable",
+ }
+end
+
------------------------------------------------------------------------
-- Constants