moxml 0.5.103 → 0.5.104

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: 566f2842eac4e01753965cb5f56eada53d6683b3ef6b576015eb4b0da572ae67
4
- data.tar.gz: ccc15ef083358a018e1536983017c6681c70c11ccbb4678ac123e5b0b2c9aada
3
+ metadata.gz: 3bbf00c0bac03066dd77a5bb5f952ac786a893d51dd0b18365a67500bdad7a15
4
+ data.tar.gz: 79d1609f628fcf8b69044ee5a9c990ae347cf0ff11c8b5e2ed2f812bee80ae0e
5
5
  SHA512:
6
- metadata.gz: 2c29296b60bedabbc512c9f5c454b0195b3632dbf9952b0c397fc3bad6554135dd3096a04a34e1abddf9ce40088af4856b2ead7d8ca69a4eb251dc3db38286b3
7
- data.tar.gz: fd1684a85d2ace2191b33bf996a12e8bea6cb535a340732cccee3318abc6649ba2e07548509d1469959e10ee711ecec650f8ec6b4525beb6a66e2c9a75a81c1d
6
+ metadata.gz: 756a39e9fc200fc4b1a9880f820489684169c3206739d02bb44aad987bfa9b20140a65ae923b29745609fd47407927be9d369f4ed4a64d4129e0f3168f3aec56
7
+ data.tar.gz: 6efc68d693d8c3b12f90ee4bfed2bf801162b89c7f3a5b0b1fc21eed45183a1ea962d4f2916a30932314208cd5099245a4977a0020b28892a83f4f019b40e03e
data/README.adoc CHANGED
@@ -1283,7 +1283,8 @@ reproduce:
1283
1283
  [source,shell]
1284
1284
  ----
1285
1285
  # One-time setup: install ragel + ruby-ll so the forks' gitignored
1286
- # generated lexer/parser sources can be produced.
1286
+ # generated lexer/parser sources can be produced. ruby-ll must be
1287
+ # installed outside the bundle: vendor:prepare runs it outside Bundler.
1287
1288
  gem install ruby-ll --no-document
1288
1289
  # (Install ragel via your package manager, e.g. apt-get install ragel
1289
1290
  # or brew install ragel.)
data/Rakefile CHANGED
@@ -88,13 +88,17 @@ namespace :vendor do
88
88
  "#{ruby_ll}/lib/ll/parser.rll"],
89
89
  ]
90
90
 
91
- generators.each do |cmd, output, source|
92
- if File.exist?(output) && File.mtime(output) >= File.mtime(source)
93
- next
91
+ # Under bundle exec, ruby-ll resolves to the vendored opal-ruby-ll
92
+ # binstub, which needs the not-yet-compiled libll.
93
+ Bundler.with_unbundled_env do
94
+ generators.each do |cmd, output, source|
95
+ if File.exist?(output) && File.mtime(output) >= File.mtime(source)
96
+ next
97
+ end
98
+
99
+ FileUtils.mkdir_p(File.dirname(output))
100
+ sh cmd
94
101
  end
95
-
96
- FileUtils.mkdir_p(File.dirname(output))
97
- sh cmd
98
102
  end
99
103
  end
100
104
 
@@ -2008,7 +2008,16 @@ module Moxml
2008
2008
  )
2009
2009
  end
2010
2010
  else
2011
- node.unlink
2011
+ begin
2012
+ node.unlink
2013
+ rescue ::Leptris::XML::Error => e
2014
+ # "Not found" from unlink means the node is already in
2015
+ # no parent list — detached (replace, children=, engine
2016
+ # paths the wrapper layer cannot clear links for).
2017
+ # Nokogiri's unlink is a no-op there; match it instead
2018
+ # of crashing cleanup passes.
2019
+ raise unless e.message.include?("Not found")
2020
+ end
2012
2021
  end
2013
2022
  end
2014
2023
 
data/lib/moxml/node.rb CHANGED
@@ -254,6 +254,11 @@ module Moxml
254
254
  context.bump_children_generation
255
255
  invalidate_parent_children_cache!
256
256
  adapter.remove(@native)
257
+ # The wrapper-side parent link dies with the attach — leaving it
258
+ # stale makes a later #remove's guard trust a parent that no
259
+ # longer exists and push an already-detached node into the
260
+ # engine (leptris: "Not found").
261
+ @parent_node = nil
257
262
  invalidate_children_cache!
258
263
  # The detached subtree left its declaring ancestors behind
259
264
  invalidate_namespace_cache!
@@ -269,6 +274,9 @@ module Moxml
269
274
  node = prepare_node(node)
270
275
  invalidate_parent_children_cache!
271
276
  adapter.replace(@native, node.native)
277
+ # Self is detached by the replace — drop the stale parent link
278
+ # (see #remove).
279
+ @parent_node = nil
272
280
  invalidate_children_cache!
273
281
  self
274
282
  end
data/lib/moxml/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Moxml
4
- VERSION = "0.5.103"
4
+ VERSION = "0.5.104"
5
5
  end
@@ -383,4 +383,17 @@ RSpec.describe "Nokogiri-compatible node sugar" do
383
383
  expect(doc.root.inner_xml).to eq("<a>x</a><b/>")
384
384
  end
385
385
  end
386
+
387
+ describe "Node#remove after replace with a parent link" do
388
+ it "is a no-op, not an engine error (stale wrapper parent link)" do
389
+ doc = Moxml.parse("<r><term><p>a</p><note>n</note></term></r>")
390
+ # children walks are parent-aware: the wrapper carries @parent_node
391
+ p_node = doc.at("//term").children.find { |c| c.name == "p" }
392
+ t = doc.create_element("definition")
393
+ p_node.replace(t)
394
+ expect { t << p_node.remove }.not_to raise_error
395
+ expect(doc.at("//term/definition/p")).not_to be_nil
396
+ expect(doc.at("//term/definition/p").text).to eq("a")
397
+ end
398
+ end
386
399
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moxml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.103
4
+ version: 0.5.104
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-02 00:00:00.000000000 Z
11
+ date: 2026-10-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Moxml is a unified XML manipulation library that provides a common API