mn-requirements 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 835ebdf2e3bbc0dea0c8eb3103e3aebe23f896d9610a99a1ddafc45b3e7953f2
4
- data.tar.gz: 984be6317de16bd417ae59c7645ba970a32ba2add0261679c683560a01c5476c
3
+ metadata.gz: 1cc32c6334d63f4745d279e84ea08305400eccc4f020ac410b85488e47e3c6ce
4
+ data.tar.gz: 57e1f8b559a619d6d01a18520d15f3de7787d0eb7fed17add4c120bc58b0d862
5
5
  SHA512:
6
- metadata.gz: 1fd6e0090c521fa3817505429b75ec281e1f801257143f675ec82eb90eea20d0a2848aff92fa9d13f95dde5ddf5b9bee11e15f5b919bf779b8ed1fbf2f6305fe
7
- data.tar.gz: c7c3fabad721fa9c88e738bce338105b2b856de8747c60aee62b8cfc0e39e7c140afc328697c4f668f13704afc96ad896a5f61f96914e2fc0644b6e61b659ad9
6
+ metadata.gz: 817a441beba95552171c674b07c7d447808496a642c90181baf039723b7fcdef1dbb5ee23ecac9e167ffea9d09871af3bfa48dec7c40c7cc46b4fe48559e1286
7
+ data.tar.gz: '09ee6db13e6fc2eb7e99ec2fbeb281a6ce3a9aed08e8d41b865a1acd458c2ec9fa642325bfff50de1ec8689ba9f8e8a74f914e0c5e3759670ee85c183f787ec1'
@@ -25,6 +25,7 @@ requirements:
25
25
  identifier: المعرف
26
26
  included_in: مدرج في
27
27
  statement: بيان
28
+ description: وصف
28
29
  guidance: إرشاد
29
30
  implements: تنفذ
30
31
  provision: بيان المعياري
@@ -25,6 +25,7 @@ requirements:
25
25
  identifier: Kennung
26
26
  included_in: Enthalten in
27
27
  statement: Aussage
28
+ description: Beschreibung
28
29
  guidance: Anleitung
29
30
  implements: Implementiert
30
31
  provision: Normative Aussage
@@ -25,6 +25,7 @@ requirements:
25
25
  identifier: Identifier
26
26
  included_in: Included in
27
27
  statement: Statement
28
+ description: Description
28
29
  guidance: Guidance
29
30
  implements: Implements
30
31
  provision: Normative statement
@@ -25,6 +25,7 @@ requirements:
25
25
  identifier: Identificador
26
26
  included_in: Incluido en
27
27
  statement: Declaración
28
+ description: Descripción
28
29
  guidance: Orientación
29
30
  implements: Implementa
30
31
  provision: Declaración normativa
@@ -25,6 +25,7 @@ requirements:
25
25
  identifier: Identifiant
26
26
  included_in: Inclus dans
27
27
  statement: Déclaration
28
+ description: Description
28
29
  guidance: Avis
29
30
  implements: Implémente
30
31
  provision: Déclaration normative
@@ -25,6 +25,7 @@ requirements:
25
25
  identifier: Идентификатор
26
26
  included_in: Входит в
27
27
  statement: Утверждение
28
+ description: Описание
28
29
  guidance: Руководство
29
30
  implements: Реализует
30
31
  provision: Нормативное положение
@@ -25,6 +25,7 @@ requirements:
25
25
  identifier: 标识符
26
26
  included_in: 包含在
27
27
  statement: 陈述
28
+ description: 描述
28
29
  guidance: 指导意见
29
30
  implements: 它实现
30
31
  provision: 规范性陈述
@@ -69,8 +69,8 @@ module Metanorma
69
69
 
70
70
  def recommend_title(node, out)
71
71
  label = node.at(ns("./identifier")) or return
72
- out.add_child("<tr><td scope='colgroup' colspan='2'>" \
73
- "<tt>#{label.children.to_xml}</tt></td>")
72
+ out.add_child("<tr><th>#{@labels['modspec']['identifier']}</th>" \
73
+ "<td><tt>#{label.children.to_xml}</tt></td>")
74
74
  end
75
75
 
76
76
  def recommendation_attributes1(node)
@@ -162,7 +162,8 @@ module Metanorma
162
162
  def recommendation_attr_keyvalue(node, key, value)
163
163
  tag = node.at(ns("./#{key}")) or return nil
164
164
  value = node.at(ns("./#{value}")) or return nil
165
- !%w(target indirect-dependency implements).include?(tag.text.downcase) or
165
+ !%w(target indirect-dependency
166
+ implements).include?(tag.text.downcase) or
166
167
  return nil
