doc/lua-filters.md: re-add docs for helper functions

These docs are dropped, as the functions are no longer part of
data/pandoc.lua, from which this section is generated. This is only a
temporary fix: a proper fix will have to re-think how this section is
updated.
This commit is contained in:
Albert Krewinkel 2017-12-29 09:04:21 +01:00
parent ec068f2318
commit 820ee07f72
No known key found for this signature in database
GPG key ID: 388DC0B21F631124

View file

@ -1344,6 +1344,81 @@ Lua functions for pandoc scripts.
-- the above is equivalent to
-- return {{Str = Str}}
[`pipe (command, args, input)`]{#pipe}
: Runs command with arguments, passing it some input, and
returns the output.
Returns:
- Output of command.
Raises:
- A table containing the keys `command`, `error_code`, and
`output` is thrown if the command exits with a non-zero
error code.
Usage:
local output = pandoc.pipe("sed", {"-e","s/a/b/"}, "abc")
[`walk_block (element, filter)`]{#walk_block}
: Apply a filter inside a block element, walking its
contents.
Parameters:
`element`:
: the block element
`filter`:
: a lua filter (table of functions) to be applied
within the block element
Returns: the transformed block element
[`walk_inline (element, filter)`]{#walk_inline}
: Apply a filter inside an inline element, walking its
contents.
Parameters:
`element`:
: the inline element
`filter`:
: a lua filter (table of functions) to be applied
within the inline element
Returns: the transformed inline element
[`read (markup[, format])`]{#read}
: Parse the given string into a Pandoc document.
Parameters:
`markup`:
: the markup to be parsed
`format`:
: format specification, defaults to \"markdown\".
Returns: pandoc document
Usage:
local org_markup = "/emphasis/" -- Input to be read
local document = pandoc.read(org_markup, "org")
-- Get the first block of the document
local block = document.blocks[1]
-- The inline element in that block is an `Emph`
assert(block.content[1].t == "Emph")
# Module pandoc.utils
This module exposes internal pandoc functions and utility