moxml 0.1.22 → 0.1.23
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/.gitignore +1 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +680 -110
- data/Rakefile +12 -9
- data/lib/compat/opal/rexml/namespace.rb +8 -5
- data/lib/compat/opal/rexml/parsers/baseparser.rb +276 -212
- data/lib/compat/opal/rexml/source.rb +28 -27
- data/lib/compat/opal/rexml/text.rb +112 -104
- data/lib/compat/opal/rexml/xmltokens.rb +8 -8
- data/lib/compat/opal/rexml_compat.rb +12 -11
- data/lib/moxml/adapter/customized_oga/xml_declaration.rb +8 -1
- data/lib/moxml/adapter/customized_rexml/formatter.rb +4 -4
- data/lib/moxml/adapter/libxml/entity_ref_registry.rb +4 -2
- data/lib/moxml/adapter/libxml/entity_restorer.rb +3 -1
- data/lib/moxml/adapter/libxml.rb +17 -4
- data/lib/moxml/adapter/nokogiri.rb +17 -15
- data/lib/moxml/adapter/oga.rb +43 -62
- data/lib/moxml/adapter/ox.rb +35 -18
- data/lib/moxml/adapter.rb +1 -1
- data/lib/moxml/config.rb +15 -2
- data/lib/moxml/document.rb +2 -8
- data/lib/moxml/entity_registry.rb +8 -4
- data/lib/moxml/entity_registry_opal_data.rb +3 -2
- data/lib/moxml/node.rb +8 -0
- data/lib/moxml/version.rb +1 -1
- data/lib/moxml/xml_utils.rb +1 -0
- data/lib/moxml.rb +7 -0
- data/spec/integration/all_adapters_spec.rb +1 -0
- data/spec/integration/shared_examples/line_ending_behavior.rb +56 -0
- data/spec/moxml/adapter/libxml_internals_spec.rb +4 -2
- data/spec/moxml/adapter/platform_spec.rb +2 -1
- data/spec/moxml/config_spec.rb +33 -0
- metadata +3 -2
|
@@ -105,7 +105,8 @@ RSpec.describe Moxml::Adapter::Libxml do
|
|
|
105
105
|
|
|
106
106
|
it "returns [nil, nil] when the document has no entity-ref attachments" do
|
|
107
107
|
root = libxml_native(context.parse("<root><a/></root>").root)
|
|
108
|
-
expect(adapter.send(:lookup_entity_ref_serialization,
|
|
108
|
+
expect(adapter.send(:lookup_entity_ref_serialization,
|
|
109
|
+
root)).to eq([nil, nil])
|
|
109
110
|
end
|
|
110
111
|
|
|
111
112
|
it "returns [nil, nil] for an element with no entity refs even when the doc has erefs elsewhere" do
|
|
@@ -129,7 +130,8 @@ RSpec.describe Moxml::Adapter::Libxml do
|
|
|
129
130
|
)
|
|
130
131
|
a.add_child(eref)
|
|
131
132
|
|
|
132
|
-
refs, seq = adapter.send(:lookup_entity_ref_serialization,
|
|
133
|
+
refs, seq = adapter.send(:lookup_entity_ref_serialization,
|
|
134
|
+
libxml_native(a))
|
|
133
135
|
expect(refs).to be_an(Array).and(satisfy { |r| !r.empty? })
|
|
134
136
|
expect(seq).to be_an(Array).and(include(:eref))
|
|
135
137
|
end
|
|
@@ -4,7 +4,8 @@ require "spec_helper"
|
|
|
4
4
|
|
|
5
5
|
RSpec.describe Moxml::Adapter, ".platform_adapters" do
|
|
6
6
|
it "includes all known adapters under MRI" do
|
|
7
|
-
expect(described_class.platform_adapters).to include(:nokogiri, :oga,
|
|
7
|
+
expect(described_class.platform_adapters).to include(:nokogiri, :oga,
|
|
8
|
+
:rexml, :ox)
|
|
8
9
|
end
|
|
9
10
|
|
|
10
11
|
it "uses the AVAILABLE_ADAPTERS constant under MRI" do
|
data/spec/moxml/config_spec.rb
CHANGED
|
@@ -10,6 +10,7 @@ RSpec.describe Moxml::Config do
|
|
|
10
10
|
expect(config.strict_parsing).to be true
|
|
11
11
|
expect(config.default_encoding).to eq("UTF-8")
|
|
12
12
|
expect(config.default_indent).to eq(2)
|
|
13
|
+
expect(config.default_line_ending).to eq("\n")
|
|
13
14
|
expect(config.entity_encoding).to eq(:basic)
|
|
14
15
|
end
|
|
15
16
|
|
|
@@ -89,6 +90,38 @@ RSpec.describe Moxml::Config do
|
|
|
89
90
|
end
|
|
90
91
|
end
|
|
91
92
|
|
|
93
|
+
describe "#default_line_ending=" do
|
|
94
|
+
it "accepts LINE_ENDING_LF" do
|
|
95
|
+
config.default_line_ending = Moxml::Config::LINE_ENDING_LF
|
|
96
|
+
expect(config.default_line_ending).to eq("\n")
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
it "accepts LINE_ENDING_CRLF" do
|
|
100
|
+
config.default_line_ending = Moxml::Config::LINE_ENDING_CRLF
|
|
101
|
+
expect(config.default_line_ending).to eq("\r\n")
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it "rejects nil" do
|
|
105
|
+
expect { config.default_line_ending = nil }
|
|
106
|
+
.to raise_error(ArgumentError, /Invalid line_ending/)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it "rejects arbitrary strings" do
|
|
110
|
+
expect { config.default_line_ending = "BAD" }
|
|
111
|
+
.to raise_error(ArgumentError, /Invalid line_ending/)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it "rejects bare CR" do
|
|
115
|
+
expect { config.default_line_ending = "\r" }
|
|
116
|
+
.to raise_error(ArgumentError, /Invalid line_ending/)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it "rejects empty string" do
|
|
120
|
+
expect { config.default_line_ending = "" }
|
|
121
|
+
.to raise_error(ArgumentError, /Invalid line_ending/)
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
92
125
|
describe "#adapter=" do
|
|
93
126
|
it "sets valid adapter" do
|
|
94
127
|
config.adapter = :ox
|
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.1.
|
|
4
|
+
version: 0.1.23
|
|
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-
|
|
11
|
+
date: 2026-06-01 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
|
|
@@ -287,6 +287,7 @@ files:
|
|
|
287
287
|
- spec/integration/shared_examples/high_level/context_behavior.rb
|
|
288
288
|
- spec/integration/shared_examples/high_level/document_builder_behavior.rb
|
|
289
289
|
- spec/integration/shared_examples/integration_workflows.rb
|
|
290
|
+
- spec/integration/shared_examples/line_ending_behavior.rb
|
|
290
291
|
- spec/integration/shared_examples/node_wrappers/.gitkeep
|
|
291
292
|
- spec/integration/shared_examples/node_wrappers/attribute_behavior.rb
|
|
292
293
|
- spec/integration/shared_examples/node_wrappers/cdata_behavior.rb
|