Lua: add constructors pandoc.Blocks and pandoc.Inlines

The functions convert their argument into a list of Block and Inline
values, respectively.
This commit is contained in:
Albert Krewinkel 2021-11-28 15:07:30 +01:00
parent 4874f2dbd2
commit b9222e5cb1
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
3 changed files with 44 additions and 1 deletions

View file

@ -2074,7 +2074,7 @@ format, and functions to filter and modify a subtree.
Returns: [MetaBool] object
## Blocks
## Block
[`BlockQuote (content)`]{#pandoc.blockquote}
@ -2254,6 +2254,20 @@ format, and functions to filter and modify a subtree.
Returns: [Table](#type-table) object
## Blocks
[`Blocks (block_like_elements)`]{#pandoc.blocks}
: Creates a [Blocks](#type-blocks) list.
Parameters:
`block_like_elements`:
: List where each element can be treated as a [Block]
value, or a single such value.
Returns: [Blocks] list
## Inline
[`Cite (content, citations)`]{#pandoc.cite}
@ -2543,6 +2557,27 @@ format, and functions to filter and modify a subtree.
Returns: [Underline](#type-underline) object
## Inlines
[`Inlines (inline_like_elements)`]{#pandoc.inlines}
: Converts its argument into an [Inlines](#type-inlines) list:
- copies a list of [Inline] elements into a fresh list; any
string `s` within the list is treated as `pandoc.Str(s)`;
- turns a single [Inline] into a singleton list;
- splits a string into `Str`-wrapped words, treating
interword spaces as `Space`s or `SoftBreak`s.
Parameters:
`inline_like_elements`:
: List where each element can be treated as an [Inline]
values, or just a single such value.
Returns: [Inlines] list
## Element components
[`Attr ([identifier[, classes[, attributes]]])`]{#pandoc.attr}

View file

@ -117,7 +117,9 @@ otherConstructors =
, mkMeta
, mkAttr
, mkAttributeList
, mkBlocks
, mkCitation
, mkInlines
, mkListAttributes
, mkSimpleTable

View file

@ -19,9 +19,15 @@ return {
test('pandoc.AttributeList is a function', function ()
assert.are_equal(type(pandoc.AttributeList), 'function')
end),
test('pandoc.Blocks is a function', function ()
assert.are_equal(type(pandoc.Blocks), 'function')
end),
test('pandoc.Citation is a function', function ()
assert.are_equal(type(pandoc.Citation), 'function')
end),
test('pandoc.Inlines is a function', function ()
assert.are_equal(type(pandoc.Inlines), 'function')
end),
test('pandoc.SimpleTable is a function', function ()
assert.are_equal(type(pandoc.SimpleTable), 'function')
end),