moxml 0.6.23 → 0.6.24
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/moxml/adapter/leptris.rb +6 -0
- data/lib/moxml/version.rb +1 -1
- data/spec/moxml/adapter/leptris_textsegment_attach_spec.rb +43 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 90baa6c32eb44a50601f1d9784e50bfa00c4b2d172d1ebdbef30ffbba80c1fbd
|
|
4
|
+
data.tar.gz: 2eaf0b64683cb001d40585752601ec6f41af5f88339744c108370e51404ea508
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 811ab8695281e1d5bebe4abdc3a2ab70e518aeb799fd4300c6b7a26d64d965188f3734fcd970251f06a1fab0e317028ee1af817362415ce8aecf0c12f22ab939
|
|
7
|
+
data.tar.gz: 7243257da8297195ebbc3039e21557033fc299b18b8e77c9eb796878e8e57f20f483378f218347e070f6eabd8b7fb316f274dd275de9fb150c75a65d3bcf2f80
|
|
@@ -3670,6 +3670,12 @@ module Moxml
|
|
|
3670
3670
|
end
|
|
3671
3671
|
|
|
3672
3672
|
def add_child_impl(parent, child)
|
|
3673
|
+
# TextSegment value objects (the entity-retention split
|
|
3674
|
+
# runs) are the adapter's own parse output - attaching one
|
|
3675
|
+
# attaches its text content (#606): the raw value object
|
|
3676
|
+
# would fall through to the binding, which rejects anything
|
|
3677
|
+
# that is not a native Node or String.
|
|
3678
|
+
child = child.content.to_s if child.is_a?(CustomizedLeptris::TextSegment)
|
|
3673
3679
|
# Same-document Identity append — the builder hot path. One
|
|
3674
3680
|
# document pair decides the verdict: the pin, the absorb
|
|
3675
3681
|
# checks and the binding bridges only exist for
|
data/lib/moxml/version.rb
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
# lutaml/moxml#606: under entity-reference retention, parsing
|
|
6
|
+
# marker-bearing text mints CustomizedLeptris::TextSegment value
|
|
7
|
+
# objects as the native children behind Wrappers::Text. Re-attaching
|
|
8
|
+
# such a parsed child via add_child crashed - the attach path handed
|
|
9
|
+
# the raw value object to the binding, which accepts only native
|
|
10
|
+
# Nodes and Strings. The adapter's own parse output must be accepted
|
|
11
|
+
# by its own attach path: a TextSegment attaches as its text content.
|
|
12
|
+
RSpec.describe "TextSegment attach under entity retention (#606)" do
|
|
13
|
+
let(:ctx) { Moxml.new(:leptris) }
|
|
14
|
+
|
|
15
|
+
before do
|
|
16
|
+
ctx.config.restore_entities = true
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "re-attaches parsed marker-split children to another element" do
|
|
20
|
+
parsed = ctx.parse(
|
|
21
|
+
"<fragment>alpha beta—gamma<child a=\"1\"/></fragment>",
|
|
22
|
+
)
|
|
23
|
+
target = parsed.document.create_element("t")
|
|
24
|
+
|
|
25
|
+
parsed.root.children.each { |c| target.add_child(c) }
|
|
26
|
+
|
|
27
|
+
names = target.children.map { |c| c.respond_to?(:name) ? c.name : nil }
|
|
28
|
+
expect(names).to include("child")
|
|
29
|
+
expect(target.children.count).to be_positive
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "preserves the re-attached text runs verbatim" do
|
|
33
|
+
parsed = ctx.parse("<fragment>alpha beta—gamma</fragment>")
|
|
34
|
+
target = parsed.document.create_element("t")
|
|
35
|
+
|
|
36
|
+
parsed.root.children.each { |c| target.add_child(c) }
|
|
37
|
+
|
|
38
|
+
combined = target.children.to_a.join
|
|
39
|
+
expect(combined).to include("alpha")
|
|
40
|
+
expect(combined).to include("beta")
|
|
41
|
+
expect(combined).to include("gamma")
|
|
42
|
+
end
|
|
43
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moxml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.24
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -507,6 +507,7 @@ files:
|
|
|
507
507
|
- spec/moxml/adapter/leptris_sax_records_spec.rb
|
|
508
508
|
- spec/moxml/adapter/leptris_spec.rb
|
|
509
509
|
- spec/moxml/adapter/leptris_strict_mismatch_spec.rb
|
|
510
|
+
- spec/moxml/adapter/leptris_textsegment_attach_spec.rb
|
|
510
511
|
- spec/moxml/adapter/leptris_xpath_bulk_rows_spec.rb
|
|
511
512
|
- spec/moxml/adapter/leptris_xpath_identity_spec.rb
|
|
512
513
|
- spec/moxml/adapter/libxml_internals_spec.rb
|