-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support even more page break markers (#12)
- Loading branch information
Showing
4 changed files
with
44 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,33 @@ | ||
First page <!-- (custom html tag NEEDS the empty line) --> | ||
Page 1 | ||
|
||
<br-page/> | ||
Second page <!-- (custom html tag NEEDS the empty line) --> | ||
|
||
Page 2 | ||
|
||
<page-br/> | ||
Third page <!-- (used by OpenProject and CKEditor) --> | ||
|
||
Page 3 | ||
|
||
<br style="page-break-after: always;"/> | ||
|
||
Page 4 | ||
|
||
<br style="page-break-before: always;"/> | ||
Fourth page <!-- (used by many editors) --> | ||
|
||
Page 5 | ||
|
||
<div style="page-break-before: always;">Everything here <br-page/> is ignored</div> | ||
Fifth page <!-- (CKEditor default format) --> | ||
|
||
Page 6 | ||
|
||
<div style="page-break-after: always;">Everything here <br-page/> is ignored</div> | ||
|
||
Page 7 | ||
|
||
<div style="page-break-before: always;">Everything here <br-page/> is ignored</div> | ||
|
||
Page 8 | ||
|
||
<div class="page-break" style="page-break-before: always;"><span style="display: none"></span></div> | ||
Sixth page | ||
|
||
Page 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
require 'pdf_helpers' | ||
|
||
describe MarkdownToPDF::Text do | ||
describe MarkdownToPDF::Page do | ||
include_context 'with pdf' | ||
|
||
it 'creates page breaks' do | ||
generator.parse_file('page/breaks.md') | ||
expect_pdf([ | ||
{ x: 36.0, y: 747.384, text: "First page" }, | ||
{ x: 36.0, y: 747.384, text: "Second page" }, | ||
{ x: 36.0, y: 747.384, text: "Third page" }, | ||
{ x: 36.0, y: 747.384, text: "Fourth page" }, | ||
{ x: 36.0, y: 747.384, text: "Fifth page" }, | ||
{ x: 36.0, y: 747.384, text: "Sixth page" }]) | ||
{ x: 36.0, y: 747.384, text: "Page 1" }, | ||
{ x: 36.0, y: 747.384, text: "Page 2" }, | ||
{ x: 36.0, y: 747.384, text: "Page 3" }, | ||
{ x: 36.0, y: 747.384, text: "Page 4" }, | ||
{ x: 36.0, y: 747.384, text: "Page 5" }, | ||
{ x: 36.0, y: 747.384, text: "Page 6" }, | ||
{ x: 36.0, y: 747.384, text: "Page 7" }, | ||
{ x: 36.0, y: 747.384, text: "Page 8" }, | ||
{ x: 36.0, y: 747.384, text: "Page 9" }]) | ||
end | ||
end |