svg_conform 0.2.8 → 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 +34 -34
- data/config/profiles/metanorma-sample.yml +4 -4
- data/lib/svg_conform/version.rb +1 -1
- data/spec/svg_conform/gemspec_spec.rb +11 -0
- data/spec/svg_conform/profiles/metanorma_profile_spec.rb +56 -0
- 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: f1bb2e0bc6387159b268055587a32744edbf3e95d778fc56e5b96930525333f9
|
|
4
|
+
data.tar.gz: 0fd0c9e6ed4a141b7589033abf09664aa561514a6249a27edbdab8dfdbbf8c6d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 402a882d57a09d6940235905f13defc5ef30ddb2c8b749fac2eb1bf7ee150eae4557204ffeca46f4d7583857d17946e5c09ebd1a658e8e7b814f7763a6e75390
|
|
7
|
+
data.tar.gz: e5da72b068630f3b38e8ca1d656fe923da5991c8a75f0da07b85338ece772b60f4e8617ca36f2dd0269b6c9bb5a429756547c40be572c9c67842b23e8f3fda22
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
svg_conform (0.2.
|
|
4
|
+
svg_conform (0.2.8)
|
|
5
5
|
lens_core (~> 0.1)
|
|
6
6
|
lutaml-model (~> 0.8.155)
|
|
7
7
|
moxml (~> 0.6.0)
|
|
@@ -40,21 +40,21 @@ GEM
|
|
|
40
40
|
json (3.1.0)
|
|
41
41
|
language_server-protocol (3.17.0.6)
|
|
42
42
|
lens_core (0.1.0)
|
|
43
|
-
leptris (1.9.
|
|
43
|
+
leptris (1.9.417.0-aarch64-linux)
|
|
44
44
|
ffi (~> 1.15)
|
|
45
|
-
leptris (1.9.
|
|
45
|
+
leptris (1.9.417.0-aarch64-linux-musl)
|
|
46
46
|
ffi (~> 1.15)
|
|
47
|
-
leptris (1.9.
|
|
47
|
+
leptris (1.9.417.0-arm-linux)
|
|
48
48
|
ffi (~> 1.15)
|
|
49
|
-
leptris (1.9.
|
|
49
|
+
leptris (1.9.417.0-arm-linux-musl)
|
|
50
50
|
ffi (~> 1.15)
|
|
51
|
-
leptris (1.9.
|
|
51
|
+
leptris (1.9.417.0-arm64-darwin)
|
|
52
52
|
ffi (~> 1.15)
|
|
53
|
-
leptris (1.9.
|
|
53
|
+
leptris (1.9.417.0-x86_64-darwin)
|
|
54
54
|
ffi (~> 1.15)
|
|
55
|
-
leptris (1.9.
|
|
55
|
+
leptris (1.9.417.0-x86_64-linux)
|
|
56
56
|
ffi (~> 1.15)
|
|
57
|
-
leptris (1.9.
|
|
57
|
+
leptris (1.9.417.0-x86_64-linux-musl)
|
|
58
58
|
ffi (~> 1.15)
|
|
59
59
|
lint_roller (1.1.0)
|
|
60
60
|
liquid (5.14.0)
|
|
@@ -161,21 +161,21 @@ GEM
|
|
|
161
161
|
unicode-name (1.15.1)
|
|
162
162
|
unicode-types (~> 1.12)
|
|
163
163
|
unicode-types (1.12.0)
|
|
164
|
-
yeptris (0.6.62.
|
|
164
|
+
yeptris (0.6.62.2-aarch64-linux)
|
|
165
165
|
ffi (~> 1.15)
|
|
166
|
-
yeptris (0.6.62.
|
|
166
|
+
yeptris (0.6.62.2-aarch64-linux-musl)
|
|
167
167
|
ffi (~> 1.15)
|
|
168
|
-
yeptris (0.6.62.
|
|
168
|
+
yeptris (0.6.62.2-arm-linux-eabihf)
|
|
169
169
|
ffi (~> 1.15)
|
|
170
|
-
yeptris (0.6.62.
|
|
170
|
+
yeptris (0.6.62.2-arm-linux-musleabihf)
|
|
171
171
|
ffi (~> 1.15)
|
|
172
|
-
yeptris (0.6.62.
|
|
172
|
+
yeptris (0.6.62.2-arm64-darwin)
|
|
173
173
|
ffi (~> 1.15)
|
|
174
|
-
yeptris (0.6.62.
|
|
174
|
+
yeptris (0.6.62.2-x86_64-darwin)
|
|
175
175
|
ffi (~> 1.15)
|
|
176
|
-
yeptris (0.6.62.
|
|
176
|
+
yeptris (0.6.62.2-x86_64-linux)
|
|
177
177
|
ffi (~> 1.15)
|
|
178
|
-
yeptris (0.6.62.
|
|
178
|
+
yeptris (0.6.62.2-x86_64-linux-musl)
|
|
179
179
|
ffi (~> 1.15)
|
|
180
180
|
|
|
181
181
|
PLATFORMS
|
|
@@ -228,14 +228,14 @@ CHECKSUMS
|
|
|
228
228
|
json (3.1.0) sha256=3ce7ccf8fde58960177a3a756c31f292a4c1e1dedee884547096a5b0604e3bd8
|
|
229
229
|
language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
|
|
230
230
|
lens_core (0.1.0) sha256=9481ce7721be1b9ddb08e0edde349775849614d40a78ff05ec5887de2aa9e2b6
|
|
231
|
-
leptris (1.9.
|
|
232
|
-
leptris (1.9.
|
|
233
|
-
leptris (1.9.
|
|
234
|
-
leptris (1.9.
|
|
235
|
-
leptris (1.9.
|
|
236
|
-
leptris (1.9.
|
|
237
|
-
leptris (1.9.
|
|
238
|
-
leptris (1.9.
|
|
231
|
+
leptris (1.9.417.0-aarch64-linux) sha256=dba75a31e71573b14f0c9247db99cbc7888c315738c435989aac1352c4a94e56
|
|
232
|
+
leptris (1.9.417.0-aarch64-linux-musl) sha256=011a67588f22d397a98d5a52fb32d40cdfd1456caaae68a5b646a11d851c8e44
|
|
233
|
+
leptris (1.9.417.0-arm-linux) sha256=6eff14e2d464cc95d7671833b485eaf5ceef45663ef3d7b0024d2c3dca414ca4
|
|
234
|
+
leptris (1.9.417.0-arm-linux-musl) sha256=b862cd5cf644f107a536f9c4a72e4346bcf221522c4a54747232155c4aa19862
|
|
235
|
+
leptris (1.9.417.0-arm64-darwin) sha256=cb40ee5c4f1b6c507a626e5a1fe35cf81265c470ff48ce7e6cb51336bc3572bc
|
|
236
|
+
leptris (1.9.417.0-x86_64-darwin) sha256=f48f3b8ea5e395633cf0925106e1196831a9b8666217d8b1289d7b9b865ddcd1
|
|
237
|
+
leptris (1.9.417.0-x86_64-linux) sha256=ea69ee2a4e4b6f22d85d890adf6b03a2e791f7cc7a9f267140c5d12b0c2bfe34
|
|
238
|
+
leptris (1.9.417.0-x86_64-linux-musl) sha256=ec4ba05b66afb308a770f842312cd3346b9117be0b0c0812d6be13851a1368a9
|
|
239
239
|
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
240
240
|
liquid (5.14.0) sha256=e1020c2b2ee58c7a4d3bfdc7a331537bd27a783353748bff0bf27c6ac0c17065
|
|
241
241
|
lutaml-model (0.8.174) sha256=d8e92d630a5972fe98bf5fe3f778db47afa328fb36a712c71531e6f82b49d110
|
|
@@ -279,21 +279,21 @@ CHECKSUMS
|
|
|
279
279
|
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
280
280
|
rubyzip (3.7.0) sha256=65c19294da75297a939006f3516deacc33185fbd721ff1954f7a231db6d3e121
|
|
281
281
|
strscan (3.1.8) sha256=aae2db611a225559f21ffbb71765c9a4e60fd262534a9ea84f4f11c7f32f679e
|
|
282
|
-
svg_conform (0.2.
|
|
282
|
+
svg_conform (0.2.8)
|
|
283
283
|
table_tennis (1.0.0) sha256=955f76ca4debd42ee88682af8d4554a74d533c89de4f1581bc37855b15faa956
|
|
284
284
|
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
|
|
285
285
|
unicode-display_width (3.3.0) sha256=4b7aa66a4b11db50f6f7e98411215cd0dd10eaecb665d36eec5bcacb3fa0b613
|
|
286
286
|
unicode-emoji (4.3.0) sha256=11c02fa73290378c066bb0562cd4c87d8e1b706fbbe0059ca12746a4244de8ce
|
|
287
287
|
unicode-name (1.15.1) sha256=b8f2e3ca14bc24799f84a4f74d43a3612d02a051700d88bc6ca8e3bd53cda3f6
|
|
288
288
|
unicode-types (1.12.0) sha256=7e26a4352cecc2a50325a3793df834b732581ca9f25c5e29f46f3378934363f6
|
|
289
|
-
yeptris (0.6.62.
|
|
290
|
-
yeptris (0.6.62.
|
|
291
|
-
yeptris (0.6.62.
|
|
292
|
-
yeptris (0.6.62.
|
|
293
|
-
yeptris (0.6.62.
|
|
294
|
-
yeptris (0.6.62.
|
|
295
|
-
yeptris (0.6.62.
|
|
296
|
-
yeptris (0.6.62.
|
|
289
|
+
yeptris (0.6.62.2-aarch64-linux) sha256=9dd3bc757f24dad7ca0c939787be1014aa60a06e6457b0eab5688b8b2710631e
|
|
290
|
+
yeptris (0.6.62.2-aarch64-linux-musl) sha256=0571ebfe60beefaa43bfbb7761e3116d62f14bc3cfbfe526b64bb06c536cb327
|
|
291
|
+
yeptris (0.6.62.2-arm-linux-eabihf) sha256=0390680ed96caa7d86de4adeb8af6f9b519c3bc7f64e32b6ae9bcef1c1a6a36e
|
|
292
|
+
yeptris (0.6.62.2-arm-linux-musleabihf) sha256=54f2fe3926320d5f2fdf25d582408f23557cb0b4e5cc537dc70aa1ba6ebfd745
|
|
293
|
+
yeptris (0.6.62.2-arm64-darwin) sha256=aaf5669775735ac1e26c55d6087348976534fbccd8b04b4abf7f73016173dc05
|
|
294
|
+
yeptris (0.6.62.2-x86_64-darwin) sha256=24fd9cdfb1eed94349f8db421a8563b5f2979d3a48b609959977ec4c8099a0d3
|
|
295
|
+
yeptris (0.6.62.2-x86_64-linux) sha256=84ff1b20ce25ae0dd2ec65ea1abc14d881310ab0efef65ddc89e1384cd50a745
|
|
296
|
+
yeptris (0.6.62.2-x86_64-linux-musl) sha256=dd093c8ae7699fd3040fb006be34833412a207edf58b4885ec4f1de8eb4b271b
|
|
297
297
|
|
|
298
298
|
BUNDLED WITH
|
|
299
299
|
4.0.24
|
|
@@ -34,7 +34,7 @@ requirements:
|
|
|
34
34
|
attributes: ["id", "role", "shape-rendering", "text-rendering", "buffered-rendering", "visibility", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "fill-rule"]
|
|
35
35
|
allowed_children: ["text"]
|
|
36
36
|
- tag: "path"
|
|
37
|
-
attributes: ["d", "pathLength", "stroke-miterlimit", "id", "role", "fill", "style", "transform", "font-size", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "clip-path", "mask"]
|
|
37
|
+
attributes: ["d", "pathLength", "stroke-miterlimit", "id", "role", "fill", "style", "transform", "font-size", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "marker-start", "marker-mid", "marker-end", "clip-path", "mask"]
|
|
38
38
|
allowed_children: ["title", "desc"]
|
|
39
39
|
- tag: "rect"
|
|
40
40
|
attributes: ["x", "y", "width", "height", "rx", "ry", "stroke-miterlimit", "id", "role", "fill", "style", "transform", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "clip-path", "mask"]
|
|
@@ -43,16 +43,16 @@ requirements:
|
|
|
43
43
|
attributes: ["cx", "cy", "r", "id", "role", "fill", "style", "transform", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "clip-path", "mask"]
|
|
44
44
|
allowed_children: ["title", "desc"]
|
|
45
45
|
- tag: "line"
|
|
46
|
-
attributes: ["x1", "y1", "x2", "y2", "id", "role", "fill", "transform", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "clip-path", "mask"]
|
|
46
|
+
attributes: ["x1", "y1", "x2", "y2", "id", "role", "fill", "transform", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "marker-start", "marker-mid", "marker-end", "clip-path", "mask"]
|
|
47
47
|
allowed_children: ["title", "desc"]
|
|
48
48
|
- tag: "ellipse"
|
|
49
49
|
attributes: ["cx", "cy", "rx", "ry", "id", "role", "fill", "style", "transform", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "clip-path", "mask"]
|
|
50
50
|
allowed_children: ["title", "desc"]
|
|
51
51
|
- tag: "polyline"
|
|
52
|
-
attributes: ["points", "id", "role", "fill", "transform", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "clip-path", "mask"]
|
|
52
|
+
attributes: ["points", "id", "role", "fill", "transform", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "marker-start", "marker-mid", "marker-end", "clip-path", "mask"]
|
|
53
53
|
allowed_children: ["title", "desc"]
|
|
54
54
|
- tag: "polygon"
|
|
55
|
-
attributes: ["points", "id", "role", "fill", "style", "transform", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "clip-path", "mask"]
|
|
55
|
+
attributes: ["points", "id", "role", "fill", "style", "transform", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "marker-start", "marker-mid", "marker-end", "clip-path", "mask"]
|
|
56
56
|
allowed_children: ["title", "desc"]
|
|
57
57
|
- tag: "solidColor"
|
|
58
58
|
attributes: ["id", "role", "fill", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "clip-path", "mask"]
|
data/lib/svg_conform/version.rb
CHANGED
|
@@ -34,4 +34,15 @@ RSpec.describe "svg_conform.gemspec" do # rubocop:disable RSpec/DescribeClass
|
|
|
34
34
|
expect(SvgConform).to respond_to(:lens_core_available?)
|
|
35
35
|
expect(SvgConform.lens_core_available?).to be_truthy.or be_falsey
|
|
36
36
|
end
|
|
37
|
+
|
|
38
|
+
it "keeps the committed lockfile in sync with the gem version" do
|
|
39
|
+
# The release flow (metanorma/ci rubygems-release) deletes the lock and
|
|
40
|
+
# bumps version.rb without restoring it: staleness is this repo's own
|
|
41
|
+
# guard (ci's words). Without this check, every post-release PR fails
|
|
42
|
+
# bundler 4's frozen install ("gemspecs for path gems changed") before
|
|
43
|
+
# anyone sees why.
|
|
44
|
+
lock = File.read("Gemfile.lock")
|
|
45
|
+
path_version = lock[/\APATH\n remote: \.\n specs:\n svg_conform \(([^)]+)\)/, 1]
|
|
46
|
+
expect(path_version).to eq(SvgConform::VERSION)
|
|
47
|
+
end
|
|
37
48
|
end
|
|
@@ -10,6 +10,11 @@ METANORMA_PROFILE_CLIP_ATTRIBUTES = %w[clip-path mask].freeze
|
|
|
10
10
|
RSpec.describe "Metanorma Profile" do
|
|
11
11
|
let(:metanorma_sample_profile_path) { "config/profiles/metanorma-sample.yml" }
|
|
12
12
|
|
|
13
|
+
let(:validator) { SvgConform::Validator.new(mode: :sax, profile: profile) }
|
|
14
|
+
let(:profile) do
|
|
15
|
+
SvgConform::Profile.load_from_file("config/profiles/metanorma-sample.yml")
|
|
16
|
+
end
|
|
17
|
+
|
|
13
18
|
describe "profile loading" do
|
|
14
19
|
it "loads the Metanorma profile successfully" do
|
|
15
20
|
profile = SvgConform::Profile.load_from_file(metanorma_sample_profile_path)
|
|
@@ -107,4 +112,55 @@ RSpec.describe "Metanorma Profile" do
|
|
|
107
112
|
end
|
|
108
113
|
end
|
|
109
114
|
end
|
|
115
|
+
|
|
116
|
+
def shape_geometry(tag)
|
|
117
|
+
case tag
|
|
118
|
+
when "path" then 'd="M2,6 H38"'
|
|
119
|
+
when "line" then 'x1="2" y1="6" x2="38" y2="6"'
|
|
120
|
+
else 'points="2,6 20,6 38,6"'
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def marker_svg(shape_attrs)
|
|
125
|
+
<<~SVG
|
|
126
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny" width="40" height="12" viewBox="0 0 40 12">
|
|
127
|
+
<defs>
|
|
128
|
+
<marker id="a" markerWidth="4" markerHeight="4" refX="2" refY="2" orient="auto">
|
|
129
|
+
<path d="M0,0 L4,2 L0,4"/>
|
|
130
|
+
</marker>
|
|
131
|
+
</defs>
|
|
132
|
+
<g>#{shape_attrs}</g>
|
|
133
|
+
</svg>
|
|
134
|
+
SVG
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# claricle/svg_conform#128: the profile listed the marker element but
|
|
138
|
+
# none of the marker presentation attributes on the shapes, so
|
|
139
|
+
# marker-end="url(...)" failed while the same marker in a style
|
|
140
|
+
# attribute passed.
|
|
141
|
+
%w[path line polyline polygon].each do |tag|
|
|
142
|
+
it "allows marker-end on #{tag}" do
|
|
143
|
+
svg = marker_svg(
|
|
144
|
+
%(<#{tag} #{shape_geometry(tag)} marker-end="url(#a)"/>),
|
|
145
|
+
)
|
|
146
|
+
result = validator.validate(svg, profile: profile)
|
|
147
|
+
attribute_errors = result.errors.select { |e| e.message.include?("marker-end") }
|
|
148
|
+
expect(attribute_errors).to be_empty
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
it "allows marker-start and marker-mid on #{tag}" do
|
|
152
|
+
svg = marker_svg(
|
|
153
|
+
%(<#{tag} #{shape_geometry(tag)} marker-start="url(#a)" marker-mid="url(#a)" marker-end="url(#a)"/>),
|
|
154
|
+
)
|
|
155
|
+
result = validator.validate(svg, profile: profile)
|
|
156
|
+
attribute_errors = result.errors.select { |e| e.message.include?("marker") }
|
|
157
|
+
expect(attribute_errors).to be_empty
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
it "still rejects marker attributes on rect, where SVG does not define them" do
|
|
162
|
+
svg = marker_svg(%(<rect x="2" y="2" width="36" height="8" marker-end="url(#a)"/>))
|
|
163
|
+
result = validator.validate(svg, profile: profile)
|
|
164
|
+
expect(result.errors.map(&:message).join).to include("marker-end")
|
|
165
|
+
end
|
|
110
166
|
end
|