Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolves #2480 ensure indentation is preserved at page transition of index when media=prepress #2481

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Improvements::

Bug Fixes::

* ensure indentation is preserved at page transition of index when media=prepress; prevents margin from shifting to the left (#2480)
* correctly map all icons from FontAwesome 4 (#2373)
* resolve remote image in document title or section title with autogenerated ID
* keep caret between items in menu macro with previous item if items wrap
Expand Down
5 changes: 4 additions & 1 deletion lib/asciidoctor/pdf/ext/prawn/document/column_box.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ def move_past_bottom
initial_margins = doc.page.margins
parent_.move_past_bottom
if doc.page.margins != initial_margins
doc.bounds = self.class.new doc, parent_, [(margin_box = doc.margin_box).absolute_left, @y],
doc.bounds = bounds = self.class.new doc, parent_, [(margin_box = doc.margin_box).absolute_left, @y],
columns: @columns, reflow_margins: @reflow_margins, spacer: @spacer, width: margin_box.width, height: @height
# ensure indentation is preserved across page break
bounds.add_left_padding @total_left_padding if @total_left_padding > 0
bounds.add_right_padding @total_right_padding if @total_right_padding > 0
end
nil
end
Expand Down
60 changes: 60 additions & 0 deletions spec/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,66 @@
(expect s_category_text[:x]).to eql 36.0
end

# this happens if the term sits right on the page boundary and the hanging indent is still active
it 'should preserve indentation when recreating column box on subsequent pages' do
pdf_theme = {
page_margin: [50, 54],
page_margin_inner: 72,
page_margin_outer: 36,
}
pdf = to_pdf <<~'END', pdf_theme: pdf_theme, analyze: true
= Document Title
:doctype: book
:media: prepress
:notitle:
:pdf-page-size: A5

== Chapter

((foo)) and ((bar))

((yin)) and ((yang))

((tea)) and ((coffee))

((left)) and ((right))

((salt)) and ((pepper))

((up)) and ((down))

((sugar)) and ((spice))

((day)) and ((night))

((melody)) and ((harmony))

((inside)) and ((outside))

((forward)) and ((back))

((cake)) and ((icing))

((to that place where you wish to go)) and ((fro))

((apples)) and ((oranges))

((over)) and ((under))

((light)) and ((dark))

[index]
== Index
END

wrapped_text = pdf.find_unique_text 'to go, 1', page_number: 4
(expect wrapped_text).not_to be_nil
(expect wrapped_text[:x]).to eql 66.0
u_category_text = pdf.find_unique_text 'U', page_number: 4
(expect u_category_text).not_to be_nil
(expect u_category_text[:x]).to eql 36.0
end

it 'should preserve column count on subsequent pages' do
pdf_theme = {
page_margin: 36,
Expand Down
Loading