canon 0.3.86 → 0.3.88

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: dce8920ae714ac966a2d0c91f81d8066c43cd7d7311bd4c100e00c4ea60ad66c
4
- data.tar.gz: 0b1dd87f74475eb5e6ef3afa486ebd1ca4160d2aae408b7bfc410135687a117e
3
+ metadata.gz: 513c68e20e7756dc783a481d38e2aa64ed60a7058c130aa6c8e6b47351ff9dfa
4
+ data.tar.gz: b59b169120892513bcb6d2cde8b495c1b47f122774265719f87db94919e30944
5
5
  SHA512:
6
- metadata.gz: fd4055332d0210c7db855eff4027bc1c3a4a4a13a3a1d5398f76f34a00125bf4f180611109fd5e3437610d894f2dbaa27cb66bb5b10783c27cb019138be7f6ff
7
- data.tar.gz: cce33bad9441d9f1d9d3f54ef18fc8944cbd37eb2f6b2bb607dfb6020426e3d455f06e0239b7dc9085cf915624a602a51a26219472fd03e2094f503a5987eda6
6
+ metadata.gz: 45d755a5581b74e64e953b1f2e2d9900d1fe122330d7707c361663f986b8bf5b2252a1916ec9262abedc8ee39c98c67a1c858b4eb3c48ad12ddb59a2f8df7d97
7
+ data.tar.gz: 0a4ea1015b59ac8df0d44dc7ed1801f60d94bcc775e73d99d355185a22bf5dcb2236b54967034ddaeae3f9d937ee9940a98ac487102ec4423b464dd98056cefc
data/CLAUDE.md CHANGED
@@ -136,7 +136,7 @@ Canon is engine-agnostic across three seams (MECE — one concern per module):
136
136
 
137
137
  - `Canon::XmlBackend` — XML engine selection. The default follows moxml's resolved adapter: **leptris whenever it is installed** (parse ~1.6x, serialize ~3.8x vs Nokogiri), raw Nokogiri otherwise (wrapping Nokogiri in moxml buys nothing — the wrapper adds 2-3x overhead). `:moxml` under Opal. `CANON_XML_BACKEND=nokogiri|moxml` forces either engine.
138
138
  - `Canon::XmlParsing` — the only place that talks to engines for XML parse/serialize (moxml parses pass `readonly: true` — canon never mutates engine documents); node type queries answer for ANY recognized node (Nokogiri or moxml) by type, never by active backend — user-supplied Nokogiri nodes keep working under the moxml engine.
