svg_conform 0.2.7 → 0.2.8
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 +98 -10
- data/README.adoc +7 -0
- data/config/profiles/{metanorma.yml → metanorma-sample.yml} +2 -2
- 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 +10 -7
- data/spec/svg_conform/profiles/metanorma_profile_spec.rb +8 -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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dea950e992509d013e749d33df19346be795d3bea5fbddc0c26e32ab5739f3ef
|
|
4
|
+
data.tar.gz: 6159a5a4152bf0304d0832d63ff057ba6de76dfe2f7adabfa9af0554db26c0d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 568dc8fc2390dbe173b741512b2cd2fd2d4c0abb0238e63d5c71d62fd40065064878f0a426c6a28a8c35ae0c85d3ba236e5c782d5b5079fb31cf1ffe958b5710
|
|
7
|
+
data.tar.gz: b880f5000253f4fffd73d6a6ec7432b431faee76175d549df9dc573061f2dfb70cc1104bbcab43b3136cd1733f4d190a8f7a726a61e2f564c19d417d8ecfbcf7
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
svg_conform (0.2.
|
|
4
|
+
svg_conform (0.2.7)
|
|
5
|
+
lens_core (~> 0.1)
|
|
5
6
|
lutaml-model (~> 0.8.155)
|
|
6
7
|
moxml (~> 0.6.0)
|
|
7
8
|
nokogiri (~> 1.16)
|
|
@@ -160,21 +161,21 @@ GEM
|
|
|
160
161
|
unicode-name (1.15.1)
|
|
161
162
|
unicode-types (~> 1.12)
|
|
162
163
|
unicode-types (1.12.0)
|
|
163
|
-
yeptris (0.6.
|
|
164
|
+
yeptris (0.6.62.1-aarch64-linux)
|
|
164
165
|
ffi (~> 1.15)
|
|
165
|
-
yeptris (0.6.
|
|
166
|
+
yeptris (0.6.62.1-aarch64-linux-musl)
|
|
166
167
|
ffi (~> 1.15)
|
|
167
|
-
yeptris (0.6.
|
|
168
|
+
yeptris (0.6.62.1-arm-linux-eabihf)
|
|
168
169
|
ffi (~> 1.15)
|
|
169
|
-
yeptris (0.6.
|
|
170
|
+
yeptris (0.6.62.1-arm-linux-musleabihf)
|
|
170
171
|
ffi (~> 1.15)
|
|
171
|
-
yeptris (0.6.
|
|
172
|
+
yeptris (0.6.62.1-arm64-darwin)
|
|
172
173
|
ffi (~> 1.15)
|
|
173
|
-
yeptris (0.6.
|
|
174
|
+
yeptris (0.6.62.1-x86_64-darwin)
|
|
174
175
|
ffi (~> 1.15)
|
|
175
|
-
yeptris (0.6.
|
|
176
|
+
yeptris (0.6.62.1-x86_64-linux)
|
|
176
177
|
ffi (~> 1.15)
|
|
177
|
-
yeptris (0.6.
|
|
178
|
+
yeptris (0.6.62.1-x86_64-linux-musl)
|
|
178
179
|
ffi (~> 1.15)
|
|
179
180
|
|
|
180
181
|
PLATFORMS
|
|
@@ -207,5 +208,92 @@ DEPENDENCIES
|
|
|
207
208
|
rubocop-rspec
|
|
208
209
|
svg_conform!
|
|
209
210
|
|
|
211
|
+
CHECKSUMS
|
|
212
|
+
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
|
|
213
|
+
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
|
|
214
|
+
bigdecimal (4.1.3) sha256=61ebe1e5e559bdc3cc6f2c0ee7f427321fc838f59611c294356eb04d6e21cf66
|
|
215
|
+
bundler (4.0.24) sha256=16ca64e20816a0cf151a948fb141d788602996d2b4d73577b74388fe84fa98bc
|
|
216
|
+
canon (0.1.23) sha256=502646c0d50cd9e17c8867d24e5808b4adb85230482ad02157f4d4f161f74cc0
|
|
217
|
+
concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1
|
|
218
|
+
csv (3.3.7) sha256=15a3f16f6628da8664d455eb634e7f22031bcf53044923caf56975109e71b9f8
|
|
219
|
+
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
220
|
+
ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df
|
|
221
|
+
ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39
|
|
222
|
+
ffi (1.17.4-arm-linux-gnu) sha256=d6dbddf7cb77bf955411af5f187a65b8cd378cb003c15c05697f5feee1cb1564
|
|
223
|
+
ffi (1.17.4-arm-linux-musl) sha256=9d4838ded0465bef6e2426935f6bcc93134b6616785a84ffd2a3d82bc3cf6f95
|
|
224
|
+
ffi (1.17.4-arm64-darwin) sha256=19071aaf1419251b0a46852abf960e77330a3b334d13a4ab51d58b31a937001b
|
|
225
|
+
ffi (1.17.4-x86_64-darwin) sha256=aa70390523cf3235096cf64962b709b4cfbd5c082a2cb2ae714eb0fe2ccda496
|
|
226
|
+
ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d
|
|
227
|
+
ffi (1.17.4-x86_64-linux-musl) sha256=3fdf9888483de005f8ef8d1cf2d3b20d86626af206cbf780f6a6a12439a9c49e
|
|
228
|
+
json (3.1.0) sha256=3ce7ccf8fde58960177a3a756c31f292a4c1e1dedee884547096a5b0604e3bd8
|
|
229
|
+
language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
|
|
230
|
+
lens_core (0.1.0) sha256=9481ce7721be1b9ddb08e0edde349775849614d40a78ff05ec5887de2aa9e2b6
|
|
231
|
+
leptris (1.9.416.0-aarch64-linux) sha256=b950304a998c90f684170a05befec108dc314a511e3ecc3f3f5115bb7886a826
|
|
232
|
+
leptris (1.9.416.0-aarch64-linux-musl) sha256=ec28b3bb1a4b446f7d16a2844acb097e8bf15da55ffe721672e9c930ade5610f
|
|
233
|
+
leptris (1.9.416.0-arm-linux) sha256=867adb4a68a8e23e4e076e272c4a43886c00f4ce3f8f9dbd5bc028c97ba0274d
|
|
234
|
+
leptris (1.9.416.0-arm-linux-musl) sha256=7906fe74a1f2eb9b94651bc7a8ad182af2e48a0fbac3fd89273311f5d9dac54c
|
|
235
|
+
leptris (1.9.416.0-arm64-darwin) sha256=df339c2f02858af5db7174ad7f5dac033953904c10a3789f3cc77787ea6c6103
|
|
236
|
+
leptris (1.9.416.0-x86_64-darwin) sha256=b0b2c4845bd3e12bc52ed4265293ecc81c20947346ee948839f22e41a703e30e
|
|
237
|
+
leptris (1.9.416.0-x86_64-linux) sha256=7b70e08e01d0f4135a261b29e3011e33d529ace54ce07081f480175915f06e6d
|
|
238
|
+
leptris (1.9.416.0-x86_64-linux-musl) sha256=319ed2d132145cca4726852da647caf773a68fa4ae6f973b58ddca992463442c
|
|
239
|
+
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
240
|
+
liquid (5.14.0) sha256=e1020c2b2ee58c7a4d3bfdc7a331537bd27a783353748bff0bf27c6ac0c17065
|
|
241
|
+
lutaml-model (0.8.174) sha256=d8e92d630a5972fe98bf5fe3f778db47afa328fb36a712c71531e6f82b49d110
|
|
242
|
+
memo_wise (1.13.0) sha256=30220c38c4cef410849bc73553c58664dc2c91c6379e4a1df22aea02358b716b
|
|
243
|
+
moxml (0.6.4) sha256=2038a222a367132b5fdcc40d669d67e6bb913145e4b5e5bd3b7b62fd73a25912
|
|
244
|
+
nokogiri (1.19.7-aarch64-linux-gnu) sha256=8f5e15d299602456406e1f03a9f3456cceb33a0722811e818d2ee2214eb4c84a
|
|
245
|
+
nokogiri (1.19.7-aarch64-linux-musl) sha256=efe0c3602e6e54521bc21c681930ce5568e2d11203de17400710b2b3ca2e4cb4
|
|
246
|
+
nokogiri (1.19.7-arm-linux-gnu) sha256=7fd1907125691aa89e838cc91161761c758b4e17bb32f0dd9b5515a82cc759af
|
|
247
|
+
nokogiri (1.19.7-arm-linux-musl) sha256=28d0ff0c87b6bb2e56580323a6fb049d5d4a02b94f0958fdd47e9ac146991c77
|
|
248
|
+
nokogiri (1.19.7-arm64-darwin) sha256=f27d7f25f4873fbc3aa35a2cc2fb680c98555fec1925348da439d0869d541142
|
|
249
|
+
nokogiri (1.19.7-x86_64-darwin) sha256=508e81e8c5f84aaa240dce981bf1c43faae60808726f0ce7024ee92effc5cafe
|
|
250
|
+
nokogiri (1.19.7-x86_64-linux-gnu) sha256=25865ccb462f714e712fdf8906fde07849cb6704a808e3d629d75baa5af5dd3b
|
|
251
|
+
nokogiri (1.19.7-x86_64-linux-musl) sha256=464d1f3dfb0d53cf54c0c6a7e23e8e91cf68ec3cafc2b27dc4a7682f2d9bf546
|
|
252
|
+
openssl (3.3.3) sha256=d46902138f2987c13122fab826030a11c2bb9b8a16394215cbfc5062c5e2d335
|
|
253
|
+
ostruct (0.6.3) sha256=95a2ed4a4bd1d190784e666b47b2d3f078e4a9efda2fccf18f84ddc6538ed912
|
|
254
|
+
paint (2.3.0) sha256=327d623e4038619d5bd99ae5db07973859cd78400c7f0329eea283cef8e83be5
|
|
255
|
+
parallel (2.3.0) sha256=f75a3e904101ce6a1ccb6b8dc800cbafd42166d83330192438dcf29395167a6f
|
|
256
|
+
parser (3.3.13.0) sha256=e02f9b63c2fe05b0c68f692ba4df89b3cb113b663964f75d988fbebfd6c3deca
|
|
257
|
+
prism (2.1.0-aarch64-linux-gnu) sha256=808dddc72def68e1a0463689414c97e0ba211938eddbab05387a4844aa2b3ec2
|
|
258
|
+
prism (2.1.0-aarch64-linux-musl) sha256=dd1a0732620c1e575dabb07a297a62911fabd72f8e20ce850b522a866f877930
|
|
259
|
+
prism (2.1.0-arm-linux-gnu) sha256=96b2426b9dbab05448c4add735619929042be3cd7e871ff186468121b62bcfa8
|
|
260
|
+
prism (2.1.0-arm-linux-musl) sha256=00ef918e42a3dc98f11a461bf473586a3424b0f78bee8a4e43b5a65a5f5e2cd0
|
|
261
|
+
prism (2.1.0-arm64-darwin) sha256=2d0c2e3e011cfd89c041940907d3ff3def379d7b0f2ba158d1d42238e8ad8afc
|
|
262
|
+
prism (2.1.0-x86_64-darwin) sha256=6c645d8e6afc742956c7518220ce5106367727c4d9980ac9ab386d55004ddab4
|
|
263
|
+
prism (2.1.0-x86_64-linux-gnu) sha256=b2b647afce09551e650b8bb3e2fc91d7d73d392a09534ca307ec0d619c33bfd4
|
|
264
|
+
prism (2.1.0-x86_64-linux-musl) sha256=249f45981726923e259b927902246219fa25ad10a76f43849c9aee1a3d3ec5b8
|
|
265
|
+
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
266
|
+
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
|
|
267
|
+
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
|
|
268
|
+
regexp_parser (2.13.1) sha256=5aedb6b7c35688f51e86eef17a15374dfd287c83f4ca644b2c5f3ec50a33b44b
|
|
269
|
+
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
|
|
270
|
+
rspec-core (3.13.7) sha256=c64ff16d9788119805cbc6a3f4b6d87cc22417c2d25976a3330de136896b5469
|
|
271
|
+
rspec-expectations (3.13.6) sha256=bf538ca6d367ff5b0d85a87fdb5c0c6038f2cd1308a0eeba07476caa02d22f35
|
|
272
|
+
rspec-mocks (3.13.9) sha256=ea5c7ff3054a6098ca6039aacef80aec69d5a8a3ef80be8fc88337359b672a30
|
|
273
|
+
rspec-support (3.13.8) sha256=e4160030309b7e3e9d9863dfe720a35dfcc577162f5402cd68fc8c5258a0ffd6
|
|
274
|
+
rubocop (1.92.2) sha256=14fb31eed143a0dc6f78186c550c1715e81cd38f59d05d1165050e445c1f5382
|
|
275
|
+
rubocop-ast (1.51.0) sha256=0ec311e36b191b3872d909078a35274e962ae97dbce64be6812d145ca59acfcb
|
|
276
|
+
rubocop-performance (1.27.0) sha256=eeeb1374d062a368ee1c787b70eb0b0cc4b184cb1f8565f424760946146d61ce
|
|
277
|
+
rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
|
|
278
|
+
rubocop-rspec (3.10.2) sha256=0b3e2ecc592cd10ecbf0095bb58d1e357905276e069643523cc19eb7495f65e2
|
|
279
|
+
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
280
|
+
rubyzip (3.7.0) sha256=65c19294da75297a939006f3516deacc33185fbd721ff1954f7a231db6d3e121
|
|
281
|
+
strscan (3.1.8) sha256=aae2db611a225559f21ffbb71765c9a4e60fd262534a9ea84f4f11c7f32f679e
|
|
282
|
+
svg_conform (0.2.7)
|
|
283
|
+
table_tennis (1.0.0) sha256=955f76ca4debd42ee88682af8d4554a74d533c89de4f1581bc37855b15faa956
|
|
284
|
+
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
|
|
285
|
+
unicode-display_width (3.3.0) sha256=4b7aa66a4b11db50f6f7e98411215cd0dd10eaecb665d36eec5bcacb3fa0b613
|
|
286
|
+
unicode-emoji (4.3.0) sha256=11c02fa73290378c066bb0562cd4c87d8e1b706fbbe0059ca12746a4244de8ce
|
|
287
|
+
unicode-name (1.15.1) sha256=b8f2e3ca14bc24799f84a4f74d43a3612d02a051700d88bc6ca8e3bd53cda3f6
|
|
288
|
+
unicode-types (1.12.0) sha256=7e26a4352cecc2a50325a3793df834b732581ca9f25c5e29f46f3378934363f6
|
|
289
|
+
yeptris (0.6.62.1-aarch64-linux) sha256=11057a57ab1312504dbf8f0aa89692d86465af375371971846d5a45ad9a40fc9
|
|
290
|
+
yeptris (0.6.62.1-aarch64-linux-musl) sha256=560d07a37536db5fdc51b3462cdf73eaaa5b47f34aca7c265428ef32e7246d3b
|
|
291
|
+
yeptris (0.6.62.1-arm-linux-eabihf) sha256=2144b498a725ef23af16f088eeba3943e73034a12c95f37d5d7274459f15a730
|
|
292
|
+
yeptris (0.6.62.1-arm-linux-musleabihf) sha256=486e8186cc70fed62f0c5c3b52414edfd7c24000b4dfbfdc7ba490729b89ae7b
|
|
293
|
+
yeptris (0.6.62.1-arm64-darwin) sha256=19f8917910248adf03475d43cf2f4f798626da820c112a28c948db8a24c8e2f1
|
|
294
|
+
yeptris (0.6.62.1-x86_64-darwin) sha256=c92bef3810dbbe4fddf67f9dd3b55a7dc2bb2077d0257942cdd7cccd6589d090
|
|
295
|
+
yeptris (0.6.62.1-x86_64-linux) sha256=5fc1f11f20afb898f10e311df7d1e111d078b2795c86a2bc58de49d681503917
|
|
296
|
+
yeptris (0.6.62.1-x86_64-linux-musl) sha256=67753c14a6e4c0efd40c9b08b2a3ca4199027761f6d704b6cfb27bea758f98b5
|
|
297
|
+
|
|
210
298
|
BUNDLED WITH
|
|
211
|
-
|
|
299
|
+
4.0.24
|
data/README.adoc
CHANGED
|
@@ -35,6 +35,13 @@ SvgConform is distributed as a Ruby gem.
|
|
|
35
35
|
* **Generic namespace handling**: Configuration-driven foreign namespace validation
|
|
36
36
|
* **Text-as-path detection**: Warns when text is rendered as outlined path glyphs (quality check)
|
|
37
37
|
|
|
38
|
+
Profiles are consumer policy: the bundled profiles under `config/profiles/`
|
|
39
|
+
(including `metanorma-sample.yml`, a testing reference for the Metanorma
|
|
40
|
+
requirements) are samples, and the operative profile for a consumer lives
|
|
41
|
+
with that consumer — metanorma-standoc ships and loads its own instance by
|
|
42
|
+
path. Canonical diagnostics rendering rides the link:https://github.com/claricle/lens_core[lens_core]
|
|
43
|
+
gem, a declared runtime dependency.
|
|
44
|
+
|
|
38
45
|
|
|
39
46
|
== Concepts
|
|
40
47
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name: "metanorma"
|
|
1
|
+
name: "metanorma-sample"
|
|
2
2
|
description: "Metanorma SVG Profile - SVG requirements for Metanorma technical documents with embedded resources"
|
|
3
3
|
|
|
4
4
|
requirements:
|
|
@@ -64,7 +64,7 @@ requirements:
|
|
|
64
64
|
attributes: ["x", "y", "rotate", "id", "role", "fill", "style", "transform", "font-size", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "font-stretch", "writing-mode", "text-decoration", "clip-path", "mask", "textLength", "lengthAdjust"]
|
|
65
65
|
allowed_children: ["desc", "title", "tspan", "text", "a"]
|
|
66
66
|
- tag: "g"
|
|
67
|
-
attributes: ["label", "class", "id", "role", "fill", "style", "transform", "fill-rule", "visibility", "base", "lang", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "data-name", "clip-path", "mask"]
|
|
67
|
+
attributes: ["label", "class", "id", "role", "fill", "style", "transform", "fill-rule", "visibility", "base", "lang", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "data-name", "clip-path", "clip-rule", "mask", "opacity"]
|
|
68
68
|
allowed_children: ["title", "path", "rect", "circle", "line", "ellipse", "polyline", "polygon", "solidColor", "textArea", "text", "g", "defs", "use", "a", "tspan", "desc", "image"]
|
|
69
69
|
- tag: "defs"
|
|
70
70
|
attributes: ["id", "role", "fill", "fill-rule", "base", "lang", "class", "rel", "rev", "typeof", "content", "datatype", "resource", "about", "property", "space", "clip-path", "mask"]
|
data/docs/api_reference.adoc
CHANGED
|
@@ -25,7 +25,7 @@ require 'svg_conform'
|
|
|
25
25
|
|
|
26
26
|
# Validate an SVG file
|
|
27
27
|
validator = SvgConform::Validator.new
|
|
28
|
-
result = validator.validate_file('image.svg', profile: :metanorma)
|
|
28
|
+
result = validator.validate_file('image.svg', profile: :"metanorma-sample")
|
|
29
29
|
|
|
30
30
|
if result.valid?
|
|
31
31
|
puts "✓ SVG is valid"
|
|
@@ -90,15 +90,15 @@ Validate SVG content or document object.
|
|
|
90
90
|
[source,ruby]
|
|
91
91
|
----
|
|
92
92
|
# String input
|
|
93
|
-
result = validator.validate(svg_string, profile: :metanorma)
|
|
93
|
+
result = validator.validate(svg_string, profile: :"metanorma-sample")
|
|
94
94
|
|
|
95
95
|
# Nokogiri element (common in Metanorma integration)
|
|
96
96
|
nokogiri_element = Nokogiri::XML(svg_string).root
|
|
97
|
-
result = validator.validate(nokogiri_element, profile: :metanorma)
|
|
97
|
+
result = validator.validate(nokogiri_element, profile: :"metanorma-sample")
|
|
98
98
|
|
|
99
99
|
# Moxml document
|
|
100
100
|
moxml_doc = Moxml.new.parse(svg_string)
|
|
101
|
-
result = validator.validate(moxml_doc, profile: :metanorma)
|
|
101
|
+
result = validator.validate(moxml_doc, profile: :"metanorma-sample")
|
|
102
102
|
----
|
|
103
103
|
|
|
104
104
|
===== validate_file(file_path, profile:, **options)
|
|
@@ -139,7 +139,7 @@ Validate multiple files.
|
|
|
139
139
|
[source,ruby]
|
|
140
140
|
----
|
|
141
141
|
files = ['image1.svg', 'image2.svg', 'image3.svg']
|
|
142
|
-
results = validator.validate_files(files, profile: :metanorma)
|
|
142
|
+
results = validator.validate_files(files, profile: :"metanorma-sample")
|
|
143
143
|
|
|
144
144
|
results.each do |file, result|
|
|
145
145
|
puts "#{file}: #{result.valid? ? '✓' : '✗'}"
|
|
@@ -157,7 +157,7 @@ Get list of available profiles.
|
|
|
157
157
|
[source,ruby]
|
|
158
158
|
----
|
|
159
159
|
profiles = validator.available_profiles
|
|
160
|
-
# => [:base, :svg_1_2_rfc, :metanorma, :lucid, ...]
|
|
160
|
+
# => [:base, :svg_1_2_rfc, :"metanorma-sample", :lucid, ...]
|
|
161
161
|
----
|
|
162
162
|
|
|
163
163
|
=== SvgConform::Profile
|
|
@@ -215,7 +215,7 @@ Validate a document against this profile.
|
|
|
215
215
|
|
|
216
216
|
[source,ruby]
|
|
217
217
|
----
|
|
218
|
-
profile = SvgConform::Profiles.get(:metanorma)
|
|
218
|
+
profile = SvgConform::Profiles.get(:"metanorma-sample")
|
|
219
219
|
document = SvgConform::Document.from_file('image.svg')
|
|
220
220
|
result = profile.validate(document)
|
|
221
221
|
----
|
|
@@ -234,7 +234,7 @@ Apply all remediations defined in the profile.
|
|
|
234
234
|
|
|
235
235
|
[source,ruby]
|
|
236
236
|
----
|
|
237
|
-
profile = SvgConform::Profiles.get(:metanorma)
|
|
237
|
+
profile = SvgConform::Profiles.get(:"metanorma-sample")
|
|
238
238
|
document = SvgConform::Document.from_file('image.svg')
|
|
239
239
|
|
|
240
240
|
changes = profile.apply_remediations(document)
|
|
@@ -448,7 +448,7 @@ Convert result to JSON string.
|
|
|
448
448
|
|
|
449
449
|
[source,ruby]
|
|
450
450
|
----
|
|
451
|
-
result = validator.validate(svg_content, profile: :metanorma)
|
|
451
|
+
result = validator.validate(svg_content, profile: :"metanorma-sample")
|
|
452
452
|
|
|
453
453
|
puts "Valid: #{result.valid?}"
|
|
454
454
|
puts "Errors: #{result.error_count}"
|
|
@@ -648,7 +648,7 @@ Get remediations from the profile.
|
|
|
648
648
|
|
|
649
649
|
[source,ruby]
|
|
650
650
|
----
|
|
651
|
-
profile = SvgConform::Profiles.get(:metanorma)
|
|
651
|
+
profile = SvgConform::Profiles.get(:"metanorma-sample")
|
|
652
652
|
runner = SvgConform::RemediationRunner.new(profile: profile)
|
|
653
653
|
|
|
654
654
|
result = runner.run_remediation_file('input.svg')
|
|
@@ -740,7 +740,7 @@ Get a profile by name.
|
|
|
740
740
|
|
|
741
741
|
[source,ruby]
|
|
742
742
|
----
|
|
743
|
-
profile = SvgConform::Profiles.get(:metanorma)
|
|
743
|
+
profile = SvgConform::Profiles.get(:"metanorma-sample")
|
|
744
744
|
profile = SvgConform::Profiles.get('svg_1_2_rfc')
|
|
745
745
|
----
|
|
746
746
|
|
|
@@ -755,7 +755,7 @@ Get list of available profile names.
|
|
|
755
755
|
[source,ruby]
|
|
756
756
|
----
|
|
757
757
|
profiles = SvgConform::Profiles.available_profiles
|
|
758
|
-
# => [:base, :svg_1_2_rfc, :metanorma, ...]
|
|
758
|
+
# => [:base, :svg_1_2_rfc, :"metanorma-sample", ...]
|
|
759
759
|
|
|
760
760
|
profiles.each do |name|
|
|
761
761
|
profile = SvgConform::Profiles.get(name)
|
|
@@ -778,7 +778,7 @@ end
|
|
|
778
778
|
| `:svg_1_2_rfc_with_rdf`
|
|
779
779
|
| RFC 7996 with RDF/Dublin Core metadata support
|
|
780
780
|
|
|
781
|
-
| `:metanorma`
|
|
781
|
+
| `:"metanorma-sample"`
|
|
782
782
|
| Metanorma document generation requirements
|
|
783
783
|
|
|
784
784
|
| `:lucid`
|
|
@@ -1004,7 +1004,7 @@ Convert to hash.
|
|
|
1004
1004
|
|
|
1005
1005
|
[source,ruby]
|
|
1006
1006
|
----
|
|
1007
|
-
result = validator.validate(svg_content, profile: :metanorma)
|
|
1007
|
+
result = validator.validate(svg_content, profile: :"metanorma-sample")
|
|
1008
1008
|
manifest = result.reference_manifest
|
|
1009
1009
|
|
|
1010
1010
|
puts "IDs defined: #{manifest.available_ids.size}"
|
|
@@ -1121,7 +1121,7 @@ errors = []
|
|
|
1121
1121
|
|
|
1122
1122
|
Dir.glob('images/**/*.svg') do |file|
|
|
1123
1123
|
begin
|
|
1124
|
-
result = validator.validate_file(file, profile: :metanorma)
|
|
1124
|
+
result = validator.validate_file(file, profile: :"metanorma-sample")
|
|
1125
1125
|
results[file] = result
|
|
1126
1126
|
|
|
1127
1127
|
unless result.valid?
|
|
@@ -1154,7 +1154,7 @@ end
|
|
|
1154
1154
|
|
|
1155
1155
|
[source,ruby]
|
|
1156
1156
|
----
|
|
1157
|
-
profile = SvgConform::Profiles.get(:metanorma)
|
|
1157
|
+
profile = SvgConform::Profiles.get(:"metanorma-sample")
|
|
1158
1158
|
runner = SvgConform::RemediationRunner.new(profile: profile)
|
|
1159
1159
|
|
|
1160
1160
|
Dir.glob('input/**/*.svg').each do |input_file|
|
|
@@ -1179,7 +1179,7 @@ end
|
|
|
1179
1179
|
|
|
1180
1180
|
[source,ruby]
|
|
1181
1181
|
----
|
|
1182
|
-
result = validator.validate(svg_content, profile: :metanorma)
|
|
1182
|
+
result = validator.validate(svg_content, profile: :"metanorma-sample")
|
|
1183
1183
|
manifest = result.reference_manifest
|
|
1184
1184
|
|
|
1185
1185
|
# Export manifest
|
|
@@ -1214,13 +1214,13 @@ end
|
|
|
1214
1214
|
class SVGProcessor
|
|
1215
1215
|
def initialize
|
|
1216
1216
|
@validator = SvgConform::Validator.new
|
|
1217
|
-
@profile = SvgConform::Profiles.get(:metanorma)
|
|
1217
|
+
@profile = SvgConform::Profiles.get(:"metanorma-sample")
|
|
1218
1218
|
@runner = SvgConform::RemediationRunner.new(profile: @profile)
|
|
1219
1219
|
end
|
|
1220
1220
|
|
|
1221
1221
|
def process_svg_element(nokogiri_element)
|
|
1222
1222
|
# Validate without serializing by user
|
|
1223
|
-
result = @validator.validate(nokogiri_element, profile: :metanorma)
|
|
1223
|
+
result = @validator.validate(nokogiri_element, profile: :"metanorma-sample")
|
|
1224
1224
|
|
|
1225
1225
|
if result.valid?
|
|
1226
1226
|
return { status: :valid, element: nokogiri_element }
|
|
@@ -1259,7 +1259,7 @@ Raised when validation fails due to invalid input.
|
|
|
1259
1259
|
[source,ruby]
|
|
1260
1260
|
----
|
|
1261
1261
|
begin
|
|
1262
|
-
result = validator.validate_file('missing.svg', profile: :metanorma)
|
|
1262
|
+
result = validator.validate_file('missing.svg', profile: :"metanorma-sample")
|
|
1263
1263
|
rescue SvgConform::ValidationError => e
|
|
1264
1264
|
puts "Validation error: #{e.message}"
|
|
1265
1265
|
end
|
|
@@ -1342,7 +1342,7 @@ validator = SvgConform::Validator.new(mode: :dom)
|
|
|
1342
1342
|
----
|
|
1343
1343
|
# Efficient batch processing
|
|
1344
1344
|
validator = SvgConform::Validator.new(mode: :sax)
|
|
1345
|
-
profile = SvgConform::Profiles.get(:metanorma) # Cache profile
|
|
1345
|
+
profile = SvgConform::Profiles.get(:"metanorma-sample") # Cache profile
|
|
1346
1346
|
|
|
1347
1347
|
files.each do |file|
|
|
1348
1348
|
result = validator.validate_file(file, profile: profile)
|
data/docs/cli_guide.adoc
CHANGED
|
@@ -60,7 +60,7 @@ The `check` command validates SVG files against a profile and optionally applies
|
|
|
60
60
|
|
|
61
61
|
[source,bash]
|
|
62
62
|
----
|
|
63
|
-
$ svg_conform check file.svg --profile=metanorma
|
|
63
|
+
$ svg_conform check file.svg --profile=metanorma-sample
|
|
64
64
|
----
|
|
65
65
|
|
|
66
66
|
Output example:
|
|
@@ -70,7 +70,7 @@ Output example:
|
|
|
70
70
|
SVG Validation Report
|
|
71
71
|
==================================================
|
|
72
72
|
File: file.svg
|
|
73
|
-
Profile: metanorma
|
|
73
|
+
Profile: metanorma-sample
|
|
74
74
|
Valid: ✗
|
|
75
75
|
Total Errors: 2
|
|
76
76
|
|
|
@@ -88,7 +88,7 @@ Validation Errors:
|
|
|
88
88
|
|
|
89
89
|
[source,bash]
|
|
90
90
|
----
|
|
91
|
-
$ svg_conform check file1.svg file2.svg file3.svg -p metanorma
|
|
91
|
+
$ svg_conform check file1.svg file2.svg file3.svg -p metanorma-sample
|
|
92
92
|
----
|
|
93
93
|
|
|
94
94
|
==== Directory validation
|
|
@@ -97,7 +97,7 @@ Recursively validate all SVG files in a directory:
|
|
|
97
97
|
|
|
98
98
|
[source,bash]
|
|
99
99
|
----
|
|
100
|
-
$ svg_conform check --directory=images/ --profile=metanorma
|
|
100
|
+
$ svg_conform check --directory=images/ --profile=metanorma-sample
|
|
101
101
|
----
|
|
102
102
|
|
|
103
103
|
Output shows a summary table and statistics.
|
|
@@ -157,13 +157,13 @@ Examples:
|
|
|
157
157
|
[source,bash]
|
|
158
158
|
----
|
|
159
159
|
# JSON output to stdout
|
|
160
|
-
$ svg_conform check file.svg -p metanorma --format=json
|
|
160
|
+
$ svg_conform check file.svg -p metanorma-sample --format=json
|
|
161
161
|
|
|
162
162
|
# JSON output to file
|
|
163
|
-
$ svg_conform check file.svg -p metanorma --format=json -o report.json
|
|
163
|
+
$ svg_conform check file.svg -p metanorma-sample --format=json -o report.json
|
|
164
164
|
|
|
165
165
|
# YAML output to file
|
|
166
|
-
$ svg_conform check file.svg -p metanorma --format=yaml -o report.yaml
|
|
166
|
+
$ svg_conform check file.svg -p metanorma-sample --format=yaml -o report.yaml
|
|
167
167
|
----
|
|
168
168
|
|
|
169
169
|
==== Remediation options
|
|
@@ -194,13 +194,13 @@ Examples:
|
|
|
194
194
|
[source,bash]
|
|
195
195
|
----
|
|
196
196
|
# Single file with custom output
|
|
197
|
-
$ svg_conform check file.svg -p metanorma --fix --fix-output=cleaned.svg
|
|
197
|
+
$ svg_conform check file.svg -p metanorma-sample --fix --fix-output=cleaned.svg
|
|
198
198
|
|
|
199
199
|
# Multiple files to output directory
|
|
200
|
-
$ svg_conform check *.svg -p metanorma --fix --output-dir=fixed/
|
|
200
|
+
$ svg_conform check *.svg -p metanorma-sample --fix --output-dir=fixed/
|
|
201
201
|
|
|
202
202
|
# Directory with in-place replacement (destructive!)
|
|
203
|
-
$ svg_conform check -d images/ -p metanorma --fix --in-place --force
|
|
203
|
+
$ svg_conform check -d images/ -p metanorma-sample --fix --in-place --force
|
|
204
204
|
----
|
|
205
205
|
|
|
206
206
|
==== Batch processing options
|
|
@@ -229,14 +229,14 @@ Examples:
|
|
|
229
229
|
[source,bash]
|
|
230
230
|
----
|
|
231
231
|
# Quiet mode - summary only
|
|
232
|
-
$ svg_conform check -d images/ -p metanorma -q
|
|
232
|
+
$ svg_conform check -d images/ -p metanorma-sample -q
|
|
233
233
|
|
|
234
234
|
# Generate detailed JSON report
|
|
235
|
-
$ svg_conform check -d images/ -p metanorma \
|
|
235
|
+
$ svg_conform check -d images/ -p metanorma-sample \
|
|
236
236
|
--report-format=json --report-output=full-report.json
|
|
237
237
|
|
|
238
238
|
# Full workflow with manifest
|
|
239
|
-
$ svg_conform check -d images/ -p metanorma --fix --output-dir=fixed/ \
|
|
239
|
+
$ svg_conform check -d images/ -p metanorma-sample --fix --output-dir=fixed/ \
|
|
240
240
|
--manifest=file-mapping.json --report-format=json --report-output=report.json
|
|
241
241
|
----
|
|
242
242
|
|
|
@@ -248,7 +248,7 @@ Process one SVG file:
|
|
|
248
248
|
|
|
249
249
|
[source,bash]
|
|
250
250
|
----
|
|
251
|
-
$ svg_conform check file.svg -p metanorma
|
|
251
|
+
$ svg_conform check file.svg -p metanorma-sample
|
|
252
252
|
----
|
|
253
253
|
|
|
254
254
|
Features:
|
|
@@ -264,7 +264,7 @@ Process multiple specified files:
|
|
|
264
264
|
|
|
265
265
|
[source,bash]
|
|
266
266
|
----
|
|
267
|
-
$ svg_conform check file1.svg file2.svg file3.svg -p metanorma
|
|
267
|
+
$ svg_conform check file1.svg file2.svg file3.svg -p metanorma-sample
|
|
268
268
|
----
|
|
269
269
|
|
|
270
270
|
Features:
|
|
@@ -279,7 +279,7 @@ Recursively process all SVG files in a directory:
|
|
|
279
279
|
|
|
280
280
|
[source,bash]
|
|
281
281
|
----
|
|
282
|
-
$ svg_conform check --directory=images/ -p metanorma
|
|
282
|
+
$ svg_conform check --directory=images/ -p metanorma-sample
|
|
283
283
|
----
|
|
284
284
|
|
|
285
285
|
Features:
|
|
@@ -297,7 +297,7 @@ Validate all SVGs before deployment:
|
|
|
297
297
|
|
|
298
298
|
[source,bash]
|
|
299
299
|
----
|
|
300
|
-
$ svg_conform check -d assets/images/ -p metanorma --quiet
|
|
300
|
+
$ svg_conform check -d assets/images/ -p metanorma-sample --quiet
|
|
301
301
|
|
|
302
302
|
# Exit code 0 = all valid
|
|
303
303
|
# Exit code 1 = validation failures
|
|
@@ -308,7 +308,7 @@ Use in CI/CD:
|
|
|
308
308
|
[source,bash]
|
|
309
309
|
----
|
|
310
310
|
#!/bin/bash
|
|
311
|
-
if svg_conform check -d docs/images/ -p metanorma -q; then
|
|
311
|
+
if svg_conform check -d docs/images/ -p metanorma-sample -q; then
|
|
312
312
|
echo "All SVGs valid"
|
|
313
313
|
else
|
|
314
314
|
echo "SVG validation failed"
|
|
@@ -323,10 +323,10 @@ Fix issues with review:
|
|
|
323
323
|
[source,bash]
|
|
324
324
|
----
|
|
325
325
|
# 1. Validate and see issues
|
|
326
|
-
$ svg_conform check file.svg -p metanorma
|
|
326
|
+
$ svg_conform check file.svg -p metanorma-sample
|
|
327
327
|
|
|
328
328
|
# 2. Apply fixes to new file
|
|
329
|
-
$ svg_conform check file.svg -p metanorma --fix --fix-output=file-fixed.svg
|
|
329
|
+
$ svg_conform check file.svg -p metanorma-sample --fix --fix-output=file-fixed.svg
|
|
330
330
|
|
|
331
331
|
# 3. Review the fixed file
|
|
332
332
|
$ diff file.svg file-fixed.svg
|
|
@@ -345,15 +345,15 @@ Fix all non-conforming files in a directory:
|
|
|
345
345
|
$ cp -r images/ images-backup/
|
|
346
346
|
|
|
347
347
|
# 2. Generate pre-fix report
|
|
348
|
-
$ svg_conform check -d images/ -p metanorma \
|
|
348
|
+
$ svg_conform check -d images/ -p metanorma-sample \
|
|
349
349
|
--report-format=json --report-output=before.json
|
|
350
350
|
|
|
351
351
|
# 3. Apply fixes to new directory
|
|
352
|
-
$ svg_conform check -d images/ -p metanorma \
|
|
352
|
+
$ svg_conform check -d images/ -p metanorma-sample \
|
|
353
353
|
--fix --output-dir=images-fixed/ --manifest=manifest.json
|
|
354
354
|
|
|
355
355
|
# 4. Verify fixes
|
|
356
|
-
$ svg_conform check -d images-fixed/ -p metanorma -q
|
|
356
|
+
$ svg_conform check -d images-fixed/ -p metanorma-sample -q
|
|
357
357
|
|
|
358
358
|
# 5. If satisfied, replace originals
|
|
359
359
|
$ rm -rf images/
|
|
@@ -370,10 +370,10 @@ Fix files in place (destructive):
|
|
|
370
370
|
$ cp -r images/ images-backup/
|
|
371
371
|
|
|
372
372
|
# Fix all files in place
|
|
373
|
-
$ svg_conform check -d images/ -p metanorma --fix --in-place --force
|
|
373
|
+
$ svg_conform check -d images/ -p metanorma-sample --fix --in-place --force
|
|
374
374
|
|
|
375
375
|
# Verify
|
|
376
|
-
$ svg_conform check -d images/ -p metanorma -q
|
|
376
|
+
$ svg_conform check -d images/ -p metanorma-sample -q
|
|
377
377
|
----
|
|
378
378
|
|
|
379
379
|
==== Workflow 5: Selective remediation
|
|
@@ -383,12 +383,12 @@ Fix only specific files:
|
|
|
383
383
|
[source,bash]
|
|
384
384
|
----
|
|
385
385
|
# Find invalid files
|
|
386
|
-
$ svg_conform check -d images/ -p metanorma -q > results.txt
|
|
386
|
+
$ svg_conform check -d images/ -p metanorma-sample -q > results.txt
|
|
387
387
|
|
|
388
388
|
# Manually identify problematic files
|
|
389
389
|
# Then fix them individually
|
|
390
|
-
$ svg_conform check images/problematic1.svg -p metanorma -f
|
|
391
|
-
$ svg_conform check images/problematic2.svg -p metanorma -f
|
|
390
|
+
$ svg_conform check images/problematic1.svg -p metanorma-sample -f
|
|
391
|
+
$ svg_conform check images/problematic2.svg -p metanorma-sample -f
|
|
392
392
|
----
|
|
393
393
|
|
|
394
394
|
=== Exit codes
|
|
@@ -403,7 +403,7 @@ Use exit codes in scripts:
|
|
|
403
403
|
|
|
404
404
|
[source,bash]
|
|
405
405
|
----
|
|
406
|
-
if svg_conform check file.svg -p metanorma; then
|
|
406
|
+
if svg_conform check file.svg -p metanorma-sample; then
|
|
407
407
|
echo "Valid!"
|
|
408
408
|
else
|
|
409
409
|
echo "Invalid - see errors above"
|
|
@@ -443,7 +443,7 @@ xref:diagnostics.adoc[Diagnostics]). No timestamp is emitted by the CLI.
|
|
|
443
443
|
{
|
|
444
444
|
"schema_version": 1,
|
|
445
445
|
"producer": { "name": "svg_conform", "version": "0.2.4" },
|
|
446
|
-
"profile": { "id": "metanorma", "citations": [] },
|
|
446
|
+
"profile": { "id": "metanorma-sample", "citations": [] },
|
|
447
447
|
"valid": false,
|
|
448
448
|
"summary": { "errors": 1, "warnings": 0, "infos": 1 },
|
|
449
449
|
"diagnostics": [ ... ],
|
|
@@ -465,7 +465,7 @@ For multiple files or directories:
|
|
|
465
465
|
BATCH VALIDATION SUMMARY
|
|
466
466
|
================================================================================
|
|
467
467
|
Directory: images/
|
|
468
|
-
Profile: metanorma
|
|
468
|
+
Profile: metanorma-sample
|
|
469
469
|
Files processed: 15
|
|
470
470
|
Valid before: 8
|
|
471
471
|
Remediated: 5
|
|
@@ -527,7 +527,7 @@ Example output:
|
|
|
527
527
|
Detailed SVG Validation Profiles
|
|
528
528
|
==================================================
|
|
529
529
|
|
|
530
|
-
Profile: metanorma
|
|
530
|
+
Profile: metanorma-sample
|
|
531
531
|
------------------------------
|
|
532
532
|
Description: Metanorma document requirements
|
|
533
533
|
Requirements: 12
|
|
@@ -587,7 +587,7 @@ $ svg_conform check --directory=/absolute/path/to/images/
|
|
|
587
587
|
[source,bash]
|
|
588
588
|
----
|
|
589
589
|
# Specify output directory
|
|
590
|
-
$ svg_conform check *.svg -p metanorma --fix --output-dir=fixed/
|
|
590
|
+
$ svg_conform check *.svg -p metanorma-sample --fix --output-dir=fixed/
|
|
591
591
|
----
|
|
592
592
|
|
|
593
593
|
==== "--in-place requires --force"
|
|
@@ -599,7 +599,7 @@ $ svg_conform check *.svg -p metanorma --fix --output-dir=fixed/
|
|
|
599
599
|
[source,bash]
|
|
600
600
|
----
|
|
601
601
|
# Add --force flag
|
|
602
|
-
$ svg_conform check -d images/ -p metanorma --fix --in-place --force
|
|
602
|
+
$ svg_conform check -d images/ -p metanorma-sample --fix --in-place --force
|
|
603
603
|
----
|
|
604
604
|
|
|
605
605
|
==== "Profile not found"
|
|
@@ -614,7 +614,7 @@ $ svg_conform check -d images/ -p metanorma --fix --in-place --force
|
|
|
614
614
|
$ svg_conform profiles
|
|
615
615
|
|
|
616
616
|
# Use correct profile name
|
|
617
|
-
$ svg_conform check file.svg -p metanorma
|
|
617
|
+
$ svg_conform check file.svg -p metanorma-sample
|
|
618
618
|
----
|
|
619
619
|
|
|
620
620
|
==== Exit code 1 with valid files
|
|
@@ -636,11 +636,11 @@ For directories with many files:
|
|
|
636
636
|
[source,bash]
|
|
637
637
|
----
|
|
638
638
|
# Use quiet mode
|
|
639
|
-
$ svg_conform check -d large-dir/ -p metanorma -q
|
|
639
|
+
$ svg_conform check -d large-dir/ -p metanorma-sample -q
|
|
640
640
|
|
|
641
641
|
# Process in batches
|
|
642
642
|
$ find images/ -name "*.svg" -print0 | \
|
|
643
|
-
xargs -0 -n 50 svg_conform check -p metanorma
|
|
643
|
+
xargs -0 -n 50 svg_conform check -p metanorma-sample
|
|
644
644
|
----
|
|
645
645
|
|
|
646
646
|
==== Large SVG files
|
|
@@ -718,7 +718,7 @@ changed_svgs=$(git diff --cached --name-only --diff-filter=ACM | grep '\.svg$')
|
|
|
718
718
|
|
|
719
719
|
if [ -n "$changed_svgs" ]; then
|
|
720
720
|
echo "Validating SVG files..."
|
|
721
|
-
echo "$changed_svgs" | xargs svg_conform check -p metanorma -q
|
|
721
|
+
echo "$changed_svgs" | xargs svg_conform check -p metanorma-sample -q
|
|
722
722
|
if [ $? -ne 0 ]; then
|
|
723
723
|
echo "SVG validation failed. Commit aborted."
|
|
724
724
|
exit 1
|
|
@@ -744,7 +744,7 @@ jobs:
|
|
|
744
744
|
with:
|
|
745
745
|
ruby-version: 3.0
|
|
746
746
|
- run: gem install svg_conform
|
|
747
|
-
- run: svg_conform check -d docs/images/ -p metanorma --quiet
|
|
747
|
+
- run: svg_conform check -d docs/images/ -p metanorma-sample --quiet
|
|
748
748
|
----
|
|
749
749
|
|
|
750
750
|
==== Makefile integration
|
|
@@ -756,10 +756,10 @@ jobs:
|
|
|
756
756
|
.PHONY: validate-svg fix-svg
|
|
757
757
|
|
|
758
758
|
validate-svg:
|
|
759
|
-
svg_conform check -d images/ -p metanorma --quiet
|
|
759
|
+
svg_conform check -d images/ -p metanorma-sample --quiet
|
|
760
760
|
|
|
761
761
|
fix-svg:
|
|
762
|
-
svg_conform check -d images/ -p metanorma \
|
|
762
|
+
svg_conform check -d images/ -p metanorma-sample \
|
|
763
763
|
--fix --output-dir=images-fixed/ \
|
|
764
764
|
--manifest=manifest.json
|
|
765
765
|
@echo "Review images-fixed/ before replacing images/"
|
data/docs/profiles.adoc
CHANGED
|
@@ -342,18 +342,24 @@ See link:remediation.adoc#namespace-attribute-remediation[NamespaceAttributeReme
|
|
|
342
342
|
* Maintains valid SVG markup
|
|
343
343
|
|
|
344
344
|
[[metanorma-profile]]
|
|
345
|
-
=== Metanorma profile (`:metanorma`)
|
|
345
|
+
=== Metanorma sample profile (`:"metanorma-sample"`)
|
|
346
346
|
|
|
347
347
|
**Purpose**: Ensures SVG documents comply with Metanorma requirements for technical documents with embedded resources.
|
|
348
348
|
|
|
349
349
|
**Target use case**: Technical diagrams, flowcharts, and illustrations for Metanorma-generated standards documents (ISO, IEC, IETF, etc.).
|
|
350
350
|
|
|
351
|
+
This bundled profile is a sample and testing reference. Profiles are consumer
|
|
352
|
+
policy: the operative Metanorma profile ships and loads by path from
|
|
353
|
+
metanorma-standoc (`lib/metanorma/standoc/svg_conform_profile/metanorma.yml`),
|
|
354
|
+
so the `metanorma` name is not registered here and resolving it fails loudly
|
|
355
|
+
with `ProfileError: Profile not found`.
|
|
356
|
+
|
|
351
357
|
**Key Characteristics**:
|
|
352
358
|
* **Flexible colors**: Any colors allowed (unlike RFC 7996 black/white restriction)
|
|
353
359
|
* **Flexible fonts**: Any font families allowed (unlike RFC 7996 generic-only restriction)
|
|
354
360
|
* **Flexible styles**: Any CSS styles allowed
|
|
355
361
|
* **Event handlers allowed**: Supports event attributes (`on*`) for interactivity
|
|
356
|
-
* **Clipping and masking**: `clip-path` and `mask` presentation attributes allowed
|
|
362
|
+
* **Clipping and masking**: `clip-path` and `mask` presentation attributes allowed, and `clip-path`, `clip-rule`, and `opacity` allowed on container elements (`g`, `a`, `defs`)
|
|
357
363
|
* **Self-contained resources**: All CSS and fonts must be embedded
|
|
358
364
|
* **Structural compliance**: Proper namespaces and viewBox required
|
|
359
365
|
* **No external dependencies**: External CSS and fonts strictly prohibited
|
|
@@ -42,7 +42,7 @@ The manifest provides complete context:
|
|
|
42
42
|
----
|
|
43
43
|
require 'svg_conform'
|
|
44
44
|
|
|
45
|
-
validator = SvgConform::Validator.new(profile: 'metanorma')
|
|
45
|
+
validator = SvgConform::Validator.new(profile: 'metanorma-sample')
|
|
46
46
|
result = validator.validate(svg_content)
|
|
47
47
|
|
|
48
48
|
# Access the reference manifest
|
|
@@ -296,7 +296,7 @@ puts result_hash[:reference_manifest]
|
|
|
296
296
|
[source,ruby]
|
|
297
297
|
----
|
|
298
298
|
# Validate SVG document
|
|
299
|
-
result = validator.validate(svg_content, profile: 'metanorma')
|
|
299
|
+
result = validator.validate(svg_content, profile: 'metanorma-sample')
|
|
300
300
|
|
|
301
301
|
# Get external references for consumer validation
|
|
302
302
|
external_refs = result.external_references
|
|
@@ -368,4 +368,4 @@ Easy to add new reference types without modifying existing code.
|
|
|
368
368
|
* link:requirements.adoc[Requirements Documentation]
|
|
369
369
|
* link:api_reference.adoc[API Reference]
|
|
370
370
|
* link:../README.adoc[Main README]
|
|
371
|
-
* link:../config/profiles/metanorma.yml[Metanorma Profile Configuration]
|
|
371
|
+
* link:../config/profiles/metanorma-sample.yml[Metanorma Profile Configuration]
|
data/lib/svg_conform/cli.rb
CHANGED
|
@@ -49,10 +49,10 @@ module SvgConform
|
|
|
49
49
|
- yaml: LensCore diagnostics YAML (schema version 1)
|
|
50
50
|
|
|
51
51
|
EXAMPLES:
|
|
52
|
-
svg_conform check file.svg -p metanorma
|
|
53
|
-
svg_conform check *.svg -p metanorma -f --output-dir fixed/
|
|
54
|
-
svg_conform check -d images/ -p metanorma --report-format json --report-output report.json
|
|
55
|
-
svg_conform check -d images/ -p metanorma -f --in-place --force
|
|
52
|
+
svg_conform check file.svg -p metanorma-sample
|
|
53
|
+
svg_conform check *.svg -p metanorma-sample -f --output-dir fixed/
|
|
54
|
+
svg_conform check -d images/ -p metanorma-sample --report-format json --report-output report.json
|
|
55
|
+
svg_conform check -d images/ -p metanorma-sample -f --in-place --force
|
|
56
56
|
DESC
|
|
57
57
|
option :directory, aliases: "-d", type: :string,
|
|
58
58
|
desc: "Directory to scan recursively for SVG files"
|
|
@@ -205,7 +205,12 @@ requirement_id: nil, severity: nil, violation_type: nil)
|
|
|
205
205
|
:font_violation
|
|
206
206
|
when /forbidden|content/
|
|
207
207
|
:content_violation
|
|
208
|
-
|
|
208
|
+
# The bare substring /id/ misclassified any requirement whose id
|
|
209
|
+
# merely contains it ("namespace_val[id]ation", "link_val[id]ation")
|
|
210
|
+
# as :reference_violation — the type consumers drop for the separate
|
|
211
|
+
# reference pass, so their verdicts vanished from downstream logs
|
|
212
|
+
# (#133). Match the id token only as a whole word segment.
|
|
213
|
+
when /reference/, /(^|_)id($|_)/
|
|
209
214
|
:reference_violation
|
|
210
215
|
when /namespace/
|
|
211
216
|
:namespace_violation
|
data/lib/svg_conform/version.rb
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
require "svg_conform/errors/validation_issue"
|
|
4
|
+
|
|
5
|
+
RSpec.describe SvgConform::Errors::ValidationIssue do
|
|
6
|
+
let(:node) { Struct.new(:name, :line, :column).new("g", 1, 1) }
|
|
7
|
+
|
|
8
|
+
def issue_for(requirement_id, message)
|
|
9
|
+
described_class.new(
|
|
10
|
+
type: :error,
|
|
11
|
+
rule: Struct.new(:id).new(requirement_id),
|
|
12
|
+
node: node,
|
|
13
|
+
message: message,
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# metanorma's svg_error drops :reference_violation entries (the separate
|
|
18
|
+
# reference pass covers them); a misclassification here silently deletes
|
|
19
|
+
# profile verdicts from downstream logs (#133).
|
|
20
|
+
it "classifies reference requirements by the whole id token" do
|
|
21
|
+
expect(issue_for("id_references", "broken id reference").violation_type)
|
|
22
|
+
.to eq(:reference_violation)
|
|
23
|
+
expect(issue_for("id_collection", "collected").violation_type)
|
|
24
|
+
.to eq(:reference_violation)
|
|
25
|
+
expect(issue_for("external_references", "external reference").violation_type)
|
|
26
|
+
.to eq(:reference_violation)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "does not misclassify ids that merely contain the substring id" do
|
|
30
|
+
expect(issue_for("namespace_validation", "namespace issue").violation_type)
|
|
31
|
+
.to eq(:namespace_violation)
|
|
32
|
+
expect(issue_for("link_validation", "bad link").violation_type)
|
|
33
|
+
.to eq(:unknown_violation)
|
|
34
|
+
expect(issue_for("allowed_elements", "Attribute 'opacity' is not allowed").violation_type)
|
|
35
|
+
.to eq(:unknown_violation)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "keeps the message-based classification anchored on reference wording" do
|
|
39
|
+
expect(issue_for("unknown_rule", "broken reference to #missing").violation_type)
|
|
40
|
+
.to eq(:reference_violation)
|
|
41
|
+
expect(issue_for("unknown_rule", "broken href target").violation_type)
|
|
42
|
+
.to eq(:reference_violation)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "classifies the other requirement families as before" do
|
|
46
|
+
expect(issue_for("forbidden_content", "Attribute 'fill' is not allowed").violation_type)
|
|
47
|
+
.to eq(:content_violation)
|
|
48
|
+
expect(issue_for("font_embedding", "font not embedded").violation_type)
|
|
49
|
+
.to eq(:font_violation)
|
|
50
|
+
expect(issue_for("viewbox_required", "missing viewBox").violation_type)
|
|
51
|
+
.to eq(:viewbox_violation)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -5,13 +5,16 @@ require "spec_helper"
|
|
|
5
5
|
RSpec.describe "svg_conform.gemspec" do # rubocop:disable RSpec/DescribeClass
|
|
6
6
|
let(:specification) { Gem::Specification.load("svg_conform.gemspec") }
|
|
7
7
|
|
|
8
|
-
it "
|
|
9
|
-
# lens_core is
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
it "declares the published lens_core gem as a runtime dependency" do
|
|
9
|
+
# lens_core 0.1.0 is on rubygems, so the 0.2.5-era optionality is
|
|
10
|
+
# obsolete: leaving it undeclared crashed the CLI on strict bundler
|
|
11
|
+
# deployments (rescue LoadError misses Bundler::GemNotFound,
|
|
12
|
+
# claricle/svg_conform#130). The guard in svg_conform.rb stays as a
|
|
13
|
+
# version-compatibility courtesy, not as the dependency mechanism.
|
|
14
|
+
dependency = specification.runtime_dependencies.find { |d| d.name == "lens_core" }
|
|
15
|
+
|
|
16
|
+
expect(dependency).not_to be_nil
|
|
17
|
+
expect(dependency.requirement).to eq(Gem::Requirement.new("~> 0.1"))
|
|
15
18
|
end
|
|
16
19
|
|
|
17
20
|
it "declares yeptris as a runtime dependency" do
|
|
@@ -8,17 +8,17 @@ METANORMA_PROFILE_CONTAINER_TAGS = %w[g a defs].freeze
|
|
|
8
8
|
METANORMA_PROFILE_CLIP_ATTRIBUTES = %w[clip-path mask].freeze
|
|
9
9
|
|
|
10
10
|
RSpec.describe "Metanorma Profile" do
|
|
11
|
-
let(:
|
|
11
|
+
let(:metanorma_sample_profile_path) { "config/profiles/metanorma-sample.yml" }
|
|
12
12
|
|
|
13
13
|
describe "profile loading" do
|
|
14
14
|
it "loads the Metanorma profile successfully" do
|
|
15
|
-
profile = SvgConform::Profile.load_from_file(
|
|
15
|
+
profile = SvgConform::Profile.load_from_file(metanorma_sample_profile_path)
|
|
16
16
|
expect(profile).not_to be_nil
|
|
17
|
-
expect(profile.name).to eq("metanorma")
|
|
17
|
+
expect(profile.name).to eq("metanorma-sample")
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it "includes external resource requirements" do
|
|
21
|
-
profile = SvgConform::Profile.load_from_file(
|
|
21
|
+
profile = SvgConform::Profile.load_from_file(metanorma_sample_profile_path)
|
|
22
22
|
requirement_ids = profile.requirements.map(&:id)
|
|
23
23
|
expect(requirement_ids).to include("no_external_css")
|
|
24
24
|
expect(requirement_ids).to include("no_external_fonts")
|
|
@@ -26,7 +26,7 @@ RSpec.describe "Metanorma Profile" do
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it "includes comprehensive element support" do
|
|
29
|
-
profile = SvgConform::Profile.load_from_file(
|
|
29
|
+
profile = SvgConform::Profile.load_from_file(metanorma_sample_profile_path)
|
|
30
30
|
requirement_ids = profile.requirements.map(&:id)
|
|
31
31
|
expect(requirement_ids).to include("allowed_elements")
|
|
32
32
|
end
|
|
@@ -41,7 +41,7 @@ RSpec.describe "Metanorma Profile" do
|
|
|
41
41
|
SVG
|
|
42
42
|
|
|
43
43
|
document = SvgConform::Document.from_content(svg_with_colors)
|
|
44
|
-
profile = SvgConform::Profile.load_from_file(
|
|
44
|
+
profile = SvgConform::Profile.load_from_file(metanorma_sample_profile_path)
|
|
45
45
|
|
|
46
46
|
result = profile.validate(document)
|
|
47
47
|
color_errors = result.errors.select do |e|
|
|
@@ -58,7 +58,7 @@ RSpec.describe "Metanorma Profile" do
|
|
|
58
58
|
SVG
|
|
59
59
|
|
|
60
60
|
document = SvgConform::Document.from_content(svg_with_image)
|
|
61
|
-
profile = SvgConform::Profile.load_from_file(
|
|
61
|
+
profile = SvgConform::Profile.load_from_file(metanorma_sample_profile_path)
|
|
62
62
|
|
|
63
63
|
result = profile.validate(document)
|
|
64
64
|
expect(result).to respond_to(:valid?)
|
|
@@ -69,7 +69,7 @@ RSpec.describe "Metanorma Profile" do
|
|
|
69
69
|
# SVG applies the clip-path and mask properties to container elements and
|
|
70
70
|
# graphics elements alike; rejecting them on containers rejects
|
|
71
71
|
# schema-valid documents (metanorma-pdfa#106).
|
|
72
|
-
let(:profile) { SvgConform::Profile.load_from_file(
|
|
72
|
+
let(:profile) { SvgConform::Profile.load_from_file(metanorma_sample_profile_path) }
|
|
73
73
|
let(:validator) { SvgConform::Validator.new(mode: :sax) }
|
|
74
74
|
|
|
75
75
|
def svg_with_clip_assets(inner)
|
|
@@ -5,7 +5,7 @@ require "nokogiri"
|
|
|
5
5
|
|
|
6
6
|
RSpec.describe SvgConform::Profiles do
|
|
7
7
|
let(:validator) { SvgConform::Validator.new(mode: :sax) }
|
|
8
|
-
let(:profile) { described_class.get(:metanorma) }
|
|
8
|
+
let(:profile) { described_class.get(:"metanorma-sample") }
|
|
9
9
|
let(:plantuml_attributes) { %w[contentstyletype zoomandpan title textlength lengthadjust] }
|
|
10
10
|
let(:svg) do
|
|
11
11
|
<<~SVG
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
5
|
RSpec.describe "Reference Manifest Integration" do
|
|
6
|
-
let(:validator) { SvgConform::Validator.new(profile: "metanorma") }
|
|
6
|
+
let(:validator) { SvgConform::Validator.new(profile: "metanorma-sample") }
|
|
7
7
|
|
|
8
8
|
describe "complete reference manifest generation" do
|
|
9
9
|
let(:svg_content) do
|
|
@@ -30,7 +30,7 @@ RSpec.describe "IdReferenceRequirement" do
|
|
|
30
30
|
|
|
31
31
|
it "does not leak state from first validation to second validation" do
|
|
32
32
|
# First validation: SVG with reference error
|
|
33
|
-
result1 = validator.validate(svg_with_error, profile: :metanorma)
|
|
33
|
+
result1 = validator.validate(svg_with_error, profile: :"metanorma-sample")
|
|
34
34
|
|
|
35
35
|
# Verify first validation caught the error
|
|
36
36
|
expect(result1.errors.map(&:message)).to include(
|
|
@@ -38,7 +38,7 @@ RSpec.describe "IdReferenceRequirement" do
|
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
# Second validation: SVG without reference errors
|
|
41
|
-
result2 = validator.validate(svg_without_error, profile: :metanorma)
|
|
41
|
+
result2 = validator.validate(svg_without_error, profile: :"metanorma-sample")
|
|
42
42
|
|
|
43
43
|
# Verify second validation does NOT report errors from first validation
|
|
44
44
|
error_messages = result2.errors.map(&:message).join("\n")
|
|
@@ -59,8 +59,8 @@ RSpec.describe "IdReferenceRequirement" do
|
|
|
59
59
|
|
|
60
60
|
# Alternate between error and no-error SVGs
|
|
61
61
|
3.times do
|
|
62
|
-
results << validator.validate(svg_with_error, profile: :metanorma)
|
|
63
|
-
results << validator.validate(svg_without_error, profile: :metanorma)
|
|
62
|
+
results << validator.validate(svg_with_error, profile: :"metanorma-sample")
|
|
63
|
+
results << validator.validate(svg_without_error, profile: :"metanorma-sample")
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
# Check that error pattern is consistent
|
|
@@ -80,7 +80,7 @@ RSpec.describe "IdReferenceRequirement" do
|
|
|
80
80
|
|
|
81
81
|
it "resets state when using the same profile instance" do
|
|
82
82
|
# Get profile instance
|
|
83
|
-
profile = SvgConform::Profiles.get(:metanorma)
|
|
83
|
+
profile = SvgConform::Profiles.get(:"metanorma-sample")
|
|
84
84
|
|
|
85
85
|
# Run two validations using the same profile
|
|
86
86
|
validator.validate(svg_with_error, profile: profile)
|
|
@@ -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.8
|
|
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
|