summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2017-12-01 18:47:33 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2017-12-01 18:47:33 +0100
commit3f1f9536d4817bbdd797c01050a887fe4cdf347c (patch)
treeef19dd73fe957a4466d7f4f9465bc38807dcb945 /data
parent6640506ddc0ab848824d818a363c2e685b8b31a5 (diff)
pandoc.lua: set metatable on List MetaValues
The `List` metatable is assigned to the tables which get passed to the constructors `MetaBlocks`, `MetaInline`, and `MetaList`. This enables the use of the resulting objects as lists. This is part of the changes discussed in #4081.
Diffstat (limited to 'data')
-rw-r--r--data/pandoc.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/data/pandoc.lua b/data/pandoc.lua
index d8f7adb97..0c4b96f1c 100644
--- a/data/pandoc.lua
+++ b/data/pandoc.lua
@@ -185,25 +185,25 @@ end
--- Meta list
-- @function MetaList
-- @tparam {MetaValue,...} meta_values list of meta values
-
---- Meta map
--- @function MetaMap
--- @tparam table key_value_map a string-indexed map of meta values
-M.meta_value_types = {
+M.meta_value_list_types = {
"MetaBlocks",
"MetaInlines",
"MetaList",
- "MetaMap",
}
-for i = 1, #M.meta_value_types do
- M[M.meta_value_types[i]] = M.MetaValue:create_constructor(
- M.meta_value_types[i],
+for i = 1, #M.meta_value_list_types do
+ M[M.meta_value_list_types[i]] = M.MetaValue:create_constructor(
+ M.meta_value_list_types[i],
function(content)
- return content
+ return List:new(content)
end
)
end
+--- Meta map
+-- @function MetaMap
+-- @tparam table key_value_map a string-indexed map of meta values
+M.MetaValue:create_constructor("MetaMap", function (mm) return mm end)
+
--- Creates string to be used in meta data.
-- Does nothing, lua strings are meta strings.
-- @function MetaString