Migrate to document-schema.js 3 and read odt heading levels as headingLevel - #54
Merged
Conversation
The migration is dependency-only for odf.js: nothing here constructs a DocumentPackage or touches the frames surface, so no code moves with the bump. The one place that tracked the old content format by literal -- formula/read.test.ts asserting formatVersion toBe(2) -- now asserts the imported CONTENT_FORMAT_VERSION constant, matching the production readers that already stamp that constant on every emitted document, so the test tracks whatever the installed schema defines instead of a number that silently rots on the next format bump. BREAKING CHANGE: odf.js's emitted ContentDocuments now carry formatVersion 3, from document-schema.js 3.0.0's CONTENT_FORMAT_VERSION; consumers still validating odf.js output against document-schema.js 2 will reject the new documents.
readParagraphOrHeading parsed text:outline-level only to re-encode it into the docx-equivalent 'Heading<level>' styleId string, then discarded the number. The parsed value now also populates ContentParagraph.headingLevel, document-schema.js's canonical numeric heading field, so consumers that need the level as a number no longer have to parse it back out of styleId. styleId keeps its existing encoding unchanged; both derive from the same single parse and always agree.
Contributor
|
🎉 This PR is included in version 3.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Three changes in one PR.
document-schema.js ^2.7.17 -> ^3.0.0. The migration is dependency-only for odf.js: nothing here constructs a
DocumentPackageor touches the frames surface. The one test that tracked the content format by literal (formula/read.test.tsassertingformatVersiontoBe(2)— the failure red on the standalone bump PR) now asserts the importedCONTENT_FORMAT_VERSIONconstant, matching the production readers that already stamp that constant on every emitted document, so it tracks whatever the installed schema defines instead of a number that rots on the next bump.headingLevel (
Closes #52).readParagraphOrHeadingparsedtext:outline-levelonly to re-encode it into the docx-equivalent'Heading<level>'styleIdstring, then discarded the number. The parsed value now also populatesContentParagraph.headingLevelalongside the unchangedstyleIdencoding — both derive from the same single parse and always agree. The odt reader tests assert both fields on every heading fixture.Breaking marker. Emitted
ContentDocuments now carryformatVersion: 3(schema 3.0.0'sCONTENT_FORMAT_VERSION), so consumers still validating odf.js output against document-schema.js 2 will reject the new documents — that warrants the major, the same reasoning applied to the other codecs' schema-3 migrations.Supersedes #53 (the standalone
document-schema.js3.0.0 bump PR): this carries the same bump together with the test fix and the headingLevel population, so the standalone bump has nothing left to do.Generated by Claude Code