diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2017-04-13 22:57:50 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2017-04-13 22:57:50 +0200 |
commit | 425df8fff435c105590986e1b85efbcca8986931 (patch) | |
tree | 609d5359e8536eb453f04d9f5f9b4ecfd6aba19d /data/pandoc.lua | |
parent | 00746c3c761d7dd64b06f1f432a26c1d4246624e (diff) | |
download | pandoc-425df8fff435c105590986e1b85efbcca8986931.tar.gz |
Use lua constructors to push meta values
Diffstat (limited to 'data/pandoc.lua')
-rw-r--r-- | data/pandoc.lua | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/data/pandoc.lua b/data/pandoc.lua index 8d4d89bcd..6e434d1e7 100644 --- a/data/pandoc.lua +++ b/data/pandoc.lua @@ -163,6 +163,48 @@ function M.Doc(blocks, meta) end +------------------------------------------------------------------------ +-- MetaValue +-- @section MetaValue +M.MetaValue = Element:make_subtype{} +M.MetaValue.__call = function(t, ...) + return t:new(...) +end +--- Meta blocks +-- @function MetaBlocks +-- @tparam {Block,...} blocks blocks +--- Meta inlines +-- @function MetaInlines +-- @tparam {Inline,...} inlines inlines +--- Meta list +-- @function MetaList +-- @tparam {MetaValue,...} meta_values list of meta values +--- Meta boolean +-- @function MetaBool +-- @tparam boolean bool boolean value +--- Meta map +-- @function MetaMap +-- @tparam table a string-index map of meta values +--- Meta string +-- @function MetaString +-- @tparam string str string value +M.meta_value_types = { + "MetaBlocks", + "MetaBool", + "MetaInlines", + "MetaList", + "MetaMap", + "MetaString" +} +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 {c = content} + end + ) +end + --- Inline element class -- @type Inline M.Inline = Element:make_subtype{} |