lutaml-model 0.8.168 → 0.8.169
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1d8fca1d96bc08f40af1b381d9965fc0e2c36062f7245de7775a9ded2dd9a242
|
|
4
|
+
data.tar.gz: fba1bcd46c3ea01561ee96ce0a13d45076104ca79c53b7380e6803f1f4534df6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5803ee2c167d61899821d9ef07e7709394dbb231fcd17f54a872ce4089911e87f0cf80b07933da0ffd76a87f302e911f14d39b33f7e76ef7445131951279484c
|
|
7
|
+
data.tar.gz: 9b4bd16dc52d8dd7b2b236c3059816f85df179e8efc26f7abafab1b9087f3357c6335cacf38d0114114d5eded3528541737e1b65f0ed793667cb91d4ef1cf701
|
data/lib/lutaml/model/version.rb
CHANGED
|
@@ -199,7 +199,19 @@ module Lutaml
|
|
|
199
199
|
|
|
200
200
|
plan[:rows].each do |(rule, attr, kind, _sp, delegate, _type)|
|
|
201
201
|
next unless rule.name
|
|
202
|
-
|
|
202
|
+
|
|
203
|
+
if kind == :child_deferred
|
|
204
|
+
# A VALUED cycle-point row keeps the DOM lane: the
|
|
205
|
+
# native ordered replay has no ops spelling for it —
|
|
206
|
+
# the island's nested rows render as scalar
|
|
207
|
+
# placeholders and the data drops (lutaml-model#1130,
|
|
208
|
+
# the OOXML bibliography's Author→author recursion).
|
|
209
|
+
# Empty deferred rows ride the native lane untouched.
|
|
210
|
+
value = value_of(instance, attr, delegate)
|
|
211
|
+
return false unless Array(value).empty?
|
|
212
|
+
|
|
213
|
+
next
|
|
214
|
+
end
|
|
203
215
|
next unless NESTED_ROW_KINDS.include?(kind)
|
|
204
216
|
|
|
205
217
|
value = value_of(instance, attr, delegate)
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# lutaml-model#1130: a VALUED :child_deferred row (the cycle-point
|
|
4
|
+
# spelling — the OOXML bibliography's Author → author same-class
|
|
5
|
+
# recursion) must keep the DOM lane. The native ordered replay has no
|
|
6
|
+
# ops spelling for the island: its nested rows render as scalar
|
|
7
|
+
# placeholders and the data drops (<b:Author/>). The gate previously
|
|
8
|
+
# skipped child_deferred rows outright, admitting the native lane for
|
|
9
|
+
# exactly the shape it cannot address.
|
|
10
|
+
|
|
11
|
+
require "lutaml/model"
|
|
12
|
+
require "lutaml/xml/leptris"
|
|
13
|
+
|
|
14
|
+
module Bib1130
|
|
15
|
+
class BNamespace < Lutaml::Xml::Namespace
|
|
16
|
+
uri "http://schemas.openxmlformats.org/officeDocument/2006/bibliography"
|
|
17
|
+
prefix_default "b"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class Person < Lutaml::Model::Serializable
|
|
21
|
+
attribute :last, :string
|
|
22
|
+
attribute :first, :string
|
|
23
|
+
attribute :middle, :string
|
|
24
|
+
|
|
25
|
+
xml do
|
|
26
|
+
element "Person"
|
|
27
|
+
namespace BNamespace
|
|
28
|
+
mixed_content
|
|
29
|
+
map_element "Last", to: :last
|
|
30
|
+
map_element "First", to: :first, render_nil: false
|
|
31
|
+
map_element "Middle", to: :middle, render_nil: false
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class NameList < Lutaml::Model::Serializable
|
|
36
|
+
attribute :person, Person, collection: true, initialize_empty: true
|
|
37
|
+
|
|
38
|
+
xml do
|
|
39
|
+
element "NameList"
|
|
40
|
+
namespace BNamespace
|
|
41
|
+
mixed_content
|
|
42
|
+
map_element "Person", to: :person, render_nil: false
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class Author < Lutaml::Model::Serializable
|
|
47
|
+
attribute :name_list, NameList
|
|
48
|
+
attribute :author, Author
|
|
49
|
+
|
|
50
|
+
xml do
|
|
51
|
+
element "Author"
|
|
52
|
+
namespace BNamespace
|
|
53
|
+
mixed_content
|
|
54
|
+
map_element "NameList", to: :name_list, render_nil: false
|
|
55
|
+
map_element "Author", to: :author, render_nil: false
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
class Source < Lutaml::Model::Serializable
|
|
60
|
+
attribute :source_type, :string
|
|
61
|
+
attribute :author, Author
|
|
62
|
+
attribute :title, :string
|
|
63
|
+
|
|
64
|
+
xml do
|
|
65
|
+
element "Source"
|
|
66
|
+
namespace BNamespace
|
|
67
|
+
mixed_content
|
|
68
|
+
map_element "SourceType", to: :source_type, render_nil: false
|
|
69
|
+
map_element "Author", to: :author, render_nil: false
|
|
70
|
+
map_element "Title", to: :title, render_nil: false
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
class Sources < Lutaml::Model::Serializable
|
|
75
|
+
attribute :source, Source, collection: true
|
|
76
|
+
|
|
77
|
+
xml do
|
|
78
|
+
element "Sources"
|
|
79
|
+
namespace BNamespace
|
|
80
|
+
mixed_content
|
|
81
|
+
map_element "Source", to: :source, render_nil: false
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
RSpec.describe "valued child_deferred rows keep the DOM lane (#1130)" do
|
|
87
|
+
let(:xml) do
|
|
88
|
+
<<~XML
|
|
89
|
+
<b:Sources xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
|
|
90
|
+
<b:Source><b:SourceType>Book</b:SourceType>
|
|
91
|
+
<b:Author><b:Author><b:NameList><b:Person><b:Last>Last Name</b:Last><b:First>First,</b:First><b:Middle>Middle</b:Middle></b:Person></b:NameList></b:Author></b:Author>
|
|
92
|
+
<b:Title>Book Title</b:Title>
|
|
93
|
+
</b:Source>
|
|
94
|
+
</b:Sources>
|
|
95
|
+
XML
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it "round-trips the nested same-element chain with both fast-path states" do
|
|
99
|
+
[true, false].each do |fast|
|
|
100
|
+
Lutaml::Model::Config.instance.xml_plan_fast_path = fast
|
|
101
|
+
parsed = Bib1130::Sources.from_xml(xml)
|
|
102
|
+
inner = parsed.source.first.author.author
|
|
103
|
+
|
|
104
|
+
expect(inner.name_list.person.first.last).to eq("Last Name")
|
|
105
|
+
|
|
106
|
+
out = parsed.to_xml
|
|
107
|
+
expect(out).not_to include("<b:Author/>")
|
|
108
|
+
expect(out).to include("Last Name")
|
|
109
|
+
end
|
|
110
|
+
ensure
|
|
111
|
+
Lutaml::Model::Config.instance.xml_plan_fast_path = true
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it "refuses the native lane for the valued deferred plan" do
|
|
115
|
+
Lutaml::Model::Config.instance.xml_plan_fast_path = true
|
|
116
|
+
parsed = Bib1130::Sources.from_xml(xml)
|
|
117
|
+
src = parsed.source.first
|
|
118
|
+
plan = Lutaml::Xml::Leptris::PlanCompiler.compile(
|
|
119
|
+
src.class, Lutaml::Model::Config.default_register
|
|
120
|
+
)
|
|
121
|
+
expect(
|
|
122
|
+
Lutaml::Xml::Leptris::NativeEmission.compatible?(
|
|
123
|
+
plan, src, Lutaml::Model::Config.default_register
|
|
124
|
+
),
|
|
125
|
+
).to be(false)
|
|
126
|
+
ensure
|
|
127
|
+
Lutaml::Model::Config.instance.xml_plan_fast_path = true
|
|
128
|
+
end
|
|
129
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lutaml-model
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.169
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -2018,6 +2018,7 @@ files:
|
|
|
2018
2018
|
- spec/lutaml/xml/general_namespace_spec.rb
|
|
2019
2019
|
- spec/lutaml/xml/html_entities_spec.rb
|
|
2020
2020
|
- spec/lutaml/xml/indent_spec.rb
|
|
2021
|
+
- spec/lutaml/xml/leptris/child_deferred_gate_spec.rb
|
|
2021
2022
|
- spec/lutaml/xml/leptris/emission_graph_deferred_spec.rb
|
|
2022
2023
|
- spec/lutaml/xml/leptris/native_emission_nested_sharing_spec.rb
|
|
2023
2024
|
- spec/lutaml/xml/leptris/native_emission_ns_parity_spec.rb
|