data/pandoc.lua: fix docstrings

Change: minor
This commit is contained in:
Albert Krewinkel 2018-01-07 22:41:59 +01:00
parent f277ac1338
commit b6cec3da3f
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
2 changed files with 20 additions and 9 deletions

View file

@ -60,7 +60,9 @@ function Type:set_behavior (behavior)
end end
--- Create a new subtype, using the given table as base. --- Create a new subtype, using the given table as base.
-- @param obj type object -- @param name name of the new type
-- @param[opt] behavior behavioral object for the new type.
-- @return a new type
-- @local -- @local
function Type:make_subtype(name, behavior) function Type:make_subtype(name, behavior)
local newtype = setmetatable({}, self) local newtype = setmetatable({}, self)
@ -260,7 +262,6 @@ end
-- @section Block -- @section Block
--- Block elements --- Block elements
-- @type Block
M.Block = AstElement:make_subtype'Block' M.Block = AstElement:make_subtype'Block'
M.Block.__call = function (t, ...) M.Block.__call = function (t, ...)
return t:new(...) return t:new(...)
@ -435,7 +436,6 @@ M.Table = M.Block:create_constructor(
-- @section Inline -- @section Inline
--- Inline element class --- Inline element class
-- @type Inline
M.Inline = AstElement:make_subtype'Inline' M.Inline = AstElement:make_subtype'Inline'
M.Inline.__call = function (t, ...) M.Inline.__call = function (t, ...)
return t:new(...) return t:new(...)
@ -690,22 +690,29 @@ M.Superscript = M.Inline:create_constructor(
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- Helpers -- Element components
-- @section components
--- Check if the first element of a pair matches the given value.
-- @param x key value to be checked
-- @return function returning true iff first element of its argument matches x
-- @local
local function assoc_key_equals (x) local function assoc_key_equals (x)
return function (y) return y[1] == x end return function (y) return y[1] == x end
end end
-- Lookup a value in an associative list --- Lookup a value in an associative list
-- @function lookup -- @function lookup
-- @local
-- @tparam {{key, value},...} alist associative list -- @tparam {{key, value},...} alist associative list
-- @param key key for which the associated value is to be looked up -- @param key key for which the associated value is to be looked up
local function lookup(alist, key) local function lookup(alist, key)
return (List.find_if(alist, assoc_key_equals(key)) or {})[2] return (List.find_if(alist, assoc_key_equals(key)) or {})[2]
end end
-- Return an iterator which returns key-value pairs of an associative list. --- Return an iterator which returns key-value pairs of an associative list.
-- @function apairs -- @function apairs
-- @local
-- @tparam {{key, value},...} alist associative list -- @tparam {{key, value},...} alist associative list
local apairs = function (alist) local apairs = function (alist)
local i = 1 local i = 1
@ -721,8 +728,9 @@ local apairs = function (alist)
return nxt, nil, nil return nxt, nil, nil
end end
-- AttributeList, a metatable to allow table-like access to attribute lists --- AttributeList, a metatable to allow table-like access to attribute lists
-- represented by associative lists. -- represented by associative lists.
-- @local
local AttributeList = { local AttributeList = {
__index = function (t, k) __index = function (t, k)
if type(k) == "number" then if type(k) == "number" then
@ -748,10 +756,11 @@ local AttributeList = {
__pairs = apairs __pairs = apairs
} }
-- convert a table to an associative list. The order of key-value pairs in the --- Convert a table to an associative list. The order of key-value pairs in the
-- alist is undefined. The table should either contain no numeric keys or -- alist is undefined. The table should either contain no numeric keys or
-- already be an associative list. -- already be an associative list.
-- @tparam table associative list or table without numeric keys. -- @local
-- @tparam table tbl associative list or table without numeric keys.
-- @treturn table associative list -- @treturn table associative list
local to_alist = function (tbl) local to_alist = function (tbl)
if #tbl ~= 0 or next(tbl) == nil then if #tbl ~= 0 or next(tbl) == nil then

View file

@ -1172,6 +1172,8 @@ Lua functions for pandoc scripts.
Returns: strong element Returns: strong element
## Element components
[`Attr ([identifier[, classes[, attributes]]])`]{#Attr} [`Attr ([identifier[, classes[, attributes]]])`]{#Attr}
: Create a new set of attributes (Attr). : Create a new set of attributes (Attr).