summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlotte Koch <dressupgeekout@gmail.com>2023-02-11 21:56:09 -0800
committerCharlotte Koch <dressupgeekout@gmail.com>2023-08-17 10:12:53 -0700
commitcfa0630cdf7a8cd11c6ed641d9b01fe585d5ff5d (patch)
tree61fcbe6eb716fc902f3252d061a251c24cd49ea1
parent1474131d87950ae15424c22ce5b11cefa5c2d229 (diff)
Do not write header on chapter-pages or part-pages, nor blank verso pages2.3.9-magentastripe
-rw-r--r--lib/asciidoctor/pdf/converter.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/asciidoctor/pdf/converter.rb b/lib/asciidoctor/pdf/converter.rb
index f9a4e0ee..fc5b1e48 100644
--- a/lib/asciidoctor/pdf/converter.rb
+++ b/lib/asciidoctor/pdf/converter.rb
@@ -144,6 +144,7 @@ module Asciidoctor
end
@label = :primary
@initial_instance_variables = [:@initial_instance_variables] + instance_variables
+ @invalid_header_pages = []
end
def convert node, name = nil, _opts = {}
@@ -3674,12 +3675,15 @@ module Asciidoctor
else
theme_font %(#{periphery}_#{side}_#{position}) do
# NOTE: minor optimization
- if content == '{page-number}'
+ if @invalid_header_pages.include?(page_number)
+ content = ""
+ elsif content == '{page-number}'
content = pagenums_enabled ? pgnum_label : nil
else
content = apply_subs_discretely doc, content, drop_lines_with_unresolved_attributes: true, imagesdir: @themesdir
content = transform_text content, @text_transform if @text_transform
end
+
formatted_text_box (parse_text content, inline_format: [normalize: true]),
at: [left, bounds.top - trim_styles[:padding][side][0] - trim_styles[:content_offset] + ((Array trim_styles[:valign])[0] == :center ? font.descender * 0.5 : 0)],
color: @font_color,
@@ -4380,10 +4384,18 @@ module Asciidoctor
end
end
+ # We also take this opportunity to record pages for which we do NOT
+ # want to write running-content: new parts or chapters, and also any
+ # blank verso pages that might have been caused by a new part or
+ # chapter.
def start_new_chapter chapter
start_new_page unless at_page_top?
# TODO: must call update_colors before advancing to next page if start_new_page is called in ink_chapter_title
- start_new_page if @ppbook && verso_page? && !(chapter.option? 'nonfacing')
+ if @ppbook && verso_page? && !(chapter.option? 'nonfacing')
+ start_new_page
+ @invalid_header_pages << (page_number - 1)
+ end
+ @invalid_header_pages << page_number
end
alias start_new_part start_new_chapter