Lua: be more forgiving when retrieving the Image caption
property
Fixes a regression introduced in 2.15.
This commit is contained in:
parent
70eeeca9c7
commit
cce49c5d4b
2 changed files with 10 additions and 1 deletions
|
@ -710,7 +710,7 @@ typeInline = deftype "Inline"
|
|||
(pushPandocList pushInline, \case
|
||||
Image _ capt _ -> Actual capt
|
||||
_ -> Absent)
|
||||
(peekInlines, \case
|
||||
(peekInlinesFuzzy, \case
|
||||
Image attr _ target -> Actual . (\capt -> Image attr capt target)
|
||||
_ -> const Absent)
|
||||
, possibleProperty "citations" "list of citations"
|
||||
|
|
|
@ -191,6 +191,15 @@ return {
|
|||
assert.are_equal(pandoc.Code('1 + 1'), code)
|
||||
end),
|
||||
},
|
||||
group 'Image' {
|
||||
test('has property `caption`', function ()
|
||||
local img = pandoc.Image('example', 'a.png')
|
||||
assert.are_same(img.caption, {pandoc.Str 'example'})
|
||||
|
||||
img.caption = {pandoc.Str 'A'}
|
||||
assert.are_equal(img, pandoc.Image({pandoc.Str 'A'}, 'a.png'))
|
||||
end),
|
||||
},
|
||||
group 'Link' {
|
||||
test('has property `content`', function ()
|
||||
local link = pandoc.Link('example', 'https://example.org')
|
||||
|
|
Loading…
Reference in a new issue