svg_conform 0.1.7 → 0.1.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.
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.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
@@ -105,6 +105,7 @@ files:
105
105
  - docs/reference_manifest.adoc
106
106
  - docs/remediation.adoc
107
107
  - docs/requirements.adoc
108
+ - docs/sax_validation_mode.adoc
108
109
  - examples/demo.rb
109
110
  - examples/document_input_demo.rb
110
111
  - examples/readme_usage.rb
@@ -133,7 +134,11 @@ files:
133
134
  - lib/svg_conform/constants.rb
134
135
  - lib/svg_conform/css_color.rb
135
136
  - lib/svg_conform/document.rb
137
+ - lib/svg_conform/document_analyzer.rb
136
138
  - lib/svg_conform/element_proxy.rb
139
+ - lib/svg_conform/errors/base.rb
140
+ - lib/svg_conform/errors/validation_issue.rb
141
+ - lib/svg_conform/errors/validation_notice.rb
137
142
  - lib/svg_conform/external_checkers.rb
138
143
  - lib/svg_conform/external_checkers/svgcheck.rb
139
144
  - lib/svg_conform/external_checkers/svgcheck/compatibility_engine.rb
@@ -142,8 +147,8 @@ files:
142
147
  - lib/svg_conform/external_checkers/svgcheck/report_comparator.rb
143
148
  - lib/svg_conform/external_checkers/svgcheck/report_generator.rb
144
149
  - lib/svg_conform/external_checkers/svgcheck/validation_pipeline.rb
145
- - lib/svg_conform/fast_document_analyzer.rb
146
150
  - lib/svg_conform/fixer.rb
151
+ - lib/svg_conform/interfaces/requirement_interface.rb
147
152
  - lib/svg_conform/node_helpers.rb
148
153
  - lib/svg_conform/node_index_builder.rb
149
154
  - lib/svg_conform/profile.rb
@@ -191,7 +196,11 @@ files:
191
196
  - lib/svg_conform/sax_document.rb
192
197
  - lib/svg_conform/sax_validation_handler.rb
193
198
  - lib/svg_conform/semantic_comparator.rb
199
+ - lib/svg_conform/validation/error_tracker.rb
200
+ - lib/svg_conform/validation/node_id_manager.rb
201
+ - lib/svg_conform/validation/structural_invalidity_tracker.rb
194
202
  - lib/svg_conform/validation_context.rb
203
+ - lib/svg_conform/validation_issue.rb
195
204
  - lib/svg_conform/validation_result.rb
196
205
  - lib/svg_conform/validator.rb
197
206
  - lib/svg_conform/version.rb
@@ -1,82 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SvgConform
4
- # Fast document analyzer that pre-computes node relationships and IDs
5
- # in a single pass to avoid repeated expensive traversals
6
- #
7
- # IMPORTANT: Stores paths indexed by the path itself (not object_id)
8
- # since node object_ids change between traversals
9
- class FastDocumentAnalyzer
10
- attr_reader :path_cache
11
-
12
- def initialize(document)
13
- @document = document
14
- @path_cache = {}
15
-
16
- analyze_document
17
- end
18
-
19
- # Get cached path-based ID for a node by computing its path once
20
- def get_node_id(node)
21
- return nil unless node.respond_to?(:name) && node.name
22
-
23
- # Compute path for this node (fast with forward traversal counting)
24
- compute_path_forward(node)
25
- end
26
-
27
- private
28
-
29
- def analyze_document
30
- # Pre-populate cache is not needed since we compute on demand
31
- # The optimization comes from forward-counting siblings instead of backward
32
- end
33
-
34
- def compute_path_forward(node)
35
- path_parts = []
36
- current = node
37
-
38
- while current
39
- if current.respond_to?(:name) && current.name
40
- # Count position among siblings by iterating forward from parent
41
- position = calculate_position_fast(current)
42
- path_parts.unshift("#{current.name}[#{position}]")
43
- end
44
-
45
- break unless current.respond_to?(:parent)
46
-
47
- begin
48
- current = current.parent
49
- rescue NoMethodError
50
- break
51
- end
52
-
53
- break unless current
54
- end
55
-
56
- "/#{path_parts.join('/')}"
57
- end
58
-
59
- def calculate_position_fast(node)
60
- return 1 unless node.respond_to?(:parent)
61
-
62
- parent = begin
63
- node.parent
64
- rescue NoMethodError
65
- nil
66
- end
67
-
68
- return 1 unless parent.respond_to?(:children)
69
-
70
- # Count this node's position among siblings with same name
71
- position = 0
72
- parent.children.each do |child|
73
- next unless child.respond_to?(:name) && child.name == node.name
74
-
75
- position += 1
76
- break if child.equal?(node)
77
- end
78
-
79
- position
80
- end
81
- end
82
- end