diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-07-27 23:58:03 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2022-07-28 04:53:22 -0600 |
| commit | 6a80bb7eb043e103f7d7eaefaac10cd935fd46af (patch) | |
| tree | be64396d73b47045e620af77b930053ade5379f4 | |
| parent | 0e6eda40ff2c0de6507815756b6ee34cf7afd6aa (diff) | |
apply text transformation when checking height of heading for orphan prevention
| -rw-r--r-- | CHANGELOG.adoc | 4 | ||||
| -rw-r--r-- | lib/asciidoctor/pdf/converter.rb | 3 | ||||
| -rw-r--r-- | spec/section_spec.rb | 15 |
3 files changed, 20 insertions, 2 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 2ef481fc..3721a25d 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -7,7 +7,9 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co == Unreleased -_No changes since previous release._ +Bug Fixes:: + +* apply text transformation when checking height of heading for orphan prevention == 2.2.0 (2022-07-22) - @mojavelinux diff --git a/lib/asciidoctor/pdf/converter.rb b/lib/asciidoctor/pdf/converter.rb index 3dc1c0ea..76a59725 100644 --- a/lib/asciidoctor/pdf/converter.rb +++ b/lib/asciidoctor/pdf/converter.rb @@ -2479,7 +2479,7 @@ module Asciidoctor end %(#{anchor}<sup>[<a anchor="_footnotedef_#{index}">#{label}</a>]</sup>) elsif node.type == :xref - %(<sup><font color="#{theme.role_unresolved_font_color}">[#{node.text}]</font></sup>) + %(<sup>[<font color="#{theme.role_unresolved_font_color}">#{node.text}</font>]</sup>) else log :warn, %(unknown footnote type: #{node.type.inspect}) nil @@ -2827,6 +2827,7 @@ module Asciidoctor advance_page if orphaned else theme_font :heading, level: (hlevel = opts[:level]) do + title = transform_text title, @text_transform if @text_transform h_padding_t, h_padding_r, h_padding_b, h_padding_l = expand_padding_value @theme[%(heading_h#{hlevel}_padding)] h_fits = indent h_padding_l, h_padding_r do # FIXME: this height doesn't account for impact of text transform or inline formatting diff --git a/spec/section_spec.rb b/spec/section_spec.rb index 4cfa8a5f..aede4ab1 100644 --- a/spec/section_spec.rb +++ b/spec/section_spec.rb @@ -1050,6 +1050,21 @@ describe 'Asciidoctor::PDF::Converter - Section' do (expect content_text[:page_number]).to be 2 end + it 'should force section title with text transform to next page to keep with first line of section content' do + pdf = to_pdf <<~EOS, pdf_theme: { heading_text_transform: 'uppercase' }, analyze: true + image::tall.svg[pdfwidth=80mm] + + == A long heading with uppercase characters + + content + EOS + + section_text = pdf.find_unique_text %r/^A LONG HEADING/ + (expect section_text[:page_number]).to be 2 + content_text = pdf.find_unique_text 'content' + (expect content_text[:page_number]).to be 2 + end + it 'should not force section title to next page to keep with content if heading_min_height_after is zero' do pdf = to_pdf <<~EOS, pdf_theme: { heading_min_height_after: 0 }, analyze: true == Section A |
