Repository navigation
fix(docx): name in the report what a paragraph's own fields lose - #862
Merged
Merged
Conversation
An auto-sized paragraph was written at its style's size, a bulletOffset prefix's letters were never written and some paths wrote no prefix at all, and Word's outline listed a heading by its paragraph's text, not by its bookmark title. The paragraph's note now names the size the page fits its text to, the prefix's letters and the room a path leaves out, and an outline title, level or pair-side entry the file does not carry. The written bytes do not change.
…s line A pair's left side starts where its line does, prefix and all, and its right side loses the room only where a left tab holds its start; a text box or a badge loses it unless it is one line set from the end away from its prefix. A level past Word's ninth is named only where it shares the ninth with another. The written size is the one Word holds, to the half point; control characters and no-break spaces are read as the page reads them, and an empty later line takes no prefix.
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.
Why
DocxExportReportpromises to name every loss. For a paragraph's own fields it named none, while the Word file lost these:FIRST_LINE,ALL_LINES) and never written.HeadingN, which Word's outline lists by the text of its Word paragraph.DocxNodeFieldLedgerTestlistedautoSize,bulletOffsetandbookmarkOptionsas gaps — the latter two for their letters and title alone.What changed
paragraphLost(node, roomLost, listedAs)names the losses.ParagraphNodenote where something is lost.roomLost), and which text Word's outline lists the heading by (listedAs,nullwhere the path writes no level).writeParagraph: "written as a paragraph"; it writes a blank prefix as the indent, and the heading is listed by its own text.writeLinePair: "written as one side of a line it shares".fromItsStart); a right tab holds its end where the page ends it.applyHeadingRolegives the line's level to is listed by both sides' text.writeTextBadge: "written as its badge's text".writeTextOverTheFlow: the losses are added to its existing "laid over the flow…" note. For the badge and the text box, the room is lost unless the paragraph is one line set from the end away from its prefix (roomLostInItsBox): aligned right, or aligned left right to left, whose prefix stands at the right. Over more lines than one, Word breaks the lines without the room, and they take more words.zonesoption.textStyleis the paragraph's authored one; the size the page fits it to is on the text spans.autoSize.autoSize,bulletOffsetandbookmarkOptionsmove from a gap toREPORTED.zonesgap now names a zone paragraph's prefix, fitted size and outline entry. A zone line writes none of them.render-docx/README.md;Verification
./mvnw -B -ntp install -pl :graph-compose-render-docx→ BUILD SUCCESS: 1080 tests, 0 failures, 1 skipped (the property-gated fidelity probe).DocxParagraphReportTestis new, with 9 tests.FIRST_LINEandALL_LINES, and withFIRST_LINEin runs;FROM_SECOND_LINE);NONE;FROM_SECOND_LINEon one line;DocxFidelityCorpusTest -Dgraphcompose.docxFidelity=export, SHA-256 per file, 0 of 62 differ.EngineeringResume's auto-sized name ("JORDAN RIVERA") fits at its own 24.5pt. The proposals' blank prefixes are written as indents.-pl :graph-compose-core -Dtest='com.demcha.documentation.**'→ 166 tests, 0 failures;DocxPageZoneTest,DocxTransparentWrapperTest,TimelineRailAcrossBackendsTestandRtlAcrossBackendsTest→ 50 tests, 0 failures.Known limits
zonesoutput option.Lane: render-docx backend (report only, no change to what is written) plus tests and docs.