svg_conform 0.2.7 → 0.2.9
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/Gemfile.lock +106 -18
- data/README.adoc +7 -0
- data/config/profiles/{metanorma.yml → metanorma-sample.yml} +6 -6
- data/docs/api_reference.adoc +21 -21
- data/docs/cli_guide.adoc +41 -41
- data/docs/profiles.adoc +8 -2
- data/docs/reference_manifest.adoc +3 -3
- data/lib/svg_conform/cli.rb +4 -4
- data/lib/svg_conform/errors/validation_issue.rb +6 -1
- data/lib/svg_conform/version.rb +1 -1
- data/spec/svg_conform/errors/validation_issue_spec.rb +53 -0
- data/spec/svg_conform/gemspec_spec.rb +21 -7
- data/spec/svg_conform/profiles/metanorma_profile_spec.rb +64 -8
- data/spec/svg_conform/profiles_plantuml_spec.rb +1 -1
- data/spec/svg_conform/references/integration_spec.rb +1 -1
- data/spec/svg_conform/requirements/id_reference_state_spec.rb +5 -5
- data/spec/svg_conform/requirements/text_as_path_requirement_spec.rb +5 -5
- data/spec/svg_conform/validator_input_types_spec.rb +11 -11
- data/spec/svg_conform_spec.rb +3 -3
- data/svg_conform.gemspec +6 -0
- metadata +17 -2
|
@@ -55,7 +55,7 @@ RSpec.describe SvgConform::Requirements::TextAsPathRequirement do
|
|
|
55
55
|
</svg>
|
|
56
56
|
SVG
|
|
57
57
|
|
|
58
|
-
result = validator.validate(svg, profile: :metanorma)
|
|
58
|
+
result = validator.validate(svg, profile: :"metanorma-sample")
|
|
59
59
|
|
|
60
60
|
# Text-as-path is a quality advisory declared with severity: warning:
|
|
61
61
|
# it must surface as a warning, never as an error, so that schema-valid
|
|
@@ -76,7 +76,7 @@ RSpec.describe SvgConform::Requirements::TextAsPathRequirement do
|
|
|
76
76
|
</svg>
|
|
77
77
|
SVG
|
|
78
78
|
|
|
79
|
-
result = validator.validate(svg, profile: :metanorma)
|
|
79
|
+
result = validator.validate(svg, profile: :"metanorma-sample")
|
|
80
80
|
text_as_path_errors = result.errors.select do |e|
|
|
81
81
|
e.message.include?("rendered as paths")
|
|
82
82
|
end
|
|
@@ -92,7 +92,7 @@ RSpec.describe SvgConform::Requirements::TextAsPathRequirement do
|
|
|
92
92
|
</svg>
|
|
93
93
|
SVG
|
|
94
94
|
|
|
95
|
-
result = validator.validate(svg, profile: :metanorma)
|
|
95
|
+
result = validator.validate(svg, profile: :"metanorma-sample")
|
|
96
96
|
text_as_path_errors = result.errors.select do |e|
|
|
97
97
|
e.message.include?("rendered as paths")
|
|
98
98
|
end
|
|
@@ -107,7 +107,7 @@ RSpec.describe SvgConform::Requirements::TextAsPathRequirement do
|
|
|
107
107
|
</svg>
|
|
108
108
|
SVG
|
|
109
109
|
|
|
110
|
-
result = validator.validate(svg, profile: :metanorma)
|
|
110
|
+
result = validator.validate(svg, profile: :"metanorma-sample")
|
|
111
111
|
text_as_path_errors = result.errors.select do |e|
|
|
112
112
|
e.message.include?("rendered as paths")
|
|
113
113
|
end
|
|
@@ -122,7 +122,7 @@ RSpec.describe SvgConform::Requirements::TextAsPathRequirement do
|
|
|
122
122
|
</svg>
|
|
123
123
|
SVG
|
|
124
124
|
|
|
125
|
-
result = validator.validate(svg, profile: :metanorma)
|
|
125
|
+
result = validator.validate(svg, profile: :"metanorma-sample")
|
|
126
126
|
text_as_path_errors = result.errors.select do |e|
|
|
127
127
|
e.message.include?("rendered as paths")
|
|
128
128
|
end
|
|
@@ -16,7 +16,7 @@ RSpec.describe SvgConform::Validator do
|
|
|
16
16
|
describe "#validate with different input types" do
|
|
17
17
|
context "with String input (backward compatibility)" do
|
|
18
18
|
it "validates XML string successfully" do
|
|
19
|
-
result = validator.validate(simple_svg, profile: :metanorma)
|
|
19
|
+
result = validator.validate(simple_svg, profile: :"metanorma-sample")
|
|
20
20
|
|
|
21
21
|
expect(result).to be_a(SvgConform::ValidationResult)
|
|
22
22
|
expect(result.valid?).to be true
|
|
@@ -37,7 +37,7 @@ RSpec.describe SvgConform::Validator do
|
|
|
37
37
|
moxml_doc = Moxml.new.parse(simple_svg)
|
|
38
38
|
|
|
39
39
|
# Validate using the document object
|
|
40
|
-
result = validator.validate(moxml_doc, profile: :metanorma)
|
|
40
|
+
result = validator.validate(moxml_doc, profile: :"metanorma-sample")
|
|
41
41
|
|
|
42
42
|
expect(result).to be_a(SvgConform::ValidationResult)
|
|
43
43
|
expect(result.valid?).to be true
|
|
@@ -50,7 +50,7 @@ RSpec.describe SvgConform::Validator do
|
|
|
50
50
|
# (SAX mode is safe for large files, unlike DOM)
|
|
51
51
|
expect(moxml_doc).to receive(:to_xml).once.and_call_original
|
|
52
52
|
|
|
53
|
-
validator.validate(moxml_doc, profile: :metanorma)
|
|
53
|
+
validator.validate(moxml_doc, profile: :"metanorma-sample")
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
@@ -59,7 +59,7 @@ RSpec.describe SvgConform::Validator do
|
|
|
59
59
|
moxml_doc = Moxml.new.parse(simple_svg)
|
|
60
60
|
svg_element = moxml_doc.root
|
|
61
61
|
|
|
62
|
-
result = validator.validate(svg_element, profile: :metanorma)
|
|
62
|
+
result = validator.validate(svg_element, profile: :"metanorma-sample")
|
|
63
63
|
|
|
64
64
|
expect(result).to be_a(SvgConform::ValidationResult)
|
|
65
65
|
expect(result.valid?).to be true
|
|
@@ -70,7 +70,7 @@ RSpec.describe SvgConform::Validator do
|
|
|
70
70
|
it "validates a leptris document" do
|
|
71
71
|
leptris_doc = Leptris::XML.parse(simple_svg)
|
|
72
72
|
|
|
73
|
-
result = validator.validate(leptris_doc, profile: :metanorma)
|
|
73
|
+
result = validator.validate(leptris_doc, profile: :"metanorma-sample")
|
|
74
74
|
|
|
75
75
|
expect(result).to be_a(SvgConform::ValidationResult)
|
|
76
76
|
expect(result.valid?).to be true
|
|
@@ -81,7 +81,7 @@ RSpec.describe SvgConform::Validator do
|
|
|
81
81
|
svg_element = leptris_doc.root
|
|
82
82
|
|
|
83
83
|
# This is the metanorma use case - passing element directly
|
|
84
|
-
result = validator.validate(svg_element, profile: :metanorma)
|
|
84
|
+
result = validator.validate(svg_element, profile: :"metanorma-sample")
|
|
85
85
|
|
|
86
86
|
expect(result).to be_a(SvgConform::ValidationResult)
|
|
87
87
|
expect(result.valid?).to be true
|
|
@@ -95,20 +95,20 @@ RSpec.describe SvgConform::Validator do
|
|
|
95
95
|
# (SAX mode is memory-safe for large SVGs)
|
|
96
96
|
expect(svg_element).to receive(:to_xml).once.and_call_original
|
|
97
97
|
|
|
98
|
-
validator.validate(svg_element, profile: :metanorma)
|
|
98
|
+
validator.validate(svg_element, profile: :"metanorma-sample")
|
|
99
99
|
end
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
context "with invalid input" do
|
|
103
103
|
it "raises ArgumentError for unsupported input type" do
|
|
104
104
|
expect do
|
|
105
|
-
validator.validate(12345, profile: :metanorma)
|
|
105
|
+
validator.validate(12345, profile: :"metanorma-sample")
|
|
106
106
|
end.to raise_error(ArgumentError, /Invalid input type/)
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
it "raises ArgumentError for nil input" do
|
|
110
110
|
expect do
|
|
111
|
-
validator.validate(nil, profile: :metanorma)
|
|
111
|
+
validator.validate(nil, profile: :"metanorma-sample")
|
|
112
112
|
end.to raise_error(ArgumentError, /Invalid input type/)
|
|
113
113
|
end
|
|
114
114
|
end
|
|
@@ -130,7 +130,7 @@ RSpec.describe SvgConform::Validator do
|
|
|
130
130
|
leptris_doc = Leptris::XML.parse(svg_with_refs)
|
|
131
131
|
svg_element = leptris_doc.root
|
|
132
132
|
|
|
133
|
-
result = validator.validate(svg_element, profile: :metanorma)
|
|
133
|
+
result = validator.validate(svg_element, profile: :"metanorma-sample")
|
|
134
134
|
|
|
135
135
|
expect(result.reference_manifest).not_to be_nil
|
|
136
136
|
expect(result.available_ids.map(&:id_value)).to include("box")
|
|
@@ -140,7 +140,7 @@ RSpec.describe SvgConform::Validator do
|
|
|
140
140
|
it "builds reference manifest from Moxml document" do
|
|
141
141
|
moxml_doc = Moxml.new.parse(svg_with_refs)
|
|
142
142
|
|
|
143
|
-
result = validator.validate(moxml_doc, profile: :metanorma)
|
|
143
|
+
result = validator.validate(moxml_doc, profile: :"metanorma-sample")
|
|
144
144
|
|
|
145
145
|
expect(result.reference_manifest).not_to be_nil
|
|
146
146
|
expect(result.available_ids.map(&:id_value)).to include("box")
|
data/spec/svg_conform_spec.rb
CHANGED
|
@@ -48,7 +48,7 @@ RSpec.describe SvgConform do
|
|
|
48
48
|
validator = SvgConform::Validator.new(mode: :sax)
|
|
49
49
|
|
|
50
50
|
# First validation with metanorma profile
|
|
51
|
-
profile_meta = SvgConform::Profiles.get("metanorma")
|
|
51
|
+
profile_meta = SvgConform::Profiles.get("metanorma-sample")
|
|
52
52
|
result_meta1 = validator.validate(svg_with_invalid_ref,
|
|
53
53
|
profile: profile_meta)
|
|
54
54
|
first_meta_count = result_meta1.errors.count
|
|
@@ -97,7 +97,7 @@ RSpec.describe SvgConform do
|
|
|
97
97
|
it "handles interleaved profile validations correctly" do
|
|
98
98
|
validator = SvgConform::Validator.new(mode: :sax)
|
|
99
99
|
|
|
100
|
-
profile_meta = SvgConform::Profiles.get("metanorma")
|
|
100
|
+
profile_meta = SvgConform::Profiles.get("metanorma-sample")
|
|
101
101
|
profile_rfc = SvgConform::Profiles.get("svg_1_2_rfc")
|
|
102
102
|
|
|
103
103
|
# Interleave validations
|
|
@@ -165,7 +165,7 @@ RSpec.describe SvgConform do
|
|
|
165
165
|
validator = SvgConform::Validator.new(mode: :sax)
|
|
166
166
|
|
|
167
167
|
# Validate with metanorma (should have 0 errors - more permissive)
|
|
168
|
-
profile_meta = SvgConform::Profiles.get("metanorma")
|
|
168
|
+
profile_meta = SvgConform::Profiles.get("metanorma-sample")
|
|
169
169
|
result_meta = validator.validate(svg_with_styles, profile: profile_meta)
|
|
170
170
|
meta_errors = result_meta.errors.count
|
|
171
171
|
|
data/svg_conform.gemspec
CHANGED
|
@@ -29,6 +29,12 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
30
30
|
spec.require_paths = ["lib"]
|
|
31
31
|
|
|
32
|
+
# The diagnostics adapter and the CLI's json/yaml output paths are built
|
|
33
|
+
# on lens_core (svg_conform.rb guards the require, but the guard's
|
|
34
|
+
# rescue LoadError misses Bundler::GemNotFound — undeclared, the CLI
|
|
35
|
+
# crashed on strict bundler deployments, claricle/svg_conform#130).
|
|
36
|
+
# lens_core 0.1.0 is published, so the 0.2.5-era optionality is obsolete.
|
|
37
|
+
spec.add_dependency "lens_core", "~> 0.1"
|
|
32
38
|
spec.add_dependency "lutaml-model", "~> 0.8.155"
|
|
33
39
|
spec.add_dependency "moxml", "~> 0.6.0"
|
|
34
40
|
spec.add_dependency "nokogiri", "~> 1.16"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: svg_conform
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose
|
|
@@ -10,6 +10,20 @@ bindir: exe
|
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2026-11-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: lens_core
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0.1'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0.1'
|
|
13
27
|
- !ruby/object:Gem::Dependency
|
|
14
28
|
name: lutaml-model
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -140,7 +154,7 @@ files:
|
|
|
140
154
|
- benchmark/performance_comparison.rb
|
|
141
155
|
- config/profiles/base.yml
|
|
142
156
|
- config/profiles/lucid_fix.yml
|
|
143
|
-
- config/profiles/metanorma.yml
|
|
157
|
+
- config/profiles/metanorma-sample.yml
|
|
144
158
|
- config/profiles/no_external_css.yml
|
|
145
159
|
- config/profiles/svg_1_1_full_static.yml
|
|
146
160
|
- config/profiles/svg_1_2_rfc.yml
|
|
@@ -538,6 +552,7 @@ files:
|
|
|
538
552
|
- spec/svg_conform/commands/svgcheck_generate_command_spec.rb
|
|
539
553
|
- spec/svg_conform/conformance_report_spec.rb
|
|
540
554
|
- spec/svg_conform/diagnostics/lens_core_adapter_spec.rb
|
|
555
|
+
- spec/svg_conform/errors/validation_issue_spec.rb
|
|
541
556
|
- spec/svg_conform/gemspec_spec.rb
|
|
542
557
|
- spec/svg_conform/profiles/base_profile_spec.rb
|
|
543
558
|
- spec/svg_conform/profiles/lucid_fix_profile_spec.rb
|