moxml 0.5.28 → 0.5.30
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/serialize.rb +15 -9
- data/lib/moxml/version.rb +1 -1
- data/spec/moxml/adapter/leptris_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b9c5b752aba6a52719fbeb794be70155e0fc52a553889e424b3cfbc0a4afa324
|
|
4
|
+
data.tar.gz: ee7a443060fc562236ccfb135c509ae65e51ba3ec930cd8a39cb3a917f5e41ed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d92bc0324a80312556a369b6b1ce7b1619c13ef23fac2212c3148211deb7c786543b83568ea6a1d312df9e09189f1d8feabf8b5d44840618852124d4c5550dd7
|
|
7
|
+
data.tar.gz: 9a0b511e096230051cd1e92ae3e36603b02ddfe2f2c03cfaf6d8072b21defda2e65938c4f9963516d3d3696a44a7689d98cc68244bd60e26672c49e04d292079
|
|
@@ -86,22 +86,28 @@ module Moxml
|
|
|
86
86
|
RAW_AMP_RE = /&(?!#{Entity::NAME_PATTERN};|#\d+;|#x[0-9A-Fa-f]+;)/
|
|
87
87
|
|
|
88
88
|
# A raw "<" in text position — the engine intermittently
|
|
89
|
-
#
|
|
90
|
-
# (leptris-ruby#131), so a decoded <
|
|
91
|
-
# reparsing
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
#
|
|
89
|
+
# lost the escape when parsing under allocation pressure
|
|
90
|
+
# (leptris-ruby#131), so a decoded < serialized bare and
|
|
91
|
+
# reparsing truncated at it. Fixed in leptris 1.9.80 (verified
|
|
92
|
+
# 0/200 on the churn repro); the guard stays armed below that
|
|
93
|
+
# version and for any future build that regresses — the
|
|
94
|
+
# parse-under-pressure spec in leptris_spec fails loudly if a
|
|
95
|
+
# fixed-version build corrupts while the guard is stood down.
|
|
95
96
|
RAW_LT_RE = /<(?![A-Za-z_:\/?!])/
|
|
97
|
+
RAW_LT_TRIGGER_RE = /<[^A-Za-z_:\/?!]/
|
|
98
|
+
RAW_LT_GUARD_ACTIVE =
|
|
99
|
+
Gem::Version.new(::Leptris::VERSION) < Gem::Version.new("1.9.80")
|
|
96
100
|
|
|
97
101
|
def normalize_serialization(xml, options)
|
|
98
102
|
# The libxml2-layout serializer (>= 1.9.42) keeps attribute
|
|
99
103
|
# apostrophes literal; older engines escaped them.
|
|
100
104
|
needs_apos = !LIBXML2_LAYOUT_PARITY && xml.include?("'")
|
|
101
105
|
needs_expand = options[:expand_empty] && xml.include?("/>")
|
|
102
|
-
#
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
# Corruption guards: the 1-char ampersand probe is ~1µs
|
|
107
|
+
# (memchr-class); the raw-< scan runs only on builds that
|
|
108
|
+
# still carry the parse race (leptris-ruby#131).
|
|
109
|
+
needs_amp = xml.include?("&") && xml.match?(RAW_AMP_RE)
|
|
110
|
+
needs_lt = RAW_LT_GUARD_ACTIVE && xml.match?(RAW_LT_TRIGGER_RE)
|
|
105
111
|
return xml unless needs_apos || needs_expand || needs_amp || needs_lt
|
|
106
112
|
|
|
107
113
|
out = +""
|
data/lib/moxml/version.rb
CHANGED
|
@@ -244,6 +244,7 @@ RSpec.describe Moxml::Adapter::Leptris do
|
|
|
244
244
|
end
|
|
245
245
|
|
|
246
246
|
it "repairs a raw < in text position (issue #167 / leptris-ruby#131)" do
|
|
247
|
+
skip "guard stood down on fixed bindings (leptris-ruby#131, 1.9.80+)" unless described_class::Serialize::RAW_LT_GUARD_ACTIVE
|
|
247
248
|
# The engine intermittently drops the escape when parsing under
|
|
248
249
|
# allocation pressure: a decoded < serializes bare and the
|
|
249
250
|
# output fails to reparse. Valid markup never puts < before a
|
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.
|
|
4
|
+
version: 0.5.30
|
|
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-09-
|
|
11
|
+
date: 2026-09-04 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
|