mn-requirements 0.1.3.1 → 0.1.4.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 +4 -4
- data/Rakefile +0 -2
- data/lib/isodoc-yaml/i18n-ar.yaml +1 -0
- data/lib/isodoc-yaml/i18n-de.yaml +2 -0
- data/lib/isodoc-yaml/i18n-en.yaml +2 -0
- data/lib/isodoc-yaml/i18n-es.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +2 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +2 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +2 -0
- data/lib/metanorma/modspec/cleanup.rb +4 -4
- data/lib/metanorma/modspec/isodoc.rb +29 -16
- data/lib/metanorma/requirements/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: d626036b19a5d6878dea7341d5d76a0dec9fdd298298517a0fc332b1045faf39
|
4
|
+
data.tar.gz: 49597201b5b2b0ac782ffb5edec441011f15922aa33b095bc3fd4ed2912a194e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d013a395a330b2a03580e4035ac1970e0606ff0c9fb20efb498e6a0dc923024d89eb86667186f53302a9c37c84f89765ed14f668db7a13995787119136d3d03
|
7
|
+
data.tar.gz: 1eee3937b804a2bed138fcd719fd80551ea9925eac4025269f98ca8d52e28cbc0bf5fb36c6d0fe22c87d7f0d98510e11c656ecd23d72dbea319d9b1cb74d4599
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ module Metanorma
|
|
15
15
|
|
16
16
|
def requirement_metadata_component_tags
|
17
17
|
%w(test-purpose test-method test-method-type conditions part description
|
18
|
-
reference step requirement permission recommendation)
|
18
|
+
reference step requirement permission recommendation guidance)
|
19
19
|
end
|
20
20
|
|
21
21
|
def requirement_metadata1(reqt, dlist, ins)
|
@@ -59,9 +59,9 @@ module Metanorma
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def requirement_metadata_to_component(reqt)
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
xpath = requirement_metadata_component_tags -
|
63
|
+
%w(description requirement permission recommendation)
|
64
|
+
reqt.xpath(xpath.map { |x| ".//#{x}" }.join(" | ")).each do |c|
|
65
65
|
c["class"] = c.name
|
66
66
|
c.name = "component"
|
67
67
|
end
|
@@ -6,7 +6,8 @@ module Metanorma
|
|
6
6
|
class Modspec < Default
|
7
7
|
def requirement_render1(node)
|
8
8
|
init_lookups(node.document)
|
9
|
-
|
9
|
+
ret = requirement_guidance_parse(node, super)
|
10
|
+
requirement_table_cleanup(ret)
|
10
11
|
end
|
11
12
|
|
12
13
|
def recommendation_base(node, _klass)
|
@@ -86,9 +87,8 @@ module Metanorma
|
|
86
87
|
subj = node.at(ns("./subject"))&.children and
|
87
88
|
head << [rec_subj(node), subj]
|
88
89
|
node.xpath(ns("./classification[tag = 'target']/value")).each do |v|
|
89
|
-
xref = recommendation_id(v.text) and
|
90
|
-
rec_target(node), xref
|
91
|
-
]
|
90
|
+
xref = recommendation_id(v.text) and
|
91
|
+
head << [rec_target(node), xref]
|
92
92
|
end
|
93
93
|
head += recommendation_backlinks(node)
|
94
94
|
recommendation_attributes1_dependencies(node, head)
|
@@ -121,32 +121,37 @@ module Metanorma
|
|
121
121
|
head
|
122
122
|
end
|
123
123
|
|
124
|
+
def id_attr(node)
|
125
|
+
node["id"] ? " id='#{node['id']}'" : ""
|
126
|
+
end
|
127
|
+
|
124
128
|
def recommendation_steps(node)
|
125
129
|
node.elements.each { |e| recommendation_steps(e) }
|
126
130
|
return node unless node.at(ns("./component[@class = 'step']"))
|
127
131
|
|
128
132
|
d = node.at(ns("./component[@class = 'step']"))
|
129
|
-
d = d.replace("<ol class='steps'><li
|
130
|
-
|
133
|
+
d = d.replace("<ol class='steps'><li#{id_attr(d)}>"\
|
134
|
+
"#{d.children.to_xml}</li></ol>").first
|
131
135
|
node.xpath(ns("./component[@class = 'step']")).each do |f|
|
132
|
-
f = f.replace("<li>#{f.children.to_xml}</li>").first
|
136
|
+
f = f.replace("<li#{id_attr(f)}>#{f.children.to_xml}</li>").first
|
133
137
|
d << f
|
134
138
|
end
|
135
139
|
node
|
136
140
|
end
|
137
141
|
|
138
142
|
def recommendation_attributes1_component(node, out)
|
143
|
+
return out if node["class"] == "guidance"
|
144
|
+
|
139
145
|
node = recommendation_steps(node)
|
140
|
-
out << "<tr><td>#{node['label']}</td
|
146
|
+
out << "<tr#{id_attr(node)}><td>#{node['label']}</td>"\
|
147
|
+
"<td>#{node.children}</td></tr>"
|
141
148
|
out
|
142
149
|
end
|
143
150
|
|
144
151
|
def recommendation_attr_keyvalue(node, key, value)
|
145
|
-
tag = node.at(ns("./#{key}"))
|
146
|
-
value = node.at(ns("./#{value}"))
|
147
|
-
(tag
|
148
|
-
indirect-dependency).include?(tag.text)) or
|
149
|
-
return nil
|
152
|
+
tag = node.at(ns("./#{key}")) or return nil
|
153
|
+
value = node.at(ns("./#{value}")) or return nil
|
154
|
+
!%w(target indirect-dependency).include?(tag.text) or return nil
|
150
155
|
[tag.text.capitalize, value.children]
|
151
156
|
end
|
152
157
|
|
@@ -162,18 +167,26 @@ module Metanorma
|
|
162
167
|
end
|
163
168
|
|
164
169
|
def requirement_component_parse(node, out)
|
165
|
-
|
166
|
-
|
170
|
+
node["exclude"] == "true" and return out
|
167
171
|
node.elements.size == 1 && node.first_element_child.name == "dl" and
|
168
172
|
return reqt_dl(node.first_element_child, out)
|
169
173
|
node.name == "component" and
|
170
174
|
return recommendation_attributes1_component(node, out)
|
171
|
-
out.add_child("<tr><td colspan='2'></td></tr>").first
|
175
|
+
out.add_child("<tr#{id_attr(node)}><td colspan='2'></td></tr>").first
|
172
176
|
.at(ns(".//td")) <<
|
173
177
|
(preserve_in_nested_table?(node) ? node : node.children)
|
174
178
|
out
|
175
179
|
end
|
176
180
|
|
181
|
+
def requirement_guidance_parse(node, out)
|
182
|
+
ins = out.at(ns("./tbody"))
|
183
|
+
node.xpath(ns("./component[@class = 'guidance']")).each do |f|
|
184
|
+
ins << "<tr#{id_attr(f)}><td>#{@labels['modspec']['guidance']}</td>"\
|
185
|
+
"<td>#{f.children}</td></tr>"
|
186
|
+
end
|
187
|
+
out
|
188
|
+
end
|
189
|
+
|
177
190
|
def reqt_dl(node, out)
|
178
191
|
node.xpath(ns("./dt")).each do |dt|
|
179
192
|
dd = dt.next_element
|
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.1.
|
4
|
+
version: 0.1.4.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-09-
|
11
|
+
date: 2022-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: isodoc-i18n
|