summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-04-27 04:34:05 -0600
committerDan Allen <dan.j.allen@gmail.com>2022-04-27 04:34:05 -0600
commita0faa7b3fb608a7aa25dcdef2ad57cdc558ab17f (patch)
treef0d625e8f6c9f4baea1ffb44ecc1a15089c86ac5
parent94cdbfd5ca9b392031dfe1e00ca6f51d3d64cba1 (diff)
don't call arrange_section if section title is hidden
-rw-r--r--CHANGELOG.adoc1
-rw-r--r--docs/modules/extend/pages/define-converter.adoc2
-rw-r--r--lib/asciidoctor/pdf/converter.rb5
3 files changed, 4 insertions, 4 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index 64e77a13..cd043160 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -23,6 +23,7 @@ Bug Fixes::
* keep closing quote with trailing ellipsis in text enclosed in typographic quotes (#321)
* collapse space in front of hidden index term (#2061)
* delete dests on page before deleting it (keeps generated PDF clean of obsolete destinations)
+* don't call `arrange_section` if section title is hidden
== 2.0.0.alpha.1 (2022-04-20) - @mojavelinux
diff --git a/docs/modules/extend/pages/define-converter.adoc b/docs/modules/extend/pages/define-converter.adoc
index d79eef67..f14078dc 100644
--- a/docs/modules/extend/pages/define-converter.adoc
+++ b/docs/modules/extend/pages/define-converter.adoc
@@ -100,7 +100,7 @@ If no content is written, it can advance to the next page before the section tit
[,ruby]
----
def arrange_section sect, title, opts = {}
- return if opts[:hidden] || @y >= (@margin_box.absolute_top / 3) # <1>
+ return if @y >= (@margin_box.absolute_top / 3) # <1>
orphaned = nil
dry_run single_page: true do # <2>
start_page = page
diff --git a/lib/asciidoctor/pdf/converter.rb b/lib/asciidoctor/pdf/converter.rb
index bae87b95..56f376bb 100644
--- a/lib/asciidoctor/pdf/converter.rb
+++ b/lib/asciidoctor/pdf/converter.rb
@@ -667,6 +667,7 @@ module Asciidoctor
hlevel = sect.level + 1
align = (@theme[%(heading_h#{hlevel}_align)] || @theme.heading_align || @base_align).to_sym
chapterlike = !(part = sectname == 'part') && (sectname == 'chapter' || (sect.document.doctype == 'book' && sect.level == 1))
+ hidden = true if sect.special && (sect.option? 'notitle')
hopts = { align: align, level: hlevel, part: part, chapterlike: chapterlike, outdent: !(part || chapterlike) }
if part
unless @theme.heading_part_break_before == 'auto'
@@ -674,14 +675,13 @@ module Asciidoctor
theme_font(:heading, level: hlevel) { start_new_part sect }
end
elsif chapterlike
- hopts[:hidden] = hidden = true if sect.special && (sect.option? 'notitle')
if @theme.heading_chapter_break_before != 'auto' ||
(@theme.heading_part_break_after == 'always' && sect == sect.parent.sections[0])
start_new = true
theme_font(:heading, level: hlevel) { start_new_chapter sect }
end
end
- arrange_section sect, title, hopts unless start_new || at_page_top?
+ arrange_section sect, title, hopts unless hidden || start_new || at_page_top?
# QUESTION: should we store pdf-page-start, pdf-anchor & pdf-destination in internal map?
sect.set_attr 'pdf-page-start', (start_pgnum = page_number)
# QUESTION: should we just assign the section this generated id?
@@ -2898,7 +2898,6 @@ module Asciidoctor
alias start_new_part start_new_chapter
def arrange_section sect, title, opts
- return if opts[:hidden]
if sect.option? 'breakable'
orphaned = nil
dry_run single_page: true do