moxml 0.5.28 → 0.5.29
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 +10 -4
- data/lib/moxml/version.rb +1 -1
- 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: df62f6f6a27c7ff63c2893ae7d85547d09645d059b187fd4235111c18ad2467f
|
|
4
|
+
data.tar.gz: a9c0e9ee0a3f7f2c8775ba5dfa49563e048ef3e2aac506eaef9135c2a2390139
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 705a551074ea195562d7af4b726a388e8c3517ec4366cf9dff3d3b0828a79f46b6a50d79501d9c5ed1df871855f90bc5d5b69b35e22eb006b558e26c0da5626b
|
|
7
|
+
data.tar.gz: 2e5b4b7da9018d41434c23c70ea4ced99e626ef813dc92b6d2e1df8d9f8f81e89ac536dd52f684bd95de9fcb610ba673eaa9914de5048a491ee0f217bdfa1975
|
|
@@ -91,17 +91,23 @@ module Moxml
|
|
|
91
91
|
# reparsing truncates at it. Valid markup NEVER puts "<"
|
|
92
92
|
# before a non-name, non-delimiter character, so this is
|
|
93
93
|
# deterministic in markup segments (CDATA is literal and
|
|
94
|
-
# excluded by the segment walker).
|
|
94
|
+
# excluded by the segment walker). One class-anchored scan:
|
|
95
|
+
# multi-char literal probes cost ~30x a single regex pass on
|
|
96
|
+
# CRuby (measured include?("< ") at 31µs vs this regex at
|
|
97
|
+
# 64µs for 14 probes' worth of coverage on 32KB).
|
|
95
98
|
RAW_LT_RE = /<(?![A-Za-z_:\/?!])/
|
|
99
|
+
RAW_LT_TRIGGER_RE = /<[^A-Za-z_:\/?!]/
|
|
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); both regexes only run when their cheap
|
|
108
|
+
# necessary condition holds.
|
|
109
|
+
needs_amp = xml.include?("&") && xml.match?(RAW_AMP_RE)
|
|
110
|
+
needs_lt = 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
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.29
|
|
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
|