Repository navigation
Keep Word page breaks when importing DOCX - #175
Merged
Merged
Conversation
Pandoc drops Word page breaks, so imported documents lost them. Before pandoc runs, DocxPageBreaks replaces each manual page break and each paragraph with "Page break before" turned on with marker text. The new docx-page-break.lua filter splits paragraphs at the marker, bbx.lua writes it as bb:pageBreak, and FixPageBreak turns it into newPagesBefore on the next block, the same option the Page Break tool sets. A table gets the option on the table and its braille copy.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pandoc drops Word page breaks, so they were lost on DOCX import. Each
one now becomes a new page before the block that follows it.
DocxPageBreakscopies the docx before pandoc runs and replaces each<w:br w:type="page"/>, and each paragraph with "Page break before"turned on, with marker text.
docx-page-break.luasplits paragraphs at the marker and keeps thebreak outside Word's List-style blocks. A break inside formatting, a
list or a table moves to just before that block.
bbx.luawrites the break as<bb:pageBreak />.FixPageBreakturns it intobb:overrideOption-newPagesBeforeon thenext block, the option the Page Break tool sets. Tables get it on the
table and its braille copy. Two breaks in a row give 2 pages.
Paragraph styles with "page break before" in the style definition are
not handled.
Testing
PandocDocxPageBreakTest(7 tests) covers the statement fixture,breaks mid-paragraph, consecutive breaks, the "Page break before"
property, tables, a trailing break, and files with no breaks. It
passes, as do the existing list-style and definition-list pandoc tests.