metanorma-iso 3.5.1 → 3.5.3
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 66c9e9b0d1e7b7543e36cc45fcf3da25412f1f5a07f743a1cfc7a13258a9bcb7
|
|
4
|
+
data.tar.gz: c9f02b3911b7e103ba710fd51f9e08266c185c3e3de5a0b0cba2d718f96ed768
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f72541b1c6ddf638541c2724ce5bad4c1f7fab8141f0250b9d0f01531f21437f5b1f08ff80ee08bbeac9f00ffff96141880a816a131d0776a9d391772d22c13
|
|
7
|
+
data.tar.gz: 4a6a3271493c97dcd34eac4acda96ad20dfbeddf526bfa87b8407d94c72c75456767016f348d2ad88485290cab68977110edf23476b43037b3f2a4f9a0b54de2
|
|
@@ -24,6 +24,8 @@ module IsoDoc
|
|
|
24
24
|
|
|
25
25
|
# style [1] references as [Reference 1], eref or origin
|
|
26
26
|
def bracketed_refs_processing(docxml)
|
|
27
|
+
@elem_id_lookup = docxml.xpath("//*[@id]")
|
|
28
|
+
.each_with_object({}) { |e, h| h[e["id"]] ||= e }
|
|
27
29
|
(docxml.xpath(ns("//semx[@element = 'eref']")) -
|
|
28
30
|
docxml.xpath(ns("//semx[@element = 'erefstack']//semx[@element = 'eref']")))
|
|
29
31
|
.each { |n| bracket_eref_style(n) }
|
|
@@ -46,9 +48,16 @@ module IsoDoc
|
|
|
46
48
|
end
|
|
47
49
|
end
|
|
48
50
|
|
|
51
|
+
# Reference sources resolve through a one-pass id index: a
|
|
52
|
+
# per-reference //*[@id = '...'] document scan is quadratic on
|
|
53
|
+
# large vocabulary documents.
|
|
54
|
+
def source_semx(elem)
|
|
55
|
+
@elem_id_lookup[elem["source"]]
|
|
56
|
+
end
|
|
57
|
+
|
|
49
58
|
# is the eref corresponding to this semx a simple [n] reference?
|
|
50
59
|
def bracket_eref_original(elem)
|
|
51
|
-
semx =
|
|
60
|
+
semx = source_semx(elem) or return
|
|
52
61
|
dup = elem.at(ns(".//fmt-eref | .//fmt-xref | .//fmt-origin"))
|
|
53
62
|
non_locality_elems(semx).empty? or return
|
|
54
63
|
/^\[\d+\]$/.match?(semx["citeas"]) or return
|
|
@@ -75,7 +84,7 @@ module IsoDoc
|
|
|
75
84
|
def bracket_erefstack_style_prep(elem)
|
|
76
85
|
semx = elem.xpath(ns(".//semx[@element = 'eref']"))
|
|
77
86
|
.filter_map { |e| bracket_eref_original(e) }
|
|
78
|
-
erefstack_orig =
|
|
87
|
+
erefstack_orig = source_semx(elem)
|
|
79
88
|
[semx, erefstack_orig]
|
|
80
89
|
end
|
|
81
90
|
|
|
@@ -85,7 +94,7 @@ module IsoDoc
|
|
|
85
94
|
end
|
|
86
95
|
|
|
87
96
|
def insert_biblio_callout(elem)
|
|
88
|
-
semx =
|
|
97
|
+
semx = source_semx(elem) or return
|
|
89
98
|
if ref = @bibitem_lookup[semx["bibitemid"]]
|
|
90
99
|
Metanorma::Iso::PublisherIdentity
|
|
91
100
|
.iso_iec_publisher?(ref, ns: method(:ns)) and return
|
|
@@ -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
|
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.3
|
|
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-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: metanorma-document
|