Fix spacing call sites for collection cardinality - #41
Draft
HassanAkbar wants to merge 5 commits into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Uniword’s handling of paragraph spacing to support Word’s behavior of emitting multiple w:spacing elements within a single w:pPr, and updates affected call sites and specs accordingly (related to lutaml-model collection/cardinality behavior).
Changes:
- Change
Wordprocessingml::ParagraphProperties#spacingto a collection and add#ensure_spacingfor safe mutation of the “first” spacing entry. - Update builder APIs and multiple specs to treat spacing as an array/collection.
- Add/extend round-trip tests to ensure repeated
w:spacingentries are preserved and thatStyle#spacing_before/aftercan find values across entries.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/uniword/wordprocessingml/styleset_roundtrip_spec.rb | Adjust spacing assertions for collection semantics; add private-fixture coverage for repeated w:spacing. |
| spec/uniword/wordprocessingml/styleset_integration_spec.rb | Update spacing access for collection (needs a robustness tweak per stored comment). |
| spec/uniword/wordprocessingml/style_roundtrip_spec.rb | Add fixture-free inline XML coverage for repeated w:spacing and spacing value lookup across entries. |
| spec/uniword/wordprocessingml/paragraph_enhanced_properties_spec.rb | Update spacing expectation to handle collection. |
| spec/uniword/wordprocessingml/line_spacing_spec.rb | Update spacing mutation/assertions to use ensure_spacing and collection access. |
| spec/uniword/properties/paragraph_properties_spec.rb | Add coverage for building/ensuring spacing entries and collection behavior. |
| spec/uniword/docx/reconciler_spec.rb | Update spacing access to tolerate collection. |
| spec/uniword/builder/style_builder_spec.rb | Update spacing expectations to use .first. |
| spec/uniword/builder/paragraph_builder_spec.rb | Update spacing expectations; add test ensuring spacing reuses the existing entry. |
| lib/uniword/wordprocessingml/style.rb | Update spacing_before/after to search across multiple spacing entries. |
| lib/uniword/wordprocessingml/paragraph_properties.rb | Make spacing a collection; add ensure_spacing; update flat-attribute conversion to build a single entry. |
| lib/uniword/builder/style_builder.rb | Update builder spacing setter to use ensure_spacing. |
| lib/uniword/builder/paragraph_builder.rb | Update builder spacing setter to use ensure_spacing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
HassanAkbar
marked this pull request as ready for review
August 11, 2026 15:30
HassanAkbar
marked this pull request as draft
August 11, 2026 15:34
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.
Metanorma PR checklist
Related to lutaml/lutaml-model#720
Fixes spec failurs in https://github.com/lutaml/lutaml-model/actions/runs/30433439998/job/90521685449?pr=720