git.iko.soy/typeable/pandoc
on master help sign in
data/pandoc.lua: fix documentation for global_filter
commitec068f23184188ab8aec2ab7c78901843aa5fd61 authorAlbert Krewinkel <albert@zeitkraut.de> dateFri 29 Dec 2017, 09:00 (9 years ago) parent710c658
2 files changed+9−20
data/pandoc.lua+5−5 doc/lua-filters.md+4−15
data/pandoc.lua+5−5
@@ -657,7 +657,6 @@ M.Superscript = M.Inline:create_constructor(
657657
658658------------------------------------------------------------------------
659659-- Helpers
660−-- @section helpers
661660
662661local function assoc_key_equals (x)
663662 return function (y) return y[1] == x end
@@ -671,7 +670,7 @@ local function lookup(alist, key)
671670 return (List.find_if(alist, assoc_key_equals(key)) or {})[2]
672671end
673672
674−--- Return an iterator which returns key-value pairs of an associative list.
673+-- Return an iterator which returns key-value pairs of an associative list.
675674-- @function apairs
676675-- @tparam {{key, value},...} alist associative list
677676local apairs = function (alist)
@@ -880,12 +879,13 @@ M.UpperAlpha = "UpperAlpha"
880879-- @return A list of filter functions
881880-- @usage
882881-- -- within a file defining a pandoc filter:
883−-- function Str(text)
884−-- return pandoc.Str(utf8.upper(text))
882+-- text = require 'text'
883+-- function Str(elem)
884+-- return pandoc.Str(text.upper(elem.text))
885885-- end
886886--
887887-- return {pandoc.global_filter()}
888−-- -- the above is equivallent to
888+-- -- the above is equivalent to
889889-- -- return {{Str = Str}}
890890function M.global_filter()
891891 local res = {}
doc/lua-filters.md+4−15
@@ -1172,18 +1172,6 @@ Lua functions for pandoc scripts.
11721172
11731173 Returns: strong element
11741174
1175−## Helpers
1176−
1177−[`apairs (value)`]{#apairs}
1178−
1179−: Return an iterator which returns key-value pairs of an
1180− associative list.
1181−
1182− Parameters:
1183−
1184− `value`:
1185− : },\...} alist associative list
1186−
11871175[`Attr ([identifier[, classes[, attributes]]])`]{#Attr}
11881176
11891177: Create a new set of attributes (Attr).
@@ -1347,12 +1335,13 @@ Lua functions for pandoc scripts.
13471335 Usage:
13481336
13491337 -- within a file defining a pandoc filter:
1350− function Str(text)
1351− return pandoc.Str(utf8.upper(text))
1338+ text = require 'text'
1339+ function Str(elem)
1340+ return pandoc.Str(text.upper(elem.text))
13521341 end
13531342
13541343 return {pandoc.global_filter()}
1355− -- the above is equivallent to
1344+ -- the above is equivalent to
13561345 -- return {{Str = Str}}
13571346
13581347# Module pandoc.utils