aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2017-12-29 09:00:00 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2017-12-29 09:02:25 +0100
commitec068f23184188ab8aec2ab7c78901843aa5fd61 (patch)
tree8e4bf1837bc7f3624bacf255db42edc1ac2101e1
parent710c658d4fffb43b0005a6cb126307b387091d2e (diff)
downloadpandoc-ec068f23184188ab8aec2ab7c78901843aa5fd61.tar.gz
data/pandoc.lua: fix documentation for global_filter
-rw-r--r--data/pandoc.lua10
-rw-r--r--doc/lua-filters.md19
2 files changed, 9 insertions, 20 deletions
diff --git a/data/pandoc.lua b/data/pandoc.lua
index d9375af2d..551a59d27 100644
--- a/data/pandoc.lua
+++ b/data/pandoc.lua
@@ -657,7 +657,6 @@ M.Superscript = M.Inline:create_constructor(
------------------------------------------------------------------------
-- Helpers
--- @section helpers
local function assoc_key_equals (x)
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]
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
-- @tparam {{key, value},...} alist associative list
local apairs = function (alist)
@@ -880,12 +879,13 @@ M.UpperAlpha = "UpperAlpha"
-- @return A list of filter functions
-- @usage
-- -- within a file defining a pandoc filter:
--- function Str(text)
--- return pandoc.Str(utf8.upper(text))
+-- text = require 'text'
+-- function Str(elem)
+-- return pandoc.Str(text.upper(elem.text))
-- end
--
-- return {pandoc.global_filter()}
--- -- the above is equivallent to
+-- -- the above is equivalent to
-- -- return {{Str = Str}}
function M.global_filter()
local res = {}
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index c99625e67..6e34acbd4 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -1172,18 +1172,6 @@ Lua functions for pandoc scripts.
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}
: Create a new set of attributes (Attr).
@@ -1347,12 +1335,13 @@ Lua functions for pandoc scripts.
Usage:
-- within a file defining a pandoc filter:
- function Str(text)
- return pandoc.Str(utf8.upper(text))
+ text = require 'text'
+ function Str(elem)
+ return pandoc.Str(text.upper(elem.text))
end
return {pandoc.global_filter()}
- -- the above is equivallent to
+ -- the above is equivalent to
-- return {{Str = Str}}
# Module pandoc.utils