summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2017-12-29 09:04:21 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2017-12-29 09:04:21 +0100
commit820ee07f729e759d0e1da160c87b527881ee00e8 (patch)
treeeb31833c68c65d09d29be768a4b1fc19012cee76
parentec068f23184188ab8aec2ab7c78901843aa5fd61 (diff)
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.
-rw-r--r--doc/lua-filters.md75
1 files changed, 75 insertions, 0 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index 6e34acbd4..afa9b939f 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -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