mn-requirements 0.4.0 → 0.4.1

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: 01bee8304acc8f185870fb5f6960e2a7393d096acc9cdf9ea4e87918baf297e0
4
- data.tar.gz: 11412398e35579a0e3022250101a3629409b7f784da526d152de6a1a69c00e33
3
+ metadata.gz: bd0f29f7ad1df5f2127ec2c47f22d03e50bc6ec18e76459352ba6d873117d049
4
+ data.tar.gz: 60f5b1e8cd4463f0d2492731a502b33ea9b9d3930fa5fc09d99b2aa14285f153
5
5
  SHA512:
6
- metadata.gz: e9d3f86cd517967140e1febd7c7852d55dd3b1b4b8c74d1159c335d42717fc51c960218caf5631d9f135701b8f812b830685ad5224ac9dbc4249ee24a0cfcda9
7
- data.tar.gz: 7cc6c088de6e4ea5ae8050844ccf0d9cf49369bf63b89ffa4892316539d57d5ae89074fe184191a4e78e940d59efef1abc09e3bd88805125ff734aeb7f11f735
6
+ metadata.gz: 9028d71bdb94818359b7ebda35103973ce7906eae30aad1b881085fccdde2d78f6a07edb5fdc939c9234738751a48bda2a06bafba6809457808ba5fe563b189c
7
+ data.tar.gz: 83e2726e3edeb550d272860a8e477a50629bc298468555cb3fcf251b60b318a4e63a42b750d2812542bf8185007b0da0eb0ad49a926f4e0688c7c2a4b55efd5b
data/lib/isodoc/i18n.rb CHANGED
@@ -5,7 +5,7 @@ module IsoDoc
5
5
  class MnRequirementsI18n < I18n
6
6
  def load_yaml1(lang, script)
7
7
  case lang
8
- when "en", "fr", "ru", "de", "es", "ar"
8
+ when "en", "fr", "ru", "de", "es", "ar", "ja"
9
9
  load_yaml2(lang)
10
10
  when "zh"
11
11
  if script == "Hans" then load_yaml2("zh-Hans")
@@ -0,0 +1,31 @@
1
+ requirements:
2
+ default:
3
+ requirement: 要求
4
+ recommendation: 推奨
5
+ permission: 許可
6
+ obligation: 義務
7
+ subject: 主題
8
+ inherits: 継承
9
+ modspec:
10
+ recommendationtest: 要求テスト
11
+ requirementtest: 要求テスト
12
+ permissiontest: 許可テスト
13
+ recommendationclass: 要求クラス
14
+ requirementclass: 要求クラス
15
+ permissionclass: 許可クラス
16
+ abstracttest: 抽象テスト
17
+ conformanceclass: 適合クラス
18
+ conformancetest: 適合性テスト
19
+ targettype: ターゲットタイプ
20
+ target: ターゲット
21
+ testpurpose: テスト目的
22
+ testmethod: 試験方法
23
+ dependency: 前提条件
24
+ indirectdependency: 間接的な前提条件
25
+ identifier: 識別子
26
+ included_in: 含まれる
27
+ statement: 声明
28
+ description: 説明
29
+ guidance: ガイダンス
30
+ implements: 実装
31
+ provision: 規範的声明
@@ -72,7 +72,7 @@ module Metanorma
72
72
  end
73
73
 
74
74
  def requirement_metadata1_attrs
75
- %w(obligation model type)
75
+ %w(obligation model type class)
76
76
  end
77
77
 
78
78
  def requirement_metadata1_tags
@@ -65,6 +65,7 @@ module Metanorma
65
65
  obligation: node.attr("obligation"),
66
66
  filename: node.attr("filename"),
67
67
  type: node.attr("type"),
68
+ class: node.attr("class"),
68
69
  ))
69
70
  end
70
71
 
@@ -34,7 +34,7 @@ module Metanorma
34
34
  def requirement_metadata1(reqt, dlist, ins)
35
35
  ins1 = super
36
36
  dlist.xpath("./dt").each do |e|
37
- tag = e.text&.gsub(/ /, "-")&.downcase
37
+ tag = e.text&.tr(" ", "-")&.downcase
38
38
  tag = "description" if tag == "statement"
39
39
  next unless requirement_metadata_component_tags.include?(tag)
40
40
 
@@ -93,7 +93,8 @@ module Metanorma
93
93
  end
94
94
 
95
95
  def requirement_metadata_to_component(reqt)
96
- xpath = requirement_metadata_component_tags - %w(statement description) -
96
+ xpath = requirement_metadata_component_tags - %w(statement
97
+ description) -
97
98
  requirement_metadata_requirement_tags
