mn-requirements 0.1.4 → 0.1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 -20
- data/lib/metanorma/requirements/version.rb +1 -1
- metadata +1 -1
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
|
@@ -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,35 +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
|
-
|
130
|
-
|
131
|
-
.first
|
133
|
+
d = d.replace("<ol class='steps'><li#{id_attr(d)}>"\
|
134
|
+
"#{d.children.to_xml}</li></ol>").first
|
132
135
|
node.xpath(ns("./component[@class = 'step']")).each do |f|
|
133
|
-
|
134
|
-
f = f.replace("<li#{id}>#{f.children.to_xml}</li>").first
|
136
|
+
f = f.replace("<li#{id_attr(f)}>#{f.children.to_xml}</li>").first
|
135
137
|
d << f
|
136
138
|
end
|
137
139
|
node
|
138
140
|
end
|
139
141
|
|
140
142
|
def recommendation_attributes1_component(node, out)
|
143
|
+
return out if node["class"] == "guidance"
|
144
|
+
|
141
145
|
node = recommendation_steps(node)
|
142
|
-
|
143
|
-
|
146
|
+
out << "<tr#{id_attr(node)}><td>#{node['label']}</td>"\
|
147
|
+
"<td>#{node.children}</td></tr>"
|
144
148
|
out
|
145
149
|
end
|
146
150
|
|
147
151
|
def recommendation_attr_keyvalue(node, key, value)
|
148
|
-
tag = node.at(ns("./#{key}"))
|
149
|
-
value = node.at(ns("./#{value}"))
|
150
|
-
(tag
|
151
|
-
indirect-dependency).include?(tag.text)) or
|
152
|
-
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
|
153
155
|
[tag.text.capitalize, value.children]
|
154
156
|
end
|
155
157
|
|
@@ -165,19 +167,26 @@ module Metanorma
|
|
165
167
|
end
|
166
168
|
|
167
169
|
def requirement_component_parse(node, out)
|
168
|
-
|
169
|
-
|
170
|
+
node["exclude"] == "true" and return out
|
170
171
|
node.elements.size == 1 && node.first_element_child.name == "dl" and
|
171
172
|
return reqt_dl(node.first_element_child, out)
|
172
173
|
node.name == "component" and
|
173
174
|
return recommendation_attributes1_component(node, out)
|
174
|
-
|
175
|
-
out.add_child("<tr#{id}><td colspan='2'></td></tr>").first
|
175
|
+
out.add_child("<tr#{id_attr(node)}><td colspan='2'></td></tr>").first
|
176
176
|
.at(ns(".//td")) <<
|
177
177
|
(preserve_in_nested_table?(node) ? node : node.children)
|
178
178
|
out
|
179
179
|
end
|
180
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
|
+
|
181
190
|
def reqt_dl(node, out)
|
182
191
|
node.xpath(ns("./dt")).each do |dt|
|
183
192
|
dd = dt.next_element
|