metanorma-iso 3.5.2 → 3.5.4
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/lib/metanorma/iso/validate.rb +6 -0
- data/lib/metanorma/iso/validation/rules/section_sequence_rule.rb +3 -1
- data/lib/metanorma/iso/validation/rules/tree_traversal.rb +9 -3
- data/lib/metanorma/iso/validation/rules/unique_id_rule.rb +2 -2
- data/lib/metanorma/iso/validation/shared_state.rb +8 -2
- data/lib/metanorma/iso/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f1dc7166ec0bc4f7cfef9674b44ab2536dc8fcca3945005c6414049de029543
|
|
4
|
+
data.tar.gz: 88a444de3e410a1bfc61427b8c563528c726ac97982d583900fa7ea6c01a5fb5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c07733849883b99aaa801630ff27fcda045fd6c7a512e7faed3f37b73af0a4925c6d92ddc6edef85adad50c34c65ddb32c1c265a96cde3c789e51c5b7782c0a6
|
|
7
|
+
data.tar.gz: 0e4f6bd8b003198fab58d3b3a30c0786b05011f4bb56ba6fb28995091b50f82baabf6f1adb9158ba9de0e6c80c8fd54c8f20c9997a30e230a097759c8a62a8f5
|
|
@@ -332,6 +332,12 @@ module Metanorma
|
|
|
332
332
|
vocab: @vocab, amd: @amd, i18n: @i18n,
|
|
333
333
|
novalid: @novalid, document: @localdir
|
|
334
334
|
)
|
|
335
|
+
# ModelValidator deserializes the full document into a typed model
|
|
336
|
+
# tree — for large documents that tree is gigabytes on top of the
|
|
337
|
+
# converter-phase garbage (asciidoctor tree, macro temporaries).
|
|
338
|
+
# Collect the garbage first so the spike stacks on the live set,
|
|
339
|
+
# not on the high-water mark of earlier phases.
|
|
340
|
+
GC.start
|
|
335
341
|
Metanorma::Iso::Validation::ModelValidator.run(
|
|
336
342
|
doc.to_xml, log: @log, state: state,
|
|
337
343
|
profile: validation_profile
|
|
@@ -68,7 +68,9 @@ module Metanorma
|
|
|
68
68
|
items << SectionItem.new(kind: clause_kind(clause), node: clause) if clause
|
|
69
69
|
clause_idx += 1
|
|
70
70
|
when "terms"
|
|
71
|
-
terms
|
|
71
|
+
# Multiple terms clauses are an Array; the order walk is
|
|
72
|
+
# per-occurrence, so index like the clause branch does.
|
|
73
|
+
terms = Array(sections.terms)[terms_idx]
|
|
72
74
|
items << SectionItem.new(kind: :terms, node: terms) if terms
|
|
73
75
|
terms_idx += 1
|
|
74
76
|
when "definitions"
|
|
@@ -36,7 +36,11 @@ module Metanorma
|
|
|
36
36
|
return enum_for(__method__, root) unless block_given?
|
|
37
37
|
|
|
38
38
|
sections = root&.sections or return
|
|
39
|
-
|
|
39
|
+
# sections.terms is an Array when the document carries multiple
|
|
40
|
+
# terms clauses (vocabulary corpora carry one per concept).
|
|
41
|
+
Array(sections.terms).each do |terms_section|
|
|
42
|
+
visit_terms_section(terms_section) { |term| yield(term) }
|
|
43
|
+
end
|
|
40
44
|
visit_clause_subtree_for_terms(sections.clause) { |t| yield(t) }
|
|
41
45
|
end
|
|
42
46
|
|
|
@@ -68,7 +72,7 @@ module Metanorma
|
|
|
68
72
|
return enum_for(__method__, root) unless block_given?
|
|
69
73
|
|
|
70
74
|
sections = root&.sections or return
|
|
71
|
-
|
|
75
|
+
Array(sections.terms).each { |terms_section| yield(terms_section) }
|
|
72
76
|
visit_clauses_for_terms(sections.clause) { |t| yield(t) }
|
|
73
77
|
end
|
|
74
78
|
|
|
@@ -462,7 +466,9 @@ module Metanorma
|
|
|
462
466
|
|
|
463
467
|
def visit_clauses_for_terms(clauses)
|
|
464
468
|
Array(clauses).each do |clause|
|
|
465
|
-
|
|
469
|
+
if clause.class.method_defined?(:terms) && clause.terms
|
|
470
|
+
Array(clause.terms).each { |terms_section| yield(terms_section) }
|
|
471
|
+
end
|
|
466
472
|
visit_clauses_for_terms(clause.clause) { |t| yield(t) } if clause.class.method_defined?(:clause)
|
|
467
473
|
end
|
|
468
474
|
end
|
|
@@ -57,12 +57,12 @@ module Metanorma
|
|
|
57
57
|
|
|
58
58
|
def add_id(shared, id, node)
|
|
59
59
|
shared.doc_ids[id] ||= { node: node }
|
|
60
|
-
shared.id_seq << id
|
|
60
|
+
shared.id_seq << id
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def add_anchor(shared, anchor, node)
|
|
64
64
|
shared.doc_anchors[anchor] ||= { node: node }
|
|
65
|
-
shared.anchor_seq << anchor
|
|
65
|
+
shared.anchor_seq << anchor
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def collect_duplicate_issues(context)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "set"
|
|
4
|
+
|
|
3
5
|
module Metanorma
|
|
4
6
|
module Iso
|
|
5
7
|
module Validation
|
|
@@ -7,6 +9,10 @@ module Metanorma
|
|
|
7
9
|
# collection) and read by later rules (e.g. xref integrity).
|
|
8
10
|
#
|
|
9
11
|
# Lives on {Context} so every rule sees the same shared map within a run.
|
|
12
|
+
#
|
|
13
|
+
# The seq members are Sets: they collect one entry per identifier
|
|
14
|
+
# across the whole document, and duplicate checks run per identifier,
|
|
15
|
+
# so Array#include? made collection quadratic in document size.
|
|
10
16
|
SharedState = Struct.new(
|
|
11
17
|
:doc_ids, :doc_anchors, :doc_xrefs, :id_seq, :anchor_seq,
|
|
12
18
|
keyword_init: true
|
|
@@ -16,8 +22,8 @@ module Metanorma
|
|
|
16
22
|
self.doc_ids ||= {}
|
|
17
23
|
self.doc_anchors ||= {}
|
|
18
24
|
self.doc_xrefs ||= {}
|
|
19
|
-
self.id_seq ||=
|
|
20
|
-
self.anchor_seq ||=
|
|
25
|
+
self.id_seq ||= Set.new
|
|
26
|
+
self.anchor_seq ||= Set.new
|
|
21
27
|
end
|
|
22
28
|
end
|
|
23
29
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma-iso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.5.
|
|
4
|
+
version: 3.5.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: metanorma-document
|