mn-requirements 0.1.6 → 0.1.8
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/.github/workflows/release.yml +3 -0
- data/Gemfile +0 -1
- data/lib/metanorma/default/isodoc.rb +6 -5
- data/lib/metanorma/modspec/cleanup.rb +10 -2
- data/lib/metanorma/modspec/isodoc.rb +5 -5
- data/lib/metanorma/modspec/reqt_label.rb +1 -1
- data/lib/metanorma/modspec/validate.rb +5 -3
- data/lib/metanorma/modspec/xrefs.rb +3 -3
- data/lib/metanorma/requirements/selector.rb +4 -2
- data/lib/metanorma/requirements/version.rb +1 -1
- data/mn-requirements.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 241d16930a4f1ea42bad8fb33599eae423582f76111dbf64272afb20141b69ea
|
4
|
+
data.tar.gz: 63c1107edba65cade52ddd9bda6af1fac1e02540ab2f2904a9e6c1af264f4e3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d33e761d47985154817ac6334406771946fc1dc88c6fb38a1a76f0db7d0c43beb5bd316bfe5bcf2c5aab7a2bb1c9953e3e4a544ca354b8e4f08a004e3bc14a87
|
7
|
+
data.tar.gz: d276f8e75000218b83442b3c8daa76d43f295b2781488fba401cffc6ec92b76f9fe27313f16135392c40a793f216ec6701e03b45c6d6cbe983d44678bc718b59
|
@@ -18,6 +18,9 @@ jobs:
|
|
18
18
|
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
19
19
|
with:
|
20
20
|
next_version: ${{ github.event.inputs.next_version }}
|
21
|
+
release_command: rake release
|
22
|
+
bundler_cache: false
|
23
|
+
post_install: gem install bundler rake rspec
|
21
24
|
secrets:
|
22
25
|
rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
|
23
26
|
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
data/Gemfile
CHANGED
@@ -45,12 +45,12 @@ module Metanorma
|
|
45
45
|
label, title, name = recommendation_labels(node)
|
46
46
|
ret = name ? [name] : []
|
47
47
|
if label || title
|
48
|
-
ret <<
|
48
|
+
ret << ":" unless ret.empty?
|
49
49
|
ret += ["<br/>", label]
|
50
|
-
ret <<
|
50
|
+
ret << ". " if label && title
|
51
51
|
ret << title
|
52
52
|
end
|
53
|
-
out << "<name>#{ret.compact.join}</name>"
|
53
|
+
out << "<name>#{l10n(ret.compact.join)}</name>"
|
54
54
|
out
|
55
55
|
end
|
56
56
|
|
@@ -70,13 +70,14 @@ module Metanorma
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def recommendation_attr_parse(node, label)
|
73
|
-
"#{label}: #{node.children.to_xml}"
|
73
|
+
l10n("#{label}: #{node.children.to_xml}")
|
74
74
|
end
|
75
75
|
|
76
76
|
def recommendation_attr_keyvalue(node, key, value)
|
77
77
|
tag = node.at(ns("./#{key}")) or return nil
|
78
78
|
value = node.at(ns("./#{value}")) or return nil
|
79
|
-
"#{tag.text
|
79
|
+
l10n("#{Metanorma::Utils.strict_capitalize_first tag.text}: "\
|
80
|
+
"#{value.children.to_xml}")
|
80
81
|
end
|
81
82
|
|
82
83
|
def recommendation_attributes(node, out)
|
@@ -49,9 +49,17 @@ module Metanorma
|
|
49
49
|
requirement_metadata1(val, d, d)
|
50
50
|
d.remove
|
51
51
|
end
|
52
|
-
requirement_metadata_requirement_tags.include?(term.text)
|
53
|
-
|
52
|
+
requirement_metadata_requirement_tags.include?(term.text) or
|
53
|
+
return val
|
54
|
+
requirement_metadata1_component_val2id(val)
|
55
|
+
end
|
56
|
+
|
57
|
+
def requirement_metadata1_component_val2id(val)
|
58
|
+
if val.at(".//link") && val.text.strip.empty?
|
59
|
+
val.children = "<identifier>#{val.at('.//link')['target']}</identifier>"
|
60
|
+
elsif !val.text.strip.empty?
|
54
61
|
val.children = "<identifier>#{val.text.strip}</identifier>"
|
62
|
+
end
|
55
63
|
val
|
56
64
|
end
|
57
65
|
|
@@ -7,7 +7,7 @@ module Metanorma
|
|
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
|
+
requirement_table_cleanup(node, ret)
|
11
11
|
end
|
12
12
|
|
13
13
|
def recommendation_base(node, _klass)
|
@@ -52,9 +52,9 @@ module Metanorma
|
|
52
52
|
return ret unless title &&
|
53
53
|
node.ancestors("requirement, recommendation, permission").empty?
|
54
54
|
|
55
|
-
ret +=
|
55
|
+
ret += ": " unless !name || name.text.empty?
|
56
56
|
ret += title.children.to_xml
|
57
|
-
ret
|
57
|
+
l10n(ret)
|
58
58
|
end
|
59
59
|
|
60
60
|
def recommendation_attributes(node, out)
|
@@ -152,7 +152,7 @@ module Metanorma
|
|
152
152
|
tag = node.at(ns("./#{key}")) or return nil
|
153
153
|
value = node.at(ns("./#{value}")) or return nil
|
154
154
|
!%w(target indirect-dependency).include?(tag.text) or return nil
|
155
|
-
[tag.text
|
155
|
+
[Metanorma::Utils.strict_capitalize_first(tag.text), value.children]
|
156
156
|
end
|
157
157
|
|
158
158
|
def reqt_component_type(node)
|
@@ -197,7 +197,7 @@ module Metanorma
|
|
197
197
|
out
|
198
198
|
end
|
199
199
|
|
200
|
-
def requirement_table_cleanup(table)
|
200
|
+
def requirement_table_cleanup(_node, table)
|
201
201
|
table.xpath(ns("./tbody/tr/td/table")).each do |t|
|
202
202
|
x = t.at(ns("./thead/tr")) or next
|
203
203
|
t.parent.parent.replace(x)
|
@@ -48,7 +48,7 @@ module Metanorma
|
|
48
48
|
|
49
49
|
def recommendation_class_label(node)
|
50
50
|
case node["type"]
|
51
|
-
when "verification" then @labels["modspec"]["
|
51
|
+
when "verification" then @labels["modspec"]["conformancetest"]
|
52
52
|
when "class" then @labels["modspec"]["#{node.name}class"]
|
53
53
|
when "abstracttest" then @labels["modspec"]["abstracttest"]
|
54
54
|
when "conformanceclass" then @labels["modspec"]["conformanceclass"]
|
@@ -27,6 +27,7 @@ module Metanorma
|
|
27
27
|
def type2validate(reqt)
|
28
28
|
type = reqt["type"]
|
29
29
|
type = "general" if type.nil? || type.empty?
|
30
|
+
type = "verification" if type == "abstracttest"
|
30
31
|
type
|
31
32
|
end
|
32
33
|
|
@@ -48,7 +49,7 @@ module Metanorma
|
|
48
49
|
|
49
50
|
r = @ids[:id][reqt["id"]]
|
50
51
|
(r[:label] && @ids[:class][confclass]&.any? do |x|
|
51
|
-
x[:subject]
|
52
|
+
x[:subject].include?(r[:label])
|
52
53
|
end) and return
|
53
54
|
log_reqt(r, reqtclass, confclass)
|
54
55
|
end
|
@@ -58,7 +59,7 @@ module Metanorma
|
|
58
59
|
|
59
60
|
r = @ids[:id][reqt["id"]]
|
60
61
|
(r[:subject] && @ids[:class][reqtclass]&.any? do |x|
|
61
|
-
r[:subject]
|
62
|
+
r[:subject].include?(x[:label])
|
62
63
|
end) and return
|
63
64
|
log_reqt(r, confclass, reqtclass)
|
64
65
|
end
|
@@ -100,7 +101,8 @@ module Metanorma
|
|
100
101
|
|
101
102
|
def reqt_links_struct(reqt)
|
102
103
|
{ id: reqt["id"], elem: reqt, label: reqt.at("./identifier")&.text,
|
103
|
-
subject: reqt.
|
104
|
+
subject: reqt.xpath("./classification[tag = 'target']/value")
|
105
|
+
.map(&:text),
|
104
106
|
child: reqt.xpath("./requirement | ./recommendation | ./permission")
|
105
107
|
.map do |r|
|
106
108
|
r.at("./identifier")&.text
|
@@ -9,11 +9,11 @@ module Metanorma
|
|
9
9
|
xpath: "requirement[@type = 'class']" },
|
10
10
|
{ klass: "recommendationclass", label: @labels["modspec"]["recommendationclass"],
|
11
11
|
xpath: "recommendation[@type = 'class']" },
|
12
|
-
{ klass: "permissiontest", label: @labels["modspec"]["
|
12
|
+
{ klass: "permissiontest", label: @labels["modspec"]["conformancetest"],
|
13
13
|
xpath: "permission[@type = 'verification']" },
|
14
|
-
{ klass: "recommendationtest", label: @labels["modspec"]["
|
14
|
+
{ klass: "recommendationtest", label: @labels["modspec"]["conformancetest"],
|
15
15
|
xpath: "recommendation[@type = 'verification']" },
|
16
|
-
{ klass: "requirementtest", label: @labels["modspec"]["
|
16
|
+
{ klass: "requirementtest", label: @labels["modspec"]["conformancetest"],
|
17
17
|
xpath: "requirement[@type = 'verification']" },
|
18
18
|
{ klass: "abstracttest", label: @labels["modspec"]["abstracttest"],
|
19
19
|
xpath: "permission[@type = 'abstracttest']" },
|
@@ -13,6 +13,7 @@ module Metanorma
|
|
13
13
|
@default = options[:default]
|
14
14
|
@i18n = i18n_klass(options[:lang] || "en",
|
15
15
|
options[:script] || "Latn",
|
16
|
+
options[:locale],
|
16
17
|
options[:i18nhash])
|
17
18
|
@labels = @i18n.get.deep_merge(options[:labels] || {})["requirements"]
|
18
19
|
@models =
|
@@ -23,8 +24,9 @@ module Metanorma
|
|
23
24
|
%i[default ogc]
|
24
25
|
end
|
25
26
|
|
26
|
-
def i18n_klass(lang
|
27
|
-
::IsoDoc::MnRequirementsI18n.new(lang, script,
|
27
|
+
def i18n_klass(lang, script, locale = nil, i18nhash = nil)
|
28
|
+
::IsoDoc::MnRequirementsI18n.new(lang, script, locale: locale,
|
29
|
+
i18nhash: i18nhash)
|
28
30
|
end
|
29
31
|
|
30
32
|
# all roles that can be assigned to an example to make it a reqt,
|
data/mn-requirements.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
26
26
|
|
27
|
-
spec.add_dependency "isodoc-i18n", "~> 1.
|
27
|
+
spec.add_dependency "isodoc-i18n", "~> 1.1.2"
|
28
28
|
spec.add_dependency "metanorma-utils", "~> 1.4.0"
|
29
29
|
|
30
30
|
spec.add_development_dependency "debug"
|
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.8
|
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-
|
11
|
+
date: 2022-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: isodoc-i18n
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.1.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.1.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: metanorma-utils
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|