From 7054785ec100ea28d853deb7d3caf79b18bc4153 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Thu, 1 Sep 2022 01:58:51 -0600 Subject: resolves #2326 don't include bottom margin when computing heading height if heading-min-height-after theme key is empty (PR #2327) --- lib/asciidoctor/pdf/converter.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3