canon 0.3.94 → 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 +4 -4
- data/lib/canon/version.rb +1 -1
- data/lib/canon/xml/data_model.rb +5 -2
- data/lib/canon/xml_parsing.rb +12 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f4fab3f22311e8b17dff88e02d8ed2fd51e9d88822236a174dec1f60dcc1cef
|
|
4
|
+
data.tar.gz: e952e4fe4c278eb614c42a30a104c950d4dd4ecc871ea5387c4d483c8e292a7a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3ecc4eeeb85076a6a1b3d9f75c2779b05baba59dd6f590f0dea301ac77cf4292278dcd6bef68f66ef97211fbb0c4a31cc3858f99055c0954d1bfcc57c0be125
|
|
7
|
+
data.tar.gz: 42bd8379d6117adc0b28d321a2e01be4851666d1348e39b42f41884254cf291449bb019f5ec1174970b3fa0ce7d77130065f6419a18a002e075666571b26314e
|
data/lib/canon/version.rb
CHANGED
data/lib/canon/xml/data_model.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
data/lib/canon/xml_parsing.rb
CHANGED
|
@@ -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
|
|
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.
|
|
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-
|
|
11
|
+
date: 2026-10-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: diff-lcs
|