data/pandoc.lua: fix documentation for global_filter

This commit is contained in:
Albert Krewinkel 2017-12-29 09:00:00 +01:00
parent 710c658d4f
commit ec068f2318
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
2 changed files with 9 additions and 20 deletions

View file

@ -657,7 +657,6 @@ M.Superscript = M.Inline:create_constructor(
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- Helpers -- Helpers
-- @section helpers
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
@ -671,7 +670,7 @@ 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
-- @tparam {{key, value},...} alist associative list -- @tparam {{key, value},...} alist associative list
local apairs = function (alist) local apairs = function (alist)
@ -880,12 +879,13 @@ M.UpperAlpha = "UpperAlpha"
-- @return A list of filter functions -- @return A list of filter functions
-- @usage -- @usage
-- -- within a file defining a pandoc filter: -- -- within a file defining a pandoc filter:
-- function Str(text) -- text = require 'text'
-- return pandoc.Str(utf8.upper(text)) -- function Str(elem)
-- return pandoc.Str(text.upper(elem.text))
-- end -- end
-- --
-- return {pandoc.global_filter()} -- return {pandoc.global_filter()}
-- -- the above is equivallent to -- -- the above is equivalent to
-- -- return {{Str = Str}} -- -- return {{Str = Str}}
function M.global_filter() function M.global_filter()
local res = {} local res = {}

View file

@ -1172,18 +1172,6 @@ Lua functions for pandoc scripts.
Returns: strong element Returns: strong element
## Helpers
[`apairs (value)`]{#apairs}
: Return an iterator which returns key-value pairs of an
associative list.
Parameters:
`value`:
: },\...} alist associative list
[`Attr ([identifier[, classes[, attributes]]])`]{#Attr} [`Attr ([identifier[, classes[, attributes]]])`]{#Attr}
: Create a new set of attributes (Attr). : Create a new set of attributes (Attr).
@ -1347,12 +1335,13 @@ Lua functions for pandoc scripts.
Usage: Usage:
-- within a file defining a pandoc filter: -- within a file defining a pandoc filter:
function Str(text) text = require 'text'
return pandoc.Str(utf8.upper(text)) function Str(elem)
return pandoc.Str(text.upper(elem.text))
end end
return {pandoc.global_filter()} return {pandoc.global_filter()}
-- the above is equivallent to -- the above is equivalent to
-- return {{Str = Str}} -- return {{Str = Str}}
# Module pandoc.utils # Module pandoc.utils