Skip to content

Commit

Permalink
resolves asciidoctor#1795 don't insert page break between part and fi…
Browse files Browse the repository at this point in the history
…rst chapter if heading-part-break-after key in theme is avoid
  • Loading branch information
mojavelinux committed Jun 10, 2022
1 parent 376bbbe commit 8966f17
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Enhancements::
* add `save_theme` helper to work with a copy of the theme within a scope (#2196)
* add support for `scale` attribute or `iw` unit on `pdfwidth` attribute on image macros (#1933)
* add backlink from bibref on bibliography entry to first reference to that entry in the document (#1737)
* don't insert page break between part and first chapter if `heading-part-break-after` key in theme is `avoid` (#1795)

== 2.0.8 (2022-06-08) - @mojavelinux

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/theme/pages/heading.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ The doctype must be `book` for the `heading-part` keys to take effect.
|Key |Value Type |Example

|break-after
|`always` {vbar} `auto` +
|`always` {vbar} `avoid` {vbar} `auto` +
(default: `auto`)
|[source]
heading:
Expand Down
18 changes: 18 additions & 0 deletions spec/section_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,24 @@
(expect part2_text[:page_number]).to be 4
end

it 'should not add page break after part if heading-part-break-after key in theme is avoid' do
pdf = to_pdf <<~'EOS', pdf_theme: { heading_part_break_after: 'avoid' }, analyze: true
= Document Title
:doctype: book
= Part I
== Chapter in Part I
EOS

(expect pdf.pages).to have_size 2
part1_text = (pdf.find_text 'Part I')[0]
chapter1_text = (pdf.find_text 'Chapter in Part I')[0]
(expect part1_text[:page_number]).to be 2
(expect chapter1_text[:page_number]).to be 2
(expect part1_text[:y] - chapter1_text[:y]).to be < 50
end

it 'should support abstract defined as special section' do
pdf = to_pdf <<~'EOS', analyze: true
= Document Title
Expand Down

0 comments on commit 8966f17

Please sign in to comment.