summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2023-03-26 03:02:45 -0600
committerDan Allen <dan.j.allen@gmail.com>2023-03-27 03:13:49 -0600
commitf55059ff788c4893b6be0c1a56ddb278f36e3b02 (patch)
tree132fae51e3ba265e601edc09fcacbd3a0bed6eea
parent99425296005b64b4c532f47f66e5eabefa4c50d5 (diff)
related to #2379 honor theme settings for caption on table with breakable or unbreakable option
-rw-r--r--CHANGELOG.adoc1
-rw-r--r--lib/asciidoctor/pdf/converter.rb2
-rw-r--r--spec/table_spec.rb19
3 files changed, 21 insertions, 1 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index b7e53f6c..17d5120a 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -15,6 +15,7 @@ Bug Fixes::
* do not drop section that follows empty index (#2368)
* restore bottom margin on table with `breakable` or `unbreakable` option (#2379)
+* honor theme settings for caption on table with `breakable` or `unbreakable` option (#2379)
== 2.3.4 (2022-10-29) - @mojavelinux
diff --git a/lib/asciidoctor/pdf/converter.rb b/lib/asciidoctor/pdf/converter.rb
index d7986a50..ba83f9f5 100644
--- a/lib/asciidoctor/pdf/converter.rb
+++ b/lib/asciidoctor/pdf/converter.rb
@@ -1245,7 +1245,7 @@ module Asciidoctor
if !at_page_top? && (has_title || id || (node.option? 'unbreakable'))
arrange_block node do
add_dest_for_block node if id
- tare_first_page_content_stream { ink_caption node, labeled: false } if has_title
+ tare_first_page_content_stream { ink_caption node, category: (node.style === 'table-container' ? :table : nil), labeled: false } if has_title
traverse node
end
else
diff --git a/spec/table_spec.rb b/spec/table_spec.rb
index 0f800b7c..c066029e 100644
--- a/spec/table_spec.rb
+++ b/spec/table_spec.rb
@@ -3265,5 +3265,24 @@ describe 'Asciidoctor::PDF::Converter - Table' do
margin_below = (table_text[:y] - after_text[:y]).round 2
(expect margin_below).to eql margin_above
end
+
+ it 'should honor theme settings for caption on table that is enclosed in container' do
+ pdf = to_pdf <<~END, pdf_theme: { table_caption_font_color: '00ffff', table_caption_align: 'center' }, analyze: true
+ before
+
+ .title
+ [%breakable]
+ |===
+ | will not be separated from title
+ |===
+
+ after
+ END
+
+ before_text = pdf.find_unique_text 'before'
+ title_text = pdf.find_unique_text 'Table 1. title'
+ (expect title_text[:font_color]).to eql '00FFFF'
+ (expect title_text[:x]).to be > before_text[:x]
+ end
end
end