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.
This commit is contained in:
parent
6640506ddc
commit
3f1f9536d4
1 changed files with 14 additions and 14 deletions
|
@ -185,24 +185,24 @@ end
|
|||
--- Meta list
|
||||
-- @function MetaList
|
||||
-- @tparam {MetaValue,...} meta_values list of meta values
|
||||
M.meta_value_list_types = {
|
||||
"MetaBlocks",
|
||||
"MetaInlines",
|
||||
"MetaList",
|
||||
}
|
||||
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 List:new(content)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
--- Meta map
|
||||
-- @function MetaMap
|
||||
-- @tparam table key_value_map a string-indexed map of meta values
|
||||
M.meta_value_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],
|
||||
function(content)
|
||||
return content
|
||||
end
|
||||
)
|
||||
end
|
||||
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.
|
||||
|
|
Loading…
Add table
Reference in a new issue