moxml 0.5.154 → 0.5.155
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/document_parts.rb +17 -11
- data/lib/moxml/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6118a2cde5308a843923649c4d115a89c39f99a74e5cf5b0804c7c69ffe17ce
|
|
4
|
+
data.tar.gz: 97fd393417a588ed4ffea5c885982ead30553b76679c38edea3a466f8c093e23
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4471e50a04a8b3432a56555eb5f45edaecfd20b704dc890d6f89f5c076752f8350fe7c95b8e8c58b9569add68900619561ef685706161b0dee2c4275f2a54c12
|
|
7
|
+
data.tar.gz: 04f39ca1432d7e910485b9305e9fe4aa042890f6dd49b80981bc262846152d1ab8fa5d6ac5a584c000612a491bc3625849ee3ed5c65694d892f462787d007115
|
|
@@ -14,6 +14,18 @@ module Moxml
|
|
|
14
14
|
had_source_declaration document_text
|
|
15
15
|
].freeze
|
|
16
16
|
|
|
17
|
+
# The XML declaration kind is not stable across leptris
|
|
18
|
+
# releases: 1.9.345-era builds lack Leptris::XML::Declaration
|
|
19
|
+
# entirely (the pure-Ruby CustomizedLeptris twin carries the
|
|
20
|
+
# declaration then), later builds expose it again (and list it
|
|
21
|
+
# among the document children, leptris-ruby#459). Resolve the
|
|
22
|
+
# kind set once, by feature detection, and filter both kinds —
|
|
23
|
+
# the shim twin is never a listing node either way.
|
|
24
|
+
DECLARATION_KINDS = [
|
|
25
|
+
::Moxml::Adapter::CustomizedLeptris::Declaration,
|
|
26
|
+
(::Leptris::XML::Declaration if ::Leptris::XML.const_defined?(:Declaration)),
|
|
27
|
+
].compact.freeze
|
|
28
|
+
|
|
17
29
|
def free_document(native)
|
|
18
30
|
DOCUMENT_ATTACHMENT_KEYS.each { |key| attachments.delete(native, key) }
|
|
19
31
|
native.free
|
|
@@ -39,17 +51,11 @@ module Moxml
|
|
|
39
51
|
# leptris-ruby#459 lists the declaration among the binding
|
|
40
52
|
# children; the Nokogiri-shaped facade contract never lists
|
|
41
53
|
# it (the declaration is a preamble part, not a child node)
|
|
42
|
-
# — filtered at the listing seam.
|
|
43
|
-
# conditionally: leptris releases before the declaration
|
|
44
|
-
# node class landed (e.g. 1.9.345) carry no Declaration at
|
|
45
|
-
# all, and referencing the constant unconditionally raises
|
|
46
|
-
# NameError on every document-children listing.
|
|
47
|
-
declaration_class =
|
|
48
|
-
if ::Leptris::XML.const_defined?(:Declaration, false)
|
|
49
|
-
::Leptris::XML::Declaration
|
|
50
|
-
end
|
|
54
|
+
# — filtered at the listing seam.
|
|
51
55
|
children.concat(
|
|
52
|
-
doc.children.to_a.
|
|
56
|
+
doc.children.to_a.reject do |child|
|
|
57
|
+
DECLARATION_KINDS.any? { |kind| child.is_a?(kind) }
|
|
58
|
+
end,
|
|
53
59
|
)
|
|
54
60
|
|
|
55
61
|
texts = attachments.get(doc, :document_text)
|
|
@@ -175,7 +181,7 @@ module Moxml
|
|
|
175
181
|
# emission (a second line here duplicates it — and the
|
|
176
182
|
# 1.9.360 0-arity Declaration#to_xml raises under the
|
|
177
183
|
# options-passing call).
|
|
178
|
-
next if child.is_a?(
|
|
184
|
+
next if DECLARATION_KINDS.any? { |kind| child.is_a?(kind) }
|
|
179
185
|
|
|
180
186
|
parts << raw_serialize(child, options) << "\n"
|
|
181
187
|
end
|
data/lib/moxml/version.rb
CHANGED