Repository navigation
docs(docx): show buildDocx, the export report and pinned bytes in the README and example - #1015
Merged
Merged
Conversation
… README and example The render-docx README showed only export(new DocxSemanticBackend()), and the example used it too: neither showed session.buildDocx(path), how to receive the report, or a configured backend. The README now opens on buildDocx, says that buildDocx / writeDocx / toDocxBytes build a default backend and so give no report and a live date, and shows DocxSemanticBackend.builder() .deterministic(true).reportSink(...). Three statements were false and are corrected: drawings are written as floating shapes, not left out; a layer stack takes more Word forms than columns; a line is a paragraph border only when level, untransformed and at most 12pt. WordExportExample exports through the configured backend and prints the report, so the committed word-export-companion.docx is the same bytes on every run. Its captions said the divider and badge stay PDF-only and that a nested list indents two spaces a level; they now say what Word gets. The title and nested markers drop characters Helvetica lacks, which the PDF printed as '?'. examples/README.md follows the example; the previews are regenerated.
…ross machines Apache POI ends the XML declaration of the parts it writes with the platform's line separator, so a deterministic export is the same bytes on every run on one platform only. The README, the recipe, the example and its CHANGELOG entry now say so. The example prints each note's severity, its caption gives the reason the report names the divider and the badge, and the README flags the convenience methods, the builder and the report as Experimental.
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
render-docx/README.mdshowed one way to export,doc.export(new DocxSemanticBackend(), file), andWordExportExampleused the same. Neither showedsession.buildDocx(path), how to receive theDocxExportReport, or a configured backend. The README named deterministic output only as a capability bullet.Three README statements were false:
DocxDrawings.of,DocxRuleTest#whatIsNotARuleIsDrawnAsAShapeWhereThePagePutsIt).DocxRules.MAX_RULE_POINTS); any other line is drawn as a shape.The example's own document was wrong as well. Its captions said the divider and the badge stay PDF-only, but the export writes them as a paragraph border and as a drawn shape holding its letters; the report run on it says so. A caption said nested lists indent two spaces a level, but they are a Word list level. The PDF also printed
?for→,◦and▪, which Helvetica lacks.buildDocx,writeDocxandtoDocxBytesbuild a default backend for each export (DocumentRenderingFacade.toSemanticBytes). So they have no report sink and stamp the export with the current date. The report and pinned clocks come only from a configuredDocxSemanticBackend. The example exports that way, which also makes its committed preview the same bytes on every run on one platform.The README's new determinism paragraph and the recipe said those bytes are the same "on every run and machine". They are the same on every run on one platform. Across platforms, the parts POI writes itself (
word/document.xml,styles.xml,numbering.xml,settings.xml,docProps/app.xml) end their XML declaration with the platform's line separator; on Windows that is ``, as measured on the committed file. Both now say so. The drift guard already reduces that difference, so the preview compares equal on the Linux runner.
What changed
Docs and the example only; no public API change.
render-docx/README.mddoc.buildDocx(Path), then says what the three convenience methods lack.export(backend, path)writes the file directly, not throughbuildDocx's replace-on-success, and throws a plainException.DocxSemanticBackend.builder().deterministic(true).reportSink(...).DocxExportReportnote holds (severity, subject, where, detail;bySubject(),count(...)) and what deterministic output pins, including the{date}caveat.drawing), or in a page zone (page zone content).WordExportExampledeterministic(true),reportSink) and prints the report by subject and path.buildDocxas the one-call form and what it lacks, and drops "poi-ooxml is optional".docs/recipes/docx-export.md: the determinism paragraph says "on one platform" and names the parts whose line separator differs.examples/README.md: the "Word export (DOCX)" section follows the example. It used to say charts become a data table and that dividers, shapes and barcodes stay PDF-only.assets/readme/examples/word-export-companion.{pdf,docx}: regenerated.CHANGELOG.md: v2.5.0 Documentation entry.Not touched:
web/examples.jsonstill carries the example's old one-line description. It is generated fromShowcaseMetadata, which already has the current one, and the release script regenerates it.docs/troubleshooting.mdhas older wording on DOCX shapes. It is left for its own change.Verification
WordExportExample, run twice in separate JVMs on Windows: the sameword-export-companion.docxbytes both times. The report prints 0 dropped and 6 approximated, each line with its severity: the nested list, the chart, the divider as a paragraph border, the badge (its form and its drawing) and line height. No missing-glyph warnings../mvnw -B -ntp test -f examples/pom.xml: 93 tests, 0 failures, includingCommittedAssetDriftTest(3) andAssetContentTest(13).word-export-companion.docxput back failsCommittedAssetDriftTest, which names the file../mvnw -B -ntp test -f qa/pom.xml '-Dtest=com/demcha/documentation/**': 28 tests, 0 failures, includingDocumentationSnippetCompileTest(6), which compiles both README snippets../mvnw -B -ntp test -pl :graph-compose-core '-Dtest=com/demcha/documentation/**': 172 tests, 0 failures.clean verify:install, examples 93/0, includingCommittedAssetDriftTest.