git.iko.soy/typeable/pandoc
on master help sign in
doc/lua-filter.md: document pandoc.utils.stringify
dd217f7Albert Krewinkel
doc/lua-filters.md+27−10
@@ -166,15 +166,17 @@ those elements accessible through the filter function parameter.
166
166
167Some pandoc functions have been made available in lua:
167Some pandoc functions have been made available in lua:
168
168
169−- `walk_block` and `walk_inline` allow filters to be applied
169+- [`walk_block`](#walk_block) and [`walk_inline`](#walk_inline)
170− inside specific block or inline elements.
170+ allow filters to be applied inside specific block or inline
171+ elements;
171−- `read` allows filters to parse strings into pandoc documents
172+- [`read`](#read) allows filters to parse strings into pandoc
173+ documents;
172−- `pipe` runs an external command with input from and output to
174+- [`pipe`](#pipe) runs an external command with input from and
173− strings
175+ output to strings;
174−- `sha1` generates a SHA1 hash
176+- [`sha1`](#utils-sha1) generates a SHA1 hash;
175−- The `mediabag` module allows access to the "mediabag,"
177+- the [`pandoc.mediabag`](#module-pandoc.mediabag) module allows
176− which stores binary content such as images that may be
178+ access to the "mediabag," which stores binary content such as
177− included in the final document.
179+ images that may be included in the final document.
178
180
179# Lua interpreter initialization
181# Lua interpreter initialization
180
182
@@ -1405,7 +1407,7 @@ Lua functions for pandoc scripts.
1405 -- the above is equivallent to
1407 -- the above is equivallent to
1406 -- return {{Str = Str}}
1408 -- return {{Str = Str}}
1407
1409
1408−[`pipe (command, args, input)`]{#mediabag-sha1}
1410+[`pipe (command, args, input)`]{#pipe}
1409
1411
1410: Runs command with arguments, passing it some input,
1412: Runs command with arguments, passing it some input,
1411 and returns the output.
1413 and returns the output.
@@ -1442,6 +1444,21 @@ functions.
1442
1444
1443 local fp = pandoc.utils.sha1("foobar")
1445 local fp = pandoc.utils.sha1("foobar")
1444
1446
1447+[`stringify (element)`]{#utils-stringify}
1448+
1449+: Converts the given element (Pandoc, Meta, Block, or Inline)
1450+ into a string with all formatting removed.
1451+
1452+ Returns:
1453+
1454+ - A plain string representation of the given element.
1455+
1456+ Usage:
1457+
1458+ local inline = pandoc.Emph{pandoc.Str 'Moin'}
1459+ -- outputs "Moin"
1460+ print(pandoc.utils.stringify(inline))
1461+
1445
1462
1446# Module pandoc.mediabag
1463# Module pandoc.mediabag
1447
1464