Skip to content

Commit

Permalink
Inline: fix type of Image.caption.
Browse files Browse the repository at this point in the history
Fixed marshaling of image captions; they were previously pushed
incorrectly as sequences of type List instead of Inlines.
  • Loading branch information
tarleb committed Feb 14, 2022
1 parent 3a24794 commit 2a185ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Text/Pandoc/Lua/Marshal/Inline.hs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ typeInline = deftype "Inline"
_ -> const Absent)

, possibleProperty "caption" "image caption"
(pushPandocList pushInline, \case
(pushInlines, \case
Image _ capt _ -> Actual capt
_ -> Absent)
(peekInlinesFuzzy, \case
Expand Down
6 changes: 5 additions & 1 deletion test/test-inline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ return {
end)
},
group 'Image' {
test('has property `caption`', function ()
test('has property `caption` of type Inlines', function ()
local img = Image('example', 'a.png')
assert.are_same(img.caption, {Str 'example'})

img.caption = 'A'
assert.are_equal(img, Image({'A'}, 'a.png'))
assert.are_equal(
Image('example', 'a.png').caption,
Inlines('example')
)
end),
test('has property `src`', function ()
local img = Image('example', 'sample.png')
Expand Down

0 comments on commit 2a185ae

Please sign in to comment.