Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline images don't work in normal table cells #295

Closed
mojavelinux opened this issue Aug 3, 2015 · 13 comments
Closed

Inline images don't work in normal table cells #295

mojavelinux opened this issue Aug 3, 2015 · 13 comments
Assignees

Comments

@mojavelinux
Copy link
Member

Inline images don't work in non-AsciiDoc table cells. Likely the callbacks for rendering inline images need to be registered specifically on the table cell so that they get invoked.

@mojavelinux mojavelinux self-assigned this Aug 3, 2015
@mojavelinux mojavelinux added this to the v1.5.0.beta.1 milestone Aug 3, 2015
@mojavelinux
Copy link
Member Author

Actually, they do work, so long as they fit within the table cell. If the image is too big to fit in the table cell, it will not show. The cell should be expanded in size to fit the image (or the restriction needs to be documented).

@mojavelinux
Copy link
Member Author

...so to reproduce the issue, make the image width sufficiently large.

@wingfire
Copy link

wingfire commented Jun 9, 2016

Do you have an easy way to adjust the height of the cell/row?

@mojavelinux
Copy link
Member Author

Not at the moment. The height adjusts based on the text content.

@mojavelinux
Copy link
Member Author

I gave my answer assuming you were asking whether it's possible to set the height from AsciiDoc. I'm sure there's a way we can tell Prawn to increase the height internally.

@davidfavor
Copy link
Member

Comments suggest this has been fixed + still appears broken.

This works...

image::/your-connection-is-not-private.jpg[]

This fails...

[cols="2*^"]
|===
|image::/your-connection-is-not-private.jpg[]|Cell #1-2
2+|Cell #2
|===

@davidfavor
Copy link
Member

Hum...

image: (one colon) seems to work + image:: (two colons) seems to fail.

@mojavelinux
Copy link
Member Author

You are correct. One colon is an inline image, and that works in table cells (with the exception that the image must fit within the size of the cell). Two colons is a block image and that doesn't work yet because Asciidoctor PDF doesn't yet support AsciiDoc table cells. See #6.

@mojavelinux
Copy link
Member Author

Even with the fix for #620 (and even #388), it seems like we have an ordering issue in the calculation. The image cell is trying to make a determination about the available space for the image and getting it wrong. I can't even quite determine how it is doing the calculation.

The best workaround is to size the image so it's small enough to fit in the cell.

@mojavelinux
Copy link
Member Author

Aha!!! I figured it out. When we set the font properties on the placeholder fragment, we aren't distributing the height correctly. This leads to a negative line gap, which causes the cell to not leave enough space for the image. I'll submit a patch to correct these assignments.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Dec 17, 2016
…n table cell

- correctly distribute font height so cell allocates enough room for inline image
- incorrect distribution was leading to a negative line_gap, which was making cell too small
- applies to images whose height exceeds the line height threshold
@lukesahula
Copy link

Is this issue really resolved? I am using Asciidoctor PDF 1.5.0.alpha.13 and I am experiencing exactly the same thing. I have a table with 2 columns, the first one containing an image, the second one its description. When the description is stretched across more lines, the image gets shown when it is small enough, but if its bigger, then there is an empty space even though the row itself is much higher than the text in the second column.

@mojavelinux
Copy link
Member Author

mojavelinux commented Nov 10, 2017

Could you please retest with the latest release of Asciidoctor PDF? The latest release is 1.5.0.alpha.16. This issue was resolved in alpha.14.

@lukesahula
Copy link

Right, my mistake, it is indeed working. Thank you for the answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants