Skip to content

refactor: migrate print_symbol to map-level raw: :content - #34

Merged
ronaldtse merged 1 commit into
mainfrom
refactor/raw-print-symbol
Sep 18, 2026
Merged

ronaldtse merged 1 commit into
mainfrom
refactor/raw-print-symbol

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Migrates the three deprecated attribute :print_symbol, :string, raw: true declarations in lib/unitsdb/ucum.rb (UcumBaseUnit, UcumPrefix, UcumUnit) to the mapping-level equivalent:

map_element "printSymbol", to: :print_symbol, raw: :content

lutaml-model deprecated attribute-level raw: true; rawness is a property of how the XML element maps, not of the attribute type. raw: :content preserves the element's inner content verbatim — needed because UCUM essence <printSymbol> values can contain character entities and nested markup (e.g. &#176;C) that must survive XML → model → XML round-trips losslessly.

Verification

Behavior is unchanged, verified against the full UCUM fixture (336 entities):

  • parsed print_symbol values: identical before/after
  • to_xml round-trip output: byte-identical before/after
  • deprecation warnings: 3 → 0
  • full suite: 852 examples, 0 failures; rubocop clean

lutaml-model deprecates attribute-level raw: true in favor of
declaring rawness on the XML mapping (raw: :content), which is
where it semantically belongs. Behavior verified unchanged:
parsed print_symbol values and XML round-trip output are
byte-identical for the full UCUM fixture (336 entities).
@ronaldtse
ronaldtse merged commit 4b3550f into main Sep 18, 2026
16 of 19 checks passed
@ronaldtse
ronaldtse deleted the refactor/raw-print-symbol branch September 18, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant