lutaml-lml 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c44e08a243084f376e006dfa845a878267d5867d1c07e9cb2f957cadfdf593af
4
- data.tar.gz: 56b169b4f31489f51713071e48002ec2b0babc8f6b510aa6660e7b02976b0f93
3
+ metadata.gz: 44d54c0bd6492547f4e1c7dd9642c39a4bacdbf3b614ca241f045eb6a196b203
4
+ data.tar.gz: b3169b4ed511eb8d8083808ac2735b88d63700d3508a4f9970755bd7731eede2
5
5
  SHA512:
6
- metadata.gz: 12590d775d46b14bbefe7733610b6b60c08ddaa169e6aa3e4010b13979e565d36bde270adffc5e7ef6cdb37c9fbcadedb16d66b0bbc1e6404d74c46da5b2c1ec
7
- data.tar.gz: 1dcf78fc5244594d03992cdb8dd4b2e286c0069741b3985bad2667ea1752eab19534aa16878e9e2c80ac3ab4b0c5c2381756634590a99df1070e72a0e6b7bf83
6
+ metadata.gz: fd6e67db5203af21c1143b7dbd77958e46079e9a114afcc7f96f2761d2b5eca58bc86f16af77478116eb579250dbd3978de0737e330ac443698b5423933899dc
7
+ data.tar.gz: 3563408088affda9187fd1173ed00a9dca6496dd6563430d1e6de642a94f609b7e246eb914e9d6e53b44edef3b097989725916512f42d8a6b832a5e6c9580117
@@ -3,6 +3,9 @@
3
3
  module Lutaml
4
4
  module Lml
5
5
  class DataProcessor
6
+ # Normalizes attribute entries from the parse tree: merges
7
+ # comma-form groups, extracts names/types/values, and applies the
8
+ # nested attribute/property structure.
6
9
  module AttributeProcessing
7
10
  EXCLUDED_PASS_THROUGH_KEYS = %i[key value comments add attributes properties type_literal].freeze
8
11
 
@@ -57,7 +60,11 @@ module Lutaml
57
60
  end
58
61
 
59
62
  def merge_collection_value(existing, value)
60
- current = existing.is_a?(Array) ? existing : (existing ? [existing] : [])
63
+ current = if existing.is_a?(Array)
64
+ existing
65
+ else
66
+ (existing ? [existing] : [])
67
+ end
61
68
  current + (value.is_a?(Array) ? value : [value])
62
69
  end
63
70
 
@@ -115,6 +122,7 @@ module Lutaml
115
122
  # `default: "Clear"` uses the colon separator (RS 3001 §Attribute);
116
123
  # the colon lands in the captured name and must not.
117
124
  def strip_argument_colon(name)
125
+ name = name[:string] if name.is_a?(Hash) && name.key?(:string)
118
126
  name.to_s.sub(/:\z/, "")
119
127
  end
120
128
  end
@@ -77,7 +77,18 @@ module Lutaml
77
77
  lines.join("\n")
78
78
  end
79
79
 
80
+ def format_key(key)
81
+ key = key.to_s
82
+ return key if key.match?(BARE_WORD)
83
+
84
+ # Same escaping as quote_value: a key may contain any
85
+ # character, and the emitted form must re-parse (issue #78).
86
+ escaped = key.gsub('\\') { |bs| bs * 2 }.gsub('"') { |q| "\\#{q}" }
87
+ "\"#{escaped}\""
88
+ end
89
+
80
90
  def format_value(prefix, key, value, indent)
91
+ key = format_key(key)
81
92
  return "#{prefix}#{key} = ref:(#{value[:reference]})" if reference_value?(value)
82
93
 
83
94
  case value
@@ -142,7 +153,7 @@ module Lutaml
142
153
  # every value is representable in double quotes.
143
154
  # gsub replacement strings re-interpret backslash pairs, so
144
155
  # the backslash doubling uses the block form.
145
- escaped = str.gsub('\\') { |bs| bs + bs }.gsub('"') { |q| '\\' + q }
156
+ escaped = str.gsub('\\') { |bs| bs * 2 }.gsub('"') { |q| "\\#{q}" }
146
157
  "\"#{escaped}\""
147
158
  end
148
159
  end
@@ -65,6 +65,10 @@ module Lutaml
65
65
  # Depth-first walk applying cumulative translate(x,y).
66
66
  def walk(node, dx, dy)
67
67
  node.children.each do |child|
68
+ # Whitespace between elements arrives as text nodes under
69
+ # some moxml adapters; only elements carry geometry.
70
+ next unless child.element?
71
+
68
72
  cdx, cdy = translate_of(child)
69
73
  case child.name
70
74
  when 'g'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Lml
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-lml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-11 00:00:00.000000000 Z
11
+ date: 2026-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model