summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-09-01 01:58:51 -0600
committerGitHub <noreply@github.com>2022-09-01 01:58:51 -0600
commit7054785ec100ea28d853deb7d3caf79b18bc4153 (patch)
tree1109c7ed11c280d76c896b2ec7ce8ba5ad6f0c6b /lib
parent21d58dd534870a50cc72e83697e0619047ba9dba (diff)
resolves #2326 don't include bottom margin when computing heading height if heading-min-height-after theme key is empty (PR #2327)
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor/pdf/converter.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/asciidoctor/pdf/converter.rb b/lib/asciidoctor/pdf/converter.rb
index 21574349..b8ee8c01 100644
--- a/lib/asciidoctor/pdf/converter.rb
+++ b/lib/asciidoctor/pdf/converter.rb
@@ -2862,13 +2862,13 @@ module Asciidoctor
advance_page if orphaned
else
theme_font :heading, level: (hlevel = opts[:level]) do
+ if (space_below = ::Numeric === min_height_after ? min_height_after : 0) > 0 && (node.context == :section ? node.blocks? : !node.last_child?)
+ space_below += @theme[%(heading_h#{hlevel}_margin_bottom)] || @theme.heading_margin_bottom
+ end
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
- heading_h = (height_of_typeset_text title, inline_format: true, text_transform: @text_transform) +
- (@theme[%(heading_h#{hlevel}_margin_top)] || @theme.heading_margin_top) +
- (@theme[%(heading_h#{hlevel}_margin_bottom)] || @theme.heading_margin_bottom) + h_padding_t + h_padding_b
- heading_h += min_height_after if min_height_after && (node.context == :section ? node.blocks? : !node.last_child?)
- cursor >= heading_h
+ cursor >= (height_of_typeset_text title, inline_format: true, text_transform: @text_transform) +
+ h_padding_t + h_padding_b + (@theme[%(heading_h#{hlevel}_margin_top)] || @theme.heading_margin_top) + space_below
end
advance_page unless h_fits
end