canon 0.3.93 → 0.3.95

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: 9a8de3000b7765fb29b5ac0c125431af606ac39bfd4b01f3f949789136985f54
4
- data.tar.gz: 68110de556b09fdc905966e71c022dd54f093181380ce9d9f499dfb3d1d44f5f
3
+ metadata.gz: 5f4fab3f22311e8b17dff88e02d8ed2fd51e9d88822236a174dec1f60dcc1cef
4
+ data.tar.gz: e952e4fe4c278eb614c42a30a104c950d4dd4ecc871ea5387c4d483c8e292a7a
5
5
  SHA512:
6
- metadata.gz: 7410216b604cad3950a5636067530582db2a07cd9a7dd3b1805226205fb72c23442b320927dec48285522b0d41361c9f711a4248ebba273c335ebe228fc0dac3
7
- data.tar.gz: 37535fa56d33391477ecf1095e3645d01db649134721b7a9e4586231a0203e3767caf9b5f6fc2aff04c28def37a70252da61c87f5055c0ba4c8394a8d701dcb5
6
+ metadata.gz: c3ecc4eeeb85076a6a1b3d9f75c2779b05baba59dd6f590f0dea301ac77cf4292278dcd6bef68f66ef97211fbb0c4a31cc3858f99055c0954d1bfcc57c0be125
7
+ data.tar.gz: 42bd8379d6117adc0b28d321a2e01be4851666d1348e39b42f41884254cf291449bb019f5ec1174970b3fa0ce7d77130065f6419a18a002e075666571b26314e
data/lib/canon/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Canon
4
- VERSION = "0.3.93"
4
+ VERSION = "0.3.95"
5
5
  end
@@ -227,12 +227,15 @@ inherited_namespaces: nil)
227
227
  # strict: false keeps the Nokogiri-engine contract — malformed
228
228
  # input yields a recovered document plus diagnostics instead of
229
229
  # an exception (moxml 0.5.15 defaults strict to true; issue
230
- # #147 rides recover errors on Document#parse_errors).
230
+ # #147 rides recover errors on Document#parse_errors, with
231
+ # #271's parse_diagnostics as the second surface — leptris
232
+ # 1.9.362 records recovery exclusively there).
231
233
  doc = Canon::XmlParsing.moxml_context.parse(xml_string,
232
234
  readonly: true,
233
235
  strict: false)
234
236
  result = build_from_moxml(doc, preserve_whitespace: preserve_whitespace)
235
- result.parse_errors = doc.parse_errors if doc.parse_errors.any?
237
+ records = Canon::XmlParsing.recover_records(doc)
238
+ result.parse_errors = records if records.any?
236
239
  # Canon owns this document's full lifecycle: the canon tree holds
237
240
  # no engine references once built, so release the native tree now
238
241
  # instead of waiting for the GC finalizer (moxml#134; no-op on
@@ -44,6 +44,17 @@ module Canon
44
44
  end
45
45
  end
46
46
 
47
+ # Recovery records across both engine surfaces: `parse_errors`
48
+ # (the legacy surface) and `parse_diagnostics` (moxml#271).
49
+ # leptris 1.9.362 moved recovery recording entirely to the
50
+ # diagnostics surface — `parse_errors` comes back empty on
51
+ # recovered parses — so the loudness contract and the banner
52
+ # carry-through must read both. Deduped by message: stacks that
53
+ # record on both surfaces would otherwise double-report.
54
+ def recover_records(doc)
55
+ (doc.parse_errors + doc.parse_diagnostics.map { |d| d[:message].to_s }).uniq
56
+ end
57
+
47
58
  # leptris#1564: HTML producers' output (void elements, unclosed
48
59
  # tags, inline JS with bare <) is not well-formed XML, but the
49
60
  # comparison pretty-printer still needs a tree. HTML-SHAPED
@@ -60,7 +71,7 @@ module Canon
60
71
  # contract keys off the RECORD, not the raise: non-HTML
61
72
  # malformed input stays loud; HTML-shaped input falls back to
62
73
  # the HTML parser. Engine-independent by construction.
63
- recorded = doc.parse_errors
74
+ recorded = recover_records(doc)
64
75
  if recorded.any?
65
76
  raise Moxml::ParseError, recorded.join("; ") unless html_shaped?(xml_string)
66
77
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.93
4
+ version: 0.3.95
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-15 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: diff-lcs
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.9.356
47
+ version: 1.9.361
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.9.356
54
+ version: 1.9.361
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: moxml
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.5.137
61
+ version: 0.5.138
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.5.137
68
+ version: 0.5.138
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: paint
71
71
  requirement: !ruby/object:Gem::Requirement