139
- - `Canon::Html::NokogiriSupport` — HTML is always Nokogiri on CRuby (moxml has no HTML adapter, leptris no HTML parser); independent of the XML engine.
139
+ - `Canon::Html::NokogiriSupport` — HTML engine seam. **HTML comparison parses through the engine** since 0.3.86: `HtmlParser.parse` routes through moxml `Context#parse_html_fragment` (WHATWG fragment parsing, moxml#353 riding leptris) and builds a Canon tree via the materialize-records fast path — whitespace text nodes survive the parse unconditionally (HTML whitespace significance is the comparison profile's decision, #112/#137), and `parse_node` walks Canon trees directly. The Nokogiri HTML4/HTML5 fragment path remains for runtimes without an engine HTML adapter and for user-supplied Nokogiri nodes. Nokogiri still serves the other HTML lanes: the pretty-printer's HTML5/fixture-ready display modes, the canonical HTML formatters, and the semantic lane's `DataModel.from_html`. The fragment-records lane once delivered nil URIs for prefixed attributes (moxml#367, fixed in moxml 0.5.130 — the bulk read now falls back to the reserved-prefix table); the TreeBuilder keeps the one legal `xml`-prefix binding as standing defense.
140
140
  - `Canon::Xml::Sax` — SAX driver selection follows the resolved adapter: `MoxmlDriver` (leptris SAX — the comparison hot path, CI-gated in the split flip) under the leptris default, `NokogiriDriver` when the resolved adapter is nokogiri, `MoxmlDriver` under Opal. The builder (`SaxBuilder`) is engine-neutral.
141
141
 
142
142
  Engine parity is complete through libleptris 1.9.8 / leptris-ruby 1.9.33 / moxml 0.5.12: attribute-value normalization, prolog/epilog PIs and comments, DTD ATTLIST defaults off by default (opt-in via `ParseOptions::DTDATTR`), PI-data whitespace matching libxml2, materialize with namespace declarations and a root-subtree-only record contract (moxml#140), readonly parse, deterministic `Document#free` (wired into `from_moxml_xml` — moxml#134). Canon's moxml conversion is record-based (`build_from_moxml` consumes `materialize` records — no per-node wrapper allocation; ~0.55x the Nokogiri conversion). `spec/canon/xml/engine_parity_spec.rb` is fully green. Pretty-printing runs the leptris serializer through `PrettyPrinter::Xml#moxml_format` (byte parity via moxml#153/#155/#156; the #167 escaping race fixed in 0.5.28), with Nokogiri serving the fallback engine and Opal — pretty-printed bytes are canon's product, gated by the fixture-integrity suite and the CI performance gate.
data/README.adoc CHANGED
@@ -18,7 +18,8 @@ Key features:
18
18
  * **Smart diff output**: By-line or by-object modes with syntax highlighting
19
19
  * **Fast native engines, zero mandatory C deps**:
20
20
  ** XML on https://github.com/leptris/leptris[libleptris] (via moxml) whenever
21
- installed — Nokogiri otherwise and for HTML; both byte-compatible, engine
21
+ installed — Nokogiri otherwise; HTML comparison parses through the engine's
22
+ WHATWG fragment mode. Both byte-compatible, engine
22
23
  parity is spec-gated
23
24
  ** JSON on https://github.com/leptris/yeptris[libyeptris]' strict JSON surface
24
25
  (yeptris is a required gem — platform gems, zero compilation)
@@ -974,7 +975,9 @@ bundle exec rake performance:yaml
974
975
  Canon is engine-agnostic across its formats:
975
976
 
976
977
  * **XML**: libleptris via moxml whenever installed (parse, comparison, C14N,
977
- pretty-printing); raw Nokogiri otherwise, and always Nokogiri for HTML.
978
+ pretty-printing); raw Nokogiri otherwise. HTML comparison parses through the
979
+ engine's WHATWG fragment mode (Canon trees, since 0.3.86); Nokogiri serves
980
+ HTML display modes, canonical formatters, and the semantic data model.
978
981
  `CANON_XML_BACKEND=nokogiri|moxml` forces either engine; parity between the
979
982
  two is spec-gated (`spec/canon/xml/engine_parity_spec.rb`).
980
983
  * **JSON**: yeptris' strict JSON surface when the native materializer is
@@ -65,14 +65,6 @@ module Canon
65
65
  # element children convert through the materialize-records
66
66
  # fast path; the wrapper walk serves the rare non-element
67
67
  # top-level nodes (text, comments).
68
- #
69
- # NOTE: the fragment record buffer delivers a nil namespace
70
- # URI for prefixed attributes on HTML-parsed trees (xml:lang
71
- # arrives as name="lang", prefix="xml", uri=nil) where the
72
- # wrapper API reports the bound URI — moxml#367. The TreeBuilder
73
- # covers the xml prefix (the one legal binding); other
74
- # foreign-content prefixes keep nil URIs on this lane until
75
- # the records gap closes.
76
68
  def engine_fragment(html)
77
69
  frag = Canon::XmlParsing.moxml_context.parse_html_fragment(html)
78
70
  root = Canon::Xml::Nodes::RootNode.new
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.86"
4
+ VERSION = "0.3.88"
5
5
  end
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.86
4
+ version: 0.3.88
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-12 00:00:00.000000000 Z
11
+ date: 2026-10-13 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.341
47
+ version: 1.9.346
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.341
54
+ version: 1.9.346
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.126
61
+ version: 0.5.131
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.126
68
+ version: 0.5.131
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: paint
71
71
  requirement: !ruby/object:Gem::Requirement