asciidoctor / asciidoctor-pdf

:page_with_curl: Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
https://docs.asciidoctor.org/pdf-converter/latest/
MIT License
1.14k stars 500 forks source link

Bottom table caption placement not honored when unbreakable or breakable option is set #2434

Closed mojavelinux closed 1 year ago

mojavelinux commented 1 year ago

If a theme configures the caption for tables to have the bottom placement (table-caption-end=bottom), this setting is not honored when the unbreakable or breakable option is set on the table. This happens even if the unbreakable behavior is never triggered.

mojavelinux commented 1 year ago

To support unbreakable on tables, this converter wraps the table in an open block container with the unbreakable option set, then relocates the title from the table to the open block.

There's no need to move the title to the container when the caption has the bottom placement since it will already get bundled with the table when computing its height. The fix here is rather simple. Don't move the title if the theme configures the caption to have the bottom placement. Then, it works as expected.

mojavelinux commented 1 year ago

I think this fix is only going to work fully when the unbreakable option is set on the table. The converter is not set up to be able to keep the caption with the table in the case the breakable option is set on the table. The caption will still appear below the table, but it will not attempt to prevent the caption from being orphaned on the next page.