mn-requirements 0.5.2 → 0.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ef4d021215deb4324b8fa93055251ec2c07a1756a99d33aa0733b3b84ff4d4a
|
4
|
+
data.tar.gz: 5f716ed0412c4a62aace69406099e356f54b432453d3fb85089e9377a614705d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f6bc5c6f41577a1752e453d303a80cfb832f9cc0f482b279bfe7299ab932f424d82c5363deb8705001cc9058598f423e15ed6de5fd25ab2865855015824d96b
|
7
|
+
data.tar.gz: 2eece26b7b81d11902325d1b72c7876ff4af7804b297a81fd2d9173db76093d6a5c07867baa81a4d1ba258bfb0e2fbb05e28b614b6f12d64e6cad36597e5a931
|
@@ -57,8 +57,10 @@ module Metanorma
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def reqt_attrs(node, attrs)
|
60
|
+
anchor = node&.id
|
60
61
|
attr_code(attrs.merge(
|
61
|
-
id:
|
62
|
+
id: "_#{UUIDTools::UUID.random_create}",
|
63
|
+
anchor: anchor && !anchor.empty? ? anchor : nil,
|
62
64
|
unnumbered: node.option?("unnumbered") ? "true" : nil,
|
63
65
|
number: node.attr("number"),
|
64
66
|
subsequence: node.attr("subsequence"),
|
@@ -76,11 +76,13 @@ module Metanorma
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def requirement_anchor_identifier(reqt)
|
79
|
-
Metanorma::Utils::guid_anchor?(reqt["id"]) or return
|
79
|
+
# Metanorma::Utils::guid_anchor?(reqt["id"]) or return
|
80
|
+
(!reqt["anchor"] || Metanorma::Utils::guid_anchor?(reqt["anchor"])) or return
|
80
81
|
id = reqt.at("./identifier") or return
|
81
82
|
anchor = id.text.strip
|
82
83
|
anchor.empty? and return
|
83
|
-
reqt["id"] = Metanorma::Utils::to_ncname(anchor)
|
84
|
+
# reqt["id"] = Metanorma::Utils::to_ncname(anchor)
|
85
|
+
reqt["anchor"] = anchor
|
84
86
|
end
|
85
87
|
|
86
88
|
def requirement_target_identifiers(reqt)
|
@@ -105,7 +107,8 @@ module Metanorma
|
|
105
107
|
def requirement_metadata_to_requirement(reqt)
|
106
108
|
xpath = requirement_metadata_requirement_tags
|
107
109
|
reqt.xpath(xpath.map { |x| "./#{x}" }.join(" | ")).each do |c|
|
108
|
-
c["id"] = Metanorma::Utils::anchor_or_uuid
|
110
|
+
# c["id"] = Metanorma::Utils::anchor_or_uuid
|
111
|
+
c["id"] = "_#{UUIDTools::UUID.random_create}"
|
109
112
|
c["model"] = reqt["model"] # all requirements must have a model
|
110
113
|
requirement_metadata_to_requirement1(c)
|
111
114
|
end
|
@@ -142,22 +145,29 @@ module Metanorma
|
|
142
145
|
|
143
146
|
def add_misccontainer_anchor_aliases(xmldoc)
|
144
147
|
m = add_misc_container(xmldoc)
|
145
|
-
x = ".//table[@
|
148
|
+
x = ".//table[@anchor='_misccontainer_anchor_aliases']/tbody"
|
146
149
|
unless ins = m.at(x)
|
147
|
-
m << "<table
|
150
|
+
m << "<table anchor='_misccontainer_anchor_aliases' id='_#{UUIDTools::UUID.random_create}'><tbody/></table>"
|
148
151
|
ins = m.at(x)
|
149
152
|
end
|
150
153
|
ins
|
151
154
|
end
|
152
155
|
|
153
156
|
def requirement_anchor_aliases(reqt)
|
157
|
+
ids = requirement_anchor_aliases_extract(reqt) or return
|
158
|
+
table = add_misccontainer_anchor_aliases(reqt.document)
|
159
|
+
alias_id = reqt["anchor"] or return
|
160
|
+
table << "<tr><th>#{alias_id}</th>#{ids.join}</tr>"
|
161
|
+
end
|
162
|
+
|
163
|
+
def requirement_anchor_aliases_extract(reqt)
|
154
164
|
x = reqt.xpath("./identifier")
|
155
165
|
x.empty? and return
|
156
|
-
|
157
|
-
ids = x.each_with_object([]) do |i, m|
|
166
|
+
x.each_with_object([]) do |i, m|
|
158
167
|
m << "<td>#{i.text}</td>"
|
168
|
+
alias_id = ::Metanorma::Utils.to_ncname(i.text)
|
169
|
+
alias_id != i.text and m << "<td>#{alias_id}</td>"
|
159
170
|
end
|
160
|
-
table << "<tr><th>#{reqt['id']}</th>#{ids.join}</tr>"
|
161
171
|
end
|
162
172
|
|
163
173
|
def requirement_identifier_cleanup(reqt)
|
@@ -71,7 +71,6 @@ module Metanorma
|
|
71
71
|
|
72
72
|
def reqt_to_conformance(reqt, reqtclass, confclass)
|
73
73
|
return unless type2validate(reqt) == reqtclass
|
74
|
-
|
75
74
|
r = @ids[:id][reqt["id"]]
|
76
75
|
(r[:label] && @ids[:class][confclass]&.any? do |x|
|
77
76
|
x[:subject].include?(r[:label])
|
@@ -143,7 +142,7 @@ module Metanorma
|
|
143
142
|
end
|
144
143
|
|
145
144
|
def reqt_links_struct(reqt)
|
146
|
-
{ id: reqt["
|
145
|
+
{ id: reqt["anchor"], elem: reqt, label: reqt.at("./identifier")&.text,
|
147
146
|
subject: classif_tag(reqt, "target"),
|
148
147
|
child: reqt.xpath("./requirement | ./recommendation | ./permission")
|
149
148
|
.map { |r| r.at("./identifier")&.text },
|
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.5.
|
4
|
+
version: 0.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: 2025-
|
11
|
+
date: 2025-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: isodoc-i18n
|