moxml 0.5.44 → 0.5.45
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: f552fee96842dca761f5e88ba1f5074e6cfdaef32411b012e2bf30a6736a16c4
|
|
4
|
+
data.tar.gz: 68c734aa63688134b897a1e29e8abfa292a02534daefd278b727122ad952e4e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff775d10b05c5e60fcbf59c66e49284b841e4148b7da7766393b351b47bb626697a34bb5f30cf0d697d8a578ed07c1a9b8b7987507364c436c7c274be380843f
|
|
7
|
+
data.tar.gz: 7bbaef0118ea13de356dc95041dca057d59373f96eec6a4621a38d1cce07b283ca682b3fd2db77eea34f8d9252aaca821cf2651cbbbebbf0e7e171dd0d51f0f5
|
|
@@ -139,27 +139,43 @@ module Moxml
|
|
|
139
139
|
# facade's canonical form (checked post-hoc: a source
|
|
140
140
|
# declaration carrying standalone or another version would
|
|
141
141
|
# diverge).
|
|
142
|
+
# 1.9.174 attached leptris_document_first_child (libleptris
|
|
143
|
+
# 1.9.174): pointer probe for the single-child document
|
|
144
|
+
# shape without wrapping the child chain.
|
|
145
|
+
DOCUMENT_CHILD_PTRS =
|
|
146
|
+
::Leptris::XML::FFI.respond_to?(:leptris_document_first_child)
|
|
147
|
+
|
|
142
148
|
def fast_document_output(doc, options)
|
|
143
149
|
return nil unless LIBXML2_LAYOUT_PARITY
|
|
144
|
-
return nil
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
attachments.get(doc, :entity_markers)
|
|
150
|
+
return nil unless attachments.none_set?(
|
|
151
|
+
doc, %i[declaration doctype document_text entity_markers]
|
|
152
|
+
)
|
|
148
153
|
|
|
149
154
|
include_decl = !options[:no_declaration] && options.fetch(:declaration) do
|
|
150
155
|
document_has_declaration?(doc)
|
|
151
156
|
end
|
|
152
157
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
158
|
+
# Exactly one document child — the root — is the common
|
|
159
|
+
# parsed shape; pointer probes decide it without wrapping
|
|
160
|
+
# the child chain. Anything else (prolog/epilog parts,
|
|
161
|
+
# multi-root) falls back to the scan.
|
|
162
|
+
root = doc.root
|
|
163
|
+
single_child = DOCUMENT_CHILD_PTRS && root &&
|
|
164
|
+
::Leptris::XML::FFI.leptris_document_first_child(doc.c_ptr)
|
|
165
|
+
.address == root.c_ptr.address &&
|
|
166
|
+
root.next_sibling.nil?
|
|
167
|
+
unless single_child
|
|
168
|
+
root_seen = false
|
|
169
|
+
doc.children.each do |child|
|
|
170
|
+
if child.is_a?(::Leptris::XML::Element)
|
|
171
|
+
return nil if root_seen
|
|
172
|
+
|
|
173
|
+
root_seen = true
|
|
174
|
+
elsif root_seen
|
|
175
|
+
# Epilog parts glue directly to the root in the engine's
|
|
176
|
+
# document output — compose those.
|
|
177
|
+
return nil
|
|
178
|
+
end
|
|
163
179
|
end
|
|
164
180
|
end
|
|
165
181
|
|
|
@@ -13,6 +13,10 @@ module Moxml
|
|
|
13
13
|
native.instance_variable_set(attachment_ivar_name(key), value)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
def none_set?(native, keys)
|
|
17
|
+
keys.none? { |key| native.instance_variable_defined?(attachment_ivar_name(key)) }
|
|
18
|
+
end
|
|
19
|
+
|
|
16
20
|
def key?(native, key)
|
|
17
21
|
native.instance_variable_defined?(attachment_ivar_name(key))
|
|
18
22
|
end
|
|
@@ -20,6 +20,12 @@ module Moxml
|
|
|
20
20
|
@backend.get(native, key)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
# One probe for "none of these keys are set" — the document
|
|
24
|
+
# serialize gate asks about four keys per call.
|
|
25
|
+
def none_set?(native, keys)
|
|
26
|
+
@backend.none_set?(native, keys)
|
|
27
|
+
end
|
|
28
|
+
|
|
23
29
|
def set(native, key, value)
|
|
24
30
|
@backend.set(native, key, value)
|
|
25
31
|
end
|
data/lib/moxml/version.rb
CHANGED