mn-requirements 0.2.3 → 0.3.1
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: ba924dc80c3e45c7164b660a0415fc57f9e504a353eef2520394e10457cdbcc4
|
4
|
+
data.tar.gz: 5e365fbe452fc974b49df62dd50f026ebf59138a4a944ae20df769c2072192ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aad5df40295c9009f021eae54be6e57a0976ead82165cd1299eb55587e8d313577be4c9bf06f78a42e2d2868bc568ad3d8de904203034656e9e8902727b079f3
|
7
|
+
data.tar.gz: 9a23a9809a2f6d24a1ab1db10409a4fd232076f42e8060d5efa60789454b958f08df548a949e9e2eced622f80a8e8d30b7c34eb1d943cbf2213de5e3e89884f0
|
@@ -23,7 +23,7 @@ module Metanorma
|
|
23
23
|
|
24
24
|
def recommendation_label_xref(elem, label, xrefs, type)
|
25
25
|
id = @reqtlabels[label]
|
26
|
-
number = xrefs.anchor(id, :
|
26
|
+
number = xrefs.anchor(id, :modspec, false)
|
27
27
|
number.nil? and return type
|
28
28
|
elem.ancestors("requirement, recommendation, permission").empty? and
|
29
29
|
return number
|
@@ -73,7 +73,7 @@ module Metanorma
|
|
73
73
|
docxml.reqt_iter do |r, m|
|
74
74
|
id = r.at(ns("./identifier")) or next
|
75
75
|
m[id.text] =
|
76
|
-
{ id: r["id"], lbl: @xrefs.anchor(r["id"], :
|
76
|
+
{ id: r["id"], lbl: @xrefs.anchor(r["id"], :modspec, false) }
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -85,7 +85,7 @@ module Metanorma
|
|
85
85
|
%w(conformanceclass verification).include?(reqt["type"]) or return
|
86
86
|
subj = reqt_extract_target(reqt)
|
87
87
|
id = reqt.at(ns("./identifier")) or return
|
88
|
-
lbl = @xrefs.anchor(@reqt_ids[id.text.strip][:id], :
|
88
|
+
lbl = @xrefs.anchor(@reqt_ids[id.text.strip][:id], :modspec, false)
|
89
89
|
(subj && lbl) or return
|
90
90
|
acc[subj.text] = { lbl: lbl, id: reqt["id"] }
|
91
91
|
end
|
@@ -121,7 +121,7 @@ module Metanorma
|
|
121
121
|
|
122
122
|
def reqt_links_class1(id, parent_reqt, reqt, acc)
|
123
123
|
id1 = reqt.at(ns("./identifier")) or return acc
|
124
|
-
lbl = @xrefs.anchor(@reqt_ids[id.text.strip][:id], :
|
124
|
+
lbl = @xrefs.anchor(@reqt_ids[id.text.strip][:id], :modspec, false)
|
125
125
|
lbl or return acc
|
126
126
|
acc[id1.text] = { lbl: lbl, id: parent_reqt["id"] }
|
127
127
|
acc
|
@@ -4,10 +4,12 @@ module Metanorma
|
|
4
4
|
class Requirements
|
5
5
|
class Modspec < Default
|
6
6
|
def validate(reqt, log)
|
7
|
+
@fatalerrors = []
|
7
8
|
@log ||= log
|
8
9
|
@ids ||= reqt_links(reqt.document)
|
9
10
|
reqt_cycles_validate
|
10
11
|
reqt_link_validate(reqt)
|
12
|
+
@fatalerrors
|
11
13
|
end
|
12
14
|
|
13
15
|
def nested_reqt?(reqt)
|
@@ -112,17 +114,26 @@ module Metanorma
|
|
112
114
|
.each_with_object({ id: {}, class: {}, label: {} }) do |r, m|
|
113
115
|
next if nested_reqt?(r)
|
114
116
|
|
115
|
-
reqt_links1(r, m)
|
117
|
+
reqt_links1(r, m, type2validate(r), reqt_links_struct(r))
|
116
118
|
end
|
117
119
|
end
|
118
120
|
|
119
|
-
def reqt_links1(reqt, hash)
|
120
|
-
|
121
|
-
a = reqt_links_struct(reqt)
|
122
|
-
hash[:id][reqt["id"]] = a
|
121
|
+
def reqt_links1(reqt, hash, type, struct)
|
122
|
+
hash[:id][reqt["id"]] = struct
|
123
123
|
hash[:class][type] ||= []
|
124
|
-
hash[:class][type] <<
|
125
|
-
hash
|
124
|
+
hash[:class][type] << struct
|
125
|
+
reqt_links1_label(reqt, hash, struct)
|
126
|
+
end
|
127
|
+
|
128
|
+
def reqt_links1_label(reqt, hash, struct)
|
129
|
+
return hash unless struct[:label]
|
130
|
+
|
131
|
+
if hash[:label][struct[:label]]
|
132
|
+
msg = "Modspec identifier #{struct[:label]} is used more than once"
|
133
|
+
@log.add("Requirements", reqt, msg)
|
134
|
+
@fatalerrors << msg
|
135
|
+
end
|
136
|
+
hash[:label][struct[:label]] = reqt["id"]
|
126
137
|
hash
|
127
138
|
end
|
128
139
|
|
@@ -72,10 +72,10 @@ module Metanorma
|
|
72
72
|
def postprocess_anchor_struct(block, anchor)
|
73
73
|
super
|
74
74
|
anchor[:xref_bare] = anchor[:xref]
|
75
|
-
|
75
|
+
l = block.at(ns("./identifier")) and
|
76
76
|
anchor[:xref] += l10n(": ") +
|
77
|
-
"<tt><xref style='id' target='#{block['id']}'>#{l}</xref></tt>"
|
78
|
-
|
77
|
+
"<tt><xref style='id' target='#{block['id']}'>#{l.text}</xref></tt>"
|
78
|
+
anchor[:modspec] = anchor[:xref]
|
79
79
|
anchor
|
80
80
|
end
|
81
81
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mn-requirements
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: isodoc-i18n
|
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
250
|
- !ruby/object:Gem::Version
|
251
251
|
version: '0'
|
252
252
|
requirements: []
|
253
|
-
rubygems_version: 3.3.
|
253
|
+
rubygems_version: 3.3.26
|
254
254
|
signing_key:
|
255
255
|
specification_version: 4
|
256
256
|
summary: Requirements processing and rendering according to different models
|