git.iko.soy/typeable/pandoc
on master help sign in
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.

commit820ee07f729e759d0e1da160c87b527881ee00e8 authorAlbert Krewinkel <albert@zeitkraut.de> dateFri 29 Dec 2017, 09:04 (9 years ago) parentec068f2
1 file changed+75
doc/lua-filters.md+75
doc/lua-filters.md+75
@@ -1344,6 +1344,81 @@ Lua functions for pandoc scripts.
13441344 -- the above is equivalent to
13451345 -- return {{Str = Str}}
13461346
1347+[`pipe (command, args, input)`]{#pipe}
1348+
1349+: Runs command with arguments, passing it some input, and
1350+ returns the output.
1351+
1352+ Returns:
1353+
1354+ - Output of command.
1355+
1356+ Raises:
1357+
1358+ - A table containing the keys `command`, `error_code`, and
1359+ `output` is thrown if the command exits with a non-zero
1360+ error code.
1361+
1362+ Usage:
1363+
1364+ local output = pandoc.pipe("sed", {"-e","s/a/b/"}, "abc")
1365+
1366+[`walk_block (element, filter)`]{#walk_block}
1367+
1368+: Apply a filter inside a block element, walking its
1369+ contents.
1370+
1371+ Parameters:
1372+
1373+ `element`:
1374+ : the block element
1375+
1376+ `filter`:
1377+ : a lua filter (table of functions) to be applied
1378+ within the block element
1379+
1380+ Returns: the transformed block element
1381+
1382+[`walk_inline (element, filter)`]{#walk_inline}
1383+
1384+: Apply a filter inside an inline element, walking its
1385+ contents.
1386+
1387+ Parameters:
1388+
1389+ `element`:
1390+ : the inline element
1391+
1392+ `filter`:
1393+ : a lua filter (table of functions) to be applied
1394+ within the inline element
1395+
1396+ Returns: the transformed inline element
1397+
1398+[`read (markup[, format])`]{#read}
1399+
1400+: Parse the given string into a Pandoc document.
1401+
1402+ Parameters:
1403+
1404+ `markup`:
1405+ : the markup to be parsed
1406+
1407+ `format`:
1408+ : format specification, defaults to \"markdown\".
1409+
1410+ Returns: pandoc document
1411+
1412+ Usage:
1413+
1414+ local org_markup = "/emphasis/" -- Input to be read
1415+ local document = pandoc.read(org_markup, "org")
1416+ -- Get the first block of the document
1417+ local block = document.blocks[1]
1418+ -- The inline element in that block is an `Emph`
1419+ assert(block.content[1].t == "Emph")
1420+
1421+
13471422# Module pandoc.utils
13481423
13491424This module exposes internal pandoc functions and utility