Lua: re-add content property to Strikeout elements

Fixes a regression introduced in 2.15.
This commit is contained in:
Albert Krewinkel 2021-11-02 21:22:59 +01:00
parent cce49c5d4b
commit 421fd736d4
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
2 changed files with 95 additions and 3 deletions

View file

@ -625,6 +625,7 @@ setInlineContent = \case
Quoted qt _ -> Actual . Quoted qt . inlineContent Quoted qt _ -> Actual . Quoted qt . inlineContent
SmallCaps _ -> Actual . SmallCaps . inlineContent SmallCaps _ -> Actual . SmallCaps . inlineContent
Span attr _ -> Actual . Span attr . inlineContent Span attr _ -> Actual . Span attr . inlineContent
Strikeout _ -> Actual . Strikeout . inlineContent
Strong _ -> Actual . Strong . inlineContent Strong _ -> Actual . Strong . inlineContent
Subscript _ -> Actual . Subscript . inlineContent Subscript _ -> Actual . Subscript . inlineContent
Superscript _ -> Actual . Superscript . inlineContent Superscript _ -> Actual . Superscript . inlineContent
@ -651,6 +652,7 @@ getInlineContent = \case
Quoted _ inlns -> Actual $ ContentInlines inlns Quoted _ inlns -> Actual $ ContentInlines inlns
SmallCaps inlns -> Actual $ ContentInlines inlns SmallCaps inlns -> Actual $ ContentInlines inlns
Span _ inlns -> Actual $ ContentInlines inlns Span _ inlns -> Actual $ ContentInlines inlns
Strikeout inlns -> Actual $ ContentInlines inlns
Strong inlns -> Actual $ ContentInlines inlns Strong inlns -> Actual $ ContentInlines inlns
Subscript inlns -> Actual $ ContentInlines inlns Subscript inlns -> Actual $ ContentInlines inlns
Superscript inlns -> Actual $ ContentInlines inlns Superscript inlns -> Actual $ ContentInlines inlns

View file

@ -191,14 +191,49 @@ return {
assert.are_equal(pandoc.Code('1 + 1'), code) assert.are_equal(pandoc.Code('1 + 1'), code)
end), end),
}, },
group 'Emph' {
test('has property `content`', function ()
local elem = pandoc.Emph{'two', pandoc.Space(), 'words'}
assert.are_same(
elem.content,
{pandoc.Str 'two', pandoc.Space(), pandoc.Str 'words'}
)
elem.content = {'word'}
assert.are_equal(elem, pandoc.Emph{'word'})
end)
},
group 'Image' { group 'Image' {
test('has property `caption`', function () test('has property `caption`', function ()
local img = pandoc.Image('example', 'a.png') local img = pandoc.Image('example', 'a.png')
assert.are_same(img.caption, {pandoc.Str 'example'}) assert.are_same(img.caption, {pandoc.Str 'example'})
img.caption = {pandoc.Str 'A'} img.caption = 'A'
assert.are_equal(img, pandoc.Image({pandoc.Str 'A'}, 'a.png')) assert.are_equal(img, pandoc.Image({'A'}, 'a.png'))
end), end),
test('has property `src`', function ()
local img = pandoc.Image('example', 'sample.png')
assert.are_same(img.src, 'sample.png')
img.src = 'example.svg'
assert.are_equal(img, pandoc.Image('example', 'example.svg'))
end),
test('has property `title`', function ()
local img = pandoc.Image('here', 'img.gif', 'example')
assert.are_same(img.title, 'example')
img.title = 'a'
assert.are_equal(img, pandoc.Image('here', 'img.gif', 'a'))
end),
test('has property `attr`', function ()
local img = pandoc.Image('up', 'upwards.png', '', {'up', {'point'}})
assert.are_same(img.attr, pandoc.Attr {'up', {'point'}})
img.attr = pandoc.Attr {'up', {'point', 'button'}}
assert.are_equal(
pandoc.Image('up', 'upwards.png', nil, {'up', {'point', 'button'}}),
img
)
end)
}, },
group 'Link' { group 'Link' {
test('has property `content`', function () test('has property `content`', function ()
@ -233,7 +268,62 @@ return {
link link
) )
end) end)
} },
group 'Strikeout' {
test('has property `content`', function ()
local elem = pandoc.Strikeout{'two', pandoc.Space(), 'words'}
assert.are_same(
elem.content,
{pandoc.Str 'two', pandoc.Space(), pandoc.Str 'words'}
)
elem.content = {'word'}
assert.are_equal(elem, pandoc.Strikeout{'word'})
end)
},
group 'Strong' {
test('has property `content`', function ()
local elem = pandoc.Strong{'two', pandoc.Space(), 'words'}
assert.are_same(
elem.content,
{pandoc.Str 'two', pandoc.Space(), pandoc.Str 'words'}
)
elem.content = {'word'}
assert.are_equal(elem, pandoc.Strong{'word'})
end)
},
group 'Subscript' {
test('has property `content`', function ()
local elem = pandoc.Subscript{'two', pandoc.Space(), 'words'}
assert.are_same(
elem.content,
{pandoc.Str 'two', pandoc.Space(), pandoc.Str 'words'}
)
elem.content = {'word'}
assert.are_equal(elem, pandoc.Subscript{'word'})
end)
},
group 'Superscript' {
test('has property `content`', function ()
local elem = pandoc.Superscript{'two', pandoc.Space(), 'words'}
assert.are_same(
elem.content,
{pandoc.Str 'two', pandoc.Space(), pandoc.Str 'words'}
)
elem.content = {'word'}
assert.are_equal(elem, pandoc.Superscript{'word'})
end)
},
group 'Underline' {
test('has property `content`', function ()
local elem = pandoc.Underline{'two', pandoc.Space(), 'words'}
assert.are_same(
elem.content,
{pandoc.Str 'two', pandoc.Space(), pandoc.Str 'words'}
)
elem.content = {'word'}
assert.are_equal(elem, pandoc.Underline{'word'})
end)
},
}, },
group "Block elements" { group "Block elements" {
group 'BlockQuote' { group 'BlockQuote' {