diff options
author | Albert Krewinkel <albert+github@zeitkraut.de> | 2018-07-30 19:55:25 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-07-30 10:55:25 -0700 |
commit | fb94c0f6a1b98d4f7ff34107d3b63c2c1d0afe1f (patch) | |
tree | eb0a736a0ced7d45e9ead922db35fb564f3e431e /doc | |
parent | bf56181204a6e5df919da24006ef8a58b595f76a (diff) | |
download | pandoc-fb94c0f6a1b98d4f7ff34107d3b63c2c1d0afe1f.tar.gz |
Lua Utils module: add function blocks_to_inlines (#4799)
Exposes a function converting which flattenes a list of blocks into a
list of inlines. An example use case would be the conversion of Note
elements into other inlines.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lua-filters.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md index 881c981f5..19428cde6 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -1438,6 +1438,37 @@ Lua functions for pandoc scripts. This module exposes internal pandoc functions and utility functions. +[`blocks_to_inlines (blocks[, sep])`]{#utils-blocks_to_inlines} + +: Squash a list of blocks into a list of inlines. + + Parameters: + + `blocks`: + : List of blocks to be flattened. + + `sep`: + : List of inlines inserted as separator between two + consecutive blocks; defaults to `{ pandoc.Space(), + pandoc.Str'¶', pandoc.Space()}`. + + Returns: + + - ({[Inline][#Inline]}) List of inlines + + Usage: + + local blocks = { + pandoc.Para{ pandoc.Str 'Paragraph1' }, + pandoc.Para{ pandoc.Emph 'Paragraph2' } + } + local inlines = pandoc.utils.blocks_to_inlines(blocks) + -- inlines = { + -- pandoc.Str 'Paragraph1', + -- pandoc.Space(), pandoc.Str'¶', pandoc.Space(), + -- pandoc.Emph{ pandoc.Str 'Paragraph2' } + -- } + [`hierarchicalize (blocks)`]{#utils-hierarchicalize} : Convert list of blocks into an hierarchical list. An |