mirror of
https://github.com/dolanmiu/docx.git
synced 2026-11-30 16:47:55 +01:00
* feat(layout): lay out footnotes across pages in kept paragraphs, table rows and columns, and page references in them, as Word does word-watertight-notes.docx and word-page-fields.docx, saved from Word, settle the footnote stops left on line 3 of the stops report: - Paragraphs kept with the next that start a footnote's part on a page break as without them, as the text's do at the top of a page (FN9, FN10, FN12). - A table row in a footnote breaks between its cells' lines, as a row of the text does, with the rest at the top of the next page's footnotes (FN11), and Word's empty paragraph after a table that ends a note takes a line below it (FN11, FN12, SP3c). - A footnote too long for the columns of a page, whose reference would be at the top of a later column, gets as much room below the columns as leaves its reference on the page, found by laying the page out again with the room halved (FN3). - A page reference with \p in a footnote or endnote writes "on page" and the page, wherever its bookmark is (PF8). Where the evidence leaves something open, the layout stops: a row in a footnote across more than two pages, a footnote that starts with a row none of which fits, a note ending with a table where the note text style isn't formatted as Normal, and a long footnote in columns that no room leaves with its reference. word-notes-across-pages.ts probes them. * fix(layout): stop where a footnote's reference moves on and back in columns, rather than lay the page out forever A page in columns whose footnote moves its reference on to the next page (FN1) is laid out again without the footnote's room. Where the reference's line then lands at the top of a later column, it stays there, as at the top of any column, its footnote asks for the room again, and the reference moves on again, round and round: paginate never returned. Of 600 random 2-column documents with footnotes, master hung on 100. The layout now stops where a reference moves on a second time, as whether Word moves the line on from the top of a column, or what is above it too, isn't known. Guessing, it moves on. It also no longer lists a moved footnote twice.