Fixed collections for lutaml-model strict cardinality - #27
Merged
Conversation
…for lutaml-model strict cardinality
There was a problem hiding this comment.
Pull request overview
This PR updates Uniword’s OOXML model layer and specs to accommodate lutaml-model’s stricter cardinality handling by converting previously-scalar attributes into collections and standardizing access patterns (e.g., Run#text_string, Paragraph#style).
Changes:
- Make
Wordprocessingml::Run#textand#breakcollections, add#text_string, and update substitution/text-handling call sites. - Make
Wordprocessingml::ParagraphProperties#stylea collection (withStyleReference.cast) and update style consumers to use the first style reference consistently. - Update builders, converters, validators, and extensive specs/integration tests to use the new collection-based APIs.
Reviewed changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/uniword/wordprocessingml/run_spec.rb | Adjust run text assertions to use collection text and text_string. |
| spec/uniword/wordprocessingml/paragraph_spec.rb | Update paragraph style/text expectations for new APIs. |
| spec/uniword/wordprocessingml/paragraph_enhanced_properties_spec.rb | Update style access to use first style reference in collection. |
| spec/uniword/wordprocessingml/numbering_spec.rb | Update style access to use style.first. |
| spec/uniword/toc/toc_generator_spec.rb | Update run text extraction to use text_string. |
| spec/uniword/properties/paragraph_properties_spec.rb | Update paragraph properties style expectations for collection semantics. |
| spec/uniword/hyperlink_spec.rb | Update hyperlink run text assertions for collection text. |
| spec/uniword/docx/reconciler_spec.rb | Update paragraph style assertion to use paragraph-level accessor. |
| spec/uniword/document_spec.rb | Update document paragraph style assertions to use Paragraph#style. |
| spec/uniword/builder/toc_builder_spec.rb | Update TOC builder expectations to use text_string. |
| spec/uniword/builder/run_utils_spec.rb | Update run merge expectations for text_string and break collection. |
| spec/uniword/builder/run_builder_spec.rb | Update run builder expectations to use text_string. |
| spec/uniword/builder/paragraph_builder_spec.rb | Update paragraph builder expectations for collection text/style. |
| spec/uniword/builder/header_footer_builder_spec.rb | Update header/footer builder expectations to use text_string. |
| spec/uniword/builder/footnote_builder_spec.rb | Update footnote builder expectations for text_string and break collection. |
| spec/uniword/builder/document_builder_spec.rb | Update document builder expectations for style collection and Paragraph#style. |
| spec/uniword/builder/document_builder_enhanced_spec.rb | Update break assertions for break collection. |
| spec/uniword/builder/comprehensive_scenario_spec.rb | Update scenario assertions for Paragraph#style and break collection. |
| spec/uniword/builder/comment_builder_spec.rb | Update comment builder expectations to use text_string. |
| spec/uniword/builder/builder_spec.rb | Update builder spec expectations for text_string and break collection. |
| spec/uniword/assembly/variable_substitutor_spec.rb | Update variable substitution spec expectations to use text_string. |
| spec/uniword/assembly/document_assembler_spec.rb | Update assembled document assertions to use text_string. |
| spec/transformation/html_element_builder_spec.rb | Update HTML transformation expectations to use text_string and break collection. |
| spec/support/helpers.rb | Make helper prefer text_string, fallback to text. |
| spec/integration/styles_integration_spec.rb | Update integration expectations for Paragraph#style returning style ref semantics. |
| spec/integration/mhtml_edge_cases_spec.rb | Update integration expectations for Paragraph#style. |
| spec/integration/libreoffice_spec.rb | Update integration text extraction to prefer text_string. |
| spec/integration/format_conversion_spec.rb | Update format conversion text extraction to use text_string. |
| lib/uniword/wordprocessingml/run.rb | Convert text/break to collections; add text_string; update substitution behavior. |
| lib/uniword/wordprocessingml/paragraph.rb | Use Run#text_string for text extraction; return first style ref in #style. |
| lib/uniword/wordprocessingml/paragraph_properties.rb | Make style a collection; adjust YAML mapping accordingly. |
| lib/uniword/watermark/manager.rb | Use Paragraph#style and Run#text_string when detecting/extracting watermark text. |
| lib/uniword/visitor/text_extractor.rb | Switch run text extraction to text_string (and skip empty). |
| lib/uniword/validation/checkers/internal_link_checker.rb | Simplify heading detection/extraction using Paragraph#style and Paragraph#text. |
| lib/uniword/transformation/ooxml_to_html_converter.rb | Use text_string and ensure style stringification for HTML class output. |
| lib/uniword/transformation/mhtml_metadata_builder.rb | Use text_string for character/word counting. |
| lib/uniword/transformation/mhtml_element_renderer.rb | Handle break as collection; use text_string; render multiple breaks. |
| lib/uniword/toc/toc_generator.rb | Simplify style resolution and set paragraph style using string assignment. |
| lib/uniword/template/helpers/loop_helper.rb | Perform variable substitution via Run#substitute using text_string. |
| lib/uniword/quality/rules/style_consistency_rule.rb | Switch to Paragraph#style for style checks. |
| lib/uniword/quality/rules/heading_hierarchy_rule.rb | Switch to Paragraph#style for heading-level extraction. |
| lib/uniword/properties/style_reference.rb | Add StyleReference.cast to support assigning raw strings. |
| lib/uniword/mhtml/document.rb | Type parts as a MimePart collection instead of a generic array. |
| lib/uniword/docx/reconciler/referential_integrity.rb | Normalize paragraph style access via first style ref from collection. |
| lib/uniword/docx/reconciler/helpers.rb | Use text_string for document fingerprint text extraction. |
| lib/uniword/diff/document_differ.rb | Update style formatting to read first style ref from collection. |
| lib/uniword/builder/run_utils.rb | Update break/text checks and merging to use collection semantics and text_string. |
| lib/uniword/builder/paragraph_builder.rb | Assign style via string (relying on cast) for collection-based style. |
| lib/uniword/batch/stages/normalize_styles_stage.rb | Avoid nil assignments; normalize style comparisons via to_s. |
| lib/uniword/assembly/variable_substitutor.rb | Use Run#substitute_with_block to replace variables across collection text. |
| lib/uniword/assembly/toc.rb | Use Paragraph#style and Run#text_string for TOC assembly logic. |
| lib/uniword/accessibility/rules/descriptive_headings_rule.rb | Extract heading text via text_string from runs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 failures in https://github.com/lutaml/lutaml-model/actions/runs/28665689704/job/85029021256?pr=720