git.iko.soy/typeable/pandoc
on master help sign in
data/pandoc.lua: fix docstrings

Change: minor

commitb6cec3da3fc598df8ee1e317e405a61fa145dfd8 authorAlbert Krewinkel <albert@zeitkraut.de> dateSun 7 Jan 2018, 22:41 (9 years ago) parentf277ac1
2 files changed+20−9
data/pandoc.lua+18−9 doc/lua-filters.md+2
data/pandoc.lua+18−9
@@ -60,7 +60,9 @@ function Type:set_behavior (behavior)
6060end
6161
6262--- Create a new subtype, using the given table as base.
63−-- @param obj type object
63+-- @param name name of the new type
64+-- @param[opt] behavior behavioral object for the new type.
65+-- @return a new type
6466-- @local
6567function Type:make_subtype(name, behavior)
6668 local newtype = setmetatable({}, self)
@@ -260,7 +262,6 @@ end
260262-- @section Block
261263
262264--- Block elements
263−-- @type Block
264265M.Block = AstElement:make_subtype'Block'
265266M.Block.__call = function (t, ...)
266267 return t:new(...)
@@ -435,7 +436,6 @@ M.Table = M.Block:create_constructor(
435436-- @section Inline
436437
437438--- Inline element class
438−-- @type Inline
439439M.Inline = AstElement:make_subtype'Inline'
440440M.Inline.__call = function (t, ...)
441441 return t:new(...)
@@ -690,22 +690,29 @@ M.Superscript = M.Inline:create_constructor(
690690
691691
692692------------------------------------------------------------------------
693−-- Helpers
693+-- Element components
694+-- @section components
694695
696+--- Check if the first element of a pair matches the given value.
697+-- @param x key value to be checked
698+-- @return function returning true iff first element of its argument matches x
699+-- @local
695700local function assoc_key_equals (x)
696701 return function (y) return y[1] == x end
697702end
698703
699−-- Lookup a value in an associative list
704+--- Lookup a value in an associative list
700705-- @function lookup
706+-- @local
701707-- @tparam {{key, value},...} alist associative list
702708-- @param key key for which the associated value is to be looked up
703709local function lookup(alist, key)
704710 return (List.find_if(alist, assoc_key_equals(key)) or {})[2]
705711end
706712
707−-- Return an iterator which returns key-value pairs of an associative list.
713+--- Return an iterator which returns key-value pairs of an associative list.
708714-- @function apairs
715+-- @local
709716-- @tparam {{key, value},...} alist associative list
710717local apairs = function (alist)
711718 local i = 1
@@ -721,8 +728,9 @@ local apairs = function (alist)
721728 return nxt, nil, nil
722729end
723730
724−-- AttributeList, a metatable to allow table-like access to attribute lists
731+--- AttributeList, a metatable to allow table-like access to attribute lists
725732-- represented by associative lists.
733+-- @local
726734local AttributeList = {
727735 __index = function (t, k)
728736 if type(k) == "number" then
@@ -748,10 +756,11 @@ local AttributeList = {
748756 __pairs = apairs
749757}
750758
751−-- convert a table to an associative list. The order of key-value pairs in the
759+--- Convert a table to an associative list. The order of key-value pairs in the
752760-- alist is undefined. The table should either contain no numeric keys or
753761-- already be an associative list.
754−-- @tparam table associative list or table without numeric keys.
762+-- @local
763+-- @tparam table tbl associative list or table without numeric keys.
755764-- @treturn table associative list
756765local to_alist = function (tbl)
757766 if #tbl ~= 0 or next(tbl) == nil then
doc/lua-filters.md+2
@@ -1172,6 +1172,8 @@ Lua functions for pandoc scripts.
11721172
11731173 Returns: strong element
11741174
1175+## Element components
1176+
11751177[`Attr ([identifier[, classes[, attributes]]])`]{#Attr}
11761178
11771179: Create a new set of attributes (Attr).