167
168
  [Metanorma::Utils.strict_capitalize_first(tag.text), value.children]
168
169
  end
@@ -184,12 +185,23 @@ module Metanorma
184
185
  return reqt_dl(node.first_element_child, out)
185
186
  node.name == "component" and
186
187
  return recommendation_attributes1_component(node, out)
188
+ node.name == "description" and
189
+ return requirement_description_parse(node, out)
187
190
  out.add_child("<tr#{id_attr(node)}><td colspan='2'></td></tr>").first
188
191
  .at(ns(".//td")) <<
189
192
  (preserve_in_nested_table?(node) ? node : node.children)
190
193
  out
191
194
  end
192
195
 
196
+ def requirement_description_parse(node, out)
197
+ lbl = "statement"
198
+ recommend_class(node.parent) == "recommendclass" and
199
+ lbl = "description"
200
+ out << "<tr><th>#{@labels['modspec'][lbl]}</th>" \
201
+ "<td>#{node.children.to_xml}</td></tr>"
202
+ out
203
+ end
204
+
193
205
  def requirement_guidance_parse(node, out)
194
206
  ins = out.at(ns("./tbody"))
195
207
  node.xpath(ns("./component[@class = 'guidance']")).each do |f|
@@ -208,47 +220,6 @@ module Metanorma
208
220
  end
209
221
  out
210
222
  end
211
-
212
- def rec_subj(node)
213
- case node["type"]
214
- when "class" then @labels["modspec"]["targettype"]
215
- else @labels["default"]["subject"]
216
- end
217
- end
218
-
219
- def rec_target(node)
220
- case node["type"]
221
- when "class" then @labels["modspec"]["targettype"]
222
- when "conformanceclass" then @labels["modspec"]["requirementclass"]
223
- when "verification", "abstracttest" then @labels["default"]["requirement"]
224
- else @labels["modspec"]["target"]
225
- end
226
- end
227
-
228
- def recommend_class(node)
229
- case node["type"]
230
- when "verification", "abstracttest" then "recommendtest"
231
- when "class", "conformanceclass" then "recommendclass"
232
- else "recommend"
233
- end
234
- end
235
-
236
- def recommend_name_class(node)
237
- if %w(verification abstracttest).include?(node["type"])
238
- "RecommendationTestTitle"
239
- else "RecommendationTitle"
240
- end
241
- end
242
-
243
- def recommend_component_label(node)
244
- c = case node["class"]
245
- when "test-purpose" then "Test purpose"
246
- when "test-method" then "Test method"
247
- else node["class"]
248
- end
249
- @labels["default"][c] || @labels["modspec"][c] ||
250
- Metanorma::Utils.strict_capitalize_first(c)
251
- end
252
223
  end
253
224
  end
254
225
  end
@@ -142,6 +142,47 @@ module Metanorma
142
142
  ret << [@labels["modspec"]["included_in"], xref]
143
143
  ret
144
144
  end
145
+
146
+ def rec_subj(node)
147
+ case node["type"]
148
+ when "class" then @labels["modspec"]["targettype"]
149
+ else @labels["default"]["subject"]
150
+ end
151
+ end
152
+
153
+ def rec_target(node)
154
+ case node["type"]
155
+ when "class" then @labels["modspec"]["targettype"]
156
+ when "conformanceclass" then @labels["modspec"]["requirementclass"]
157
+ when "verification", "abstracttest" then @labels["default"]["requirement"]
158
+ else @labels["modspec"]["target"]
159
+ end
160
+ end
161
+
162
+ def recommend_class(node)
163
+ case node["type"]
164
+ when "verification", "abstracttest" then "recommendtest"
165
+ when "class", "conformanceclass" then "recommendclass"
166
+ else "recommend"
167
+ end
168
+ end
169
+
170
+ def recommend_name_class(node)
171
+ if %w(verification abstracttest).include?(node["type"])
172
+ "RecommendationTestTitle"
173
+ else "RecommendationTitle"
174
+ end
175
+ end
176
+
177
+ def recommend_component_label(node)
178
+ c = case node["class"]
179
+ when "test-purpose" then "Test purpose"
180
+ when "test-method" then "Test method"
181
+ else node["class"]
182
+ end
183
+ @labels["default"][c] || @labels["modspec"][c] ||
184
+ Metanorma::Utils.strict_capitalize_first(c)
185
+ end
145
186
  end
146
187
  end
147
188
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  class Requirements
3
- VERSION = "0.1.9".freeze
3
+ VERSION = "0.2.0".freeze
4
4
  end
5
5
  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.1.9
4
+ version: 0.2.0
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-10-19 00:00:00.000000000 Z
11
+ date: 2022-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isodoc-i18n