98
99
  reqt.xpath(xpath.map { |x| ".//#{x}" }.join(" | ")).each do |c|
99
100
  c["class"] = c.name
@@ -8,7 +8,9 @@ module Metanorma
8
8
  def requirement_render1(node)
9
9
  init_lookups(node.document)
10
10
  ret = requirement_guidance_parse(node, super)
11
- requirement_table_cleanup(node, ret)
11
+ out = requirement_table_cleanup(node, ret)
12
+ out["class"] = "modspec" # deferred; node["class"] is labelling class
13
+ out
12
14
  end
13
15
 
14
16
  def recommendation_base(node, _klass)
@@ -17,7 +19,6 @@ module Metanorma
17
19
  %w(id keep-with-next keep-lines-together unnumbered).each do |x|
18
20
  out[x] = node[x] if node[x]
19
21
  end
20
- out["class"] = "modspec"
21
22
  out["type"] = recommend_class(node)
22
23
  recommendation_component_labels(node)
23
24
  out
@@ -35,9 +36,9 @@ module Metanorma
35
36
  def recommendation_header(reqt, out)
36
37
  n = recommendation_name(reqt, nil)
37
38
  x = if reqt.ancestors("requirement, recommendation, permission").empty?
38
- "<thead><tr><th scope='colgroup' colspan='2'>" \
39
- "<p class='#{recommend_name_class(reqt)}'>#{n}</p>" \
40
- "</th></tr></thead>"
39
+ <<~THEAD
40
+ <thead><tr><th scope='colgroup' colspan='2'><p class='#{recommend_name_class(reqt)}'>#{n}</p></th></tr></thead>
41
+ THEAD
41
42
  else
42
43
  "<thead><tr><th>#{recommendation_class_label(reqt)}</th>" \
43
44
  "<td>#{n}</td></tr></thead>"
@@ -129,7 +130,7 @@ module Metanorma
129
130
  node.xpath(ns("./classification[tag][value]")).each do |c|
130
131
  c.at(ns("./tag")).text.casecmp(x).zero? or next
131
132
  xref = recommendation_id(c.at(ns("./value")).children.to_xml) and
132
- head << [@labels["modspec"][x.gsub(/-/, "")], xref]
133
+ head << [@labels["modspec"][x.delete("-")], xref]
133
134
  end
134
135
  end
135
136
  head
@@ -1,7 +1,11 @@
1
- class Nokogiri::XML::Document
2
- def reqt_iter(&block)
3
- xpath("//xmlns:requirement | //xmlns:recommendation | //xmlns:permission")
4
- .each_with_object({}, &block)
1
+ module Nokogiri
2
+ module XML
3
+ class Document
4
+ def reqt_iter(&block)
5
+ xpath("//xmlns:requirement | //xmlns:recommendation | //xmlns:permission")
6
+ .each_with_object({}, &block)
7
+ end
8
+ end
5
9
  end
6
10
  end
7
11
 
@@ -54,17 +58,13 @@ module Metanorma
54
58
  end
55
59
 
56
60
  def recommendation_class_label(node)
61
+ node["class"] and return node["class"]
57
62
  case node["type"]
58
- when "verification" then @labels["modspec"]["conformancetest"]
59
63
  when "class" then @labels["modspec"]["#{node.name}class"]
60
- when "abstracttest" then @labels["modspec"]["abstracttest"]
61
- when "conformanceclass" then @labels["modspec"]["conformanceclass"]
62
- else
63
- case node.name
64
- when "recommendation" then @labels["default"]["recommendation"]
65
- when "requirement" then @labels["default"]["requirement"]
66
- when "permission" then @labels["default"]["permission"]
67
- end
64
+ when "verification" then @labels["modspec"]["conformancetest"]
65
+ when "abstracttest", "conformanceclass"
66
+ @labels["modspec"][node["type"]]
67
+ else @labels["default"][node.name]
68
68
  end
69
69
  end
70
70
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  class Requirements
3
- VERSION = "0.4.0".freeze
3
+ VERSION = "0.4.1".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.4.0
4
+ version: 0.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: 2024-08-06 00:00:00.000000000 Z
11
+ date: 2024-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isodoc-i18n
@@ -226,6 +226,7 @@ files:
226
226
  - lib/isodoc-yaml/i18n-en.yaml
227
227
  - lib/isodoc-yaml/i18n-es.yaml
228
228
  - lib/isodoc-yaml/i18n-fr.yaml
229
+ - lib/isodoc-yaml/i18n-ja.yaml
229
230
  - lib/isodoc-yaml/i18n-ru.yaml
230
231
  - lib/isodoc-yaml/i18n-zh-Hans.yaml
231
232
  - lib/isodoc/i18n.rb