metanorma-iso 3.1.0 → 3.1.2

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.
@@ -18,15 +18,15 @@ module Metanorma
18
18
  \\b
19
19
  REGEXP
20
20
 
21
- def requirement_re
22
- Regexp.new(self.class::REQUIREMENT_RE_STR.gsub(/\s/, "")
23
- .gsub("_", "\\s"), Regexp::IGNORECASE)
21
+ def str_to_regexp(str)
22
+ Regexp.new(str.gsub(/\s/, "").gsub("_", "\\s"), Regexp::IGNORECASE)
24
23
  end
25
24
 
26
25
  def requirement_check(text)
27
26
  @lang == "en" or return
28
- text.split(/\.\s+/).each do |t|
29
- return t if requirement_re.match t
27
+ re = str_to_regexp(self.class::REQUIREMENT_RE_STR)
28
+ text.gsub(/\s+/, " ").split(/\.\s+/).each do |t|
29
+ return t if re.match t
30
30
  end
31
31
  nil
32
32
  end
@@ -39,15 +39,11 @@ module Metanorma
39
39
  \\b
40
40
  REGEXP
41
41
 
42
- def recommendation_re
43
- Regexp.new(self.class::RECOMMENDATION_RE_STR.gsub(/\s/, "")
44
- .gsub("_", "\\s"), Regexp::IGNORECASE)
45
- end
46
-
47
42
  def recommendation_check(text)
48
43
  @lang == "en" or return
49
- text.split(/\.\s+/).each do |t|
50
- return t if recommendation_re.match t
44
+ re = str_to_regexp(self.class::RECOMMENDATION_RE_STR)
45
+ text.gsub(/\s+/, " ").split(/\.\s+/).each do |t|
46
+ return t if re.match t
51
47
  end
52
48
  nil
53
49
  end
@@ -61,15 +57,11 @@ module Metanorma
61
57
  \\b
62
58
  REGEXP
63
59
 
64
- def permission_re
65
- @lang == "en" or return
66
- Regexp.new(self.class::PERMISSION_RE_STR.gsub(/\s/, "")
67
- .gsub("_", "\\s"), Regexp::IGNORECASE)
68
- end
69
-
70
60
  def permission_check(text)
71
- text.split(/\.\s+/).each do |t|
72
- return t if permission_re.match t
61
+ @lang == "en" or return
62
+ re = str_to_regexp(self.class::PERMISSION_RE_STR)
63
+ text.gsub(/\s+/, " ").split(/\.\s+/).each do |t|
64
+ return t if re.match t
73
65
  end
74
66
  nil
75
67
  end
@@ -84,14 +76,10 @@ module Metanorma
84
76
  \\b
85
77
  REGEXP
86
78
 
87
- def possibility_re
88
- @lang == "en" or return
89
- Regexp.new(self.class::POSSIBILITY_RE_STR.gsub(/\s/, "")
90
- .gsub("_", "\\s"), Regexp::IGNORECASE)
91
- end
92
-
93
79
  def possibility_check(text)
94
- text.split(/\.\s+/).each { |t| return t if possibility_re.match t }
80
+ @lang == "en" or return
81
+ re = str_to_regexp(self.class::POSSIBILITY_RE_STR)
82
+ text.gsub(/\s+/, " ").split(/\.\s+/).each { |t| return t if re.match t }
95
83
  nil
96
84
  end
97
85
 
@@ -103,21 +91,31 @@ module Metanorma
103
91
  end
104
92
 
105
93
  AMBIG_WORDS_RE_STR = <<~REGEXP.freeze
106
- \\b
107
- need_to | needs_to | might | could
108
- \\b
94
+ \\b(
95
+ need_to | needs_to | might | could | family_of_standards | suite_of_standards
96
+ )\\b
109
97
  REGEXP
110
98
 
111
- def ambig_words_re
99
+ def ambig_words_check(text)
112
100
  @lang == "en" or return
113
- Regexp.new(self.class::AMBIG_WORDS_RE_STR.gsub(/\s/, "")
114
- .gsub("_", "\\s"), Regexp::IGNORECASE)
101
+ re = str_to_regexp(self.class::AMBIG_WORDS_RE_STR)
102
+ text.gsub(/\s+/, " ").split(/\.\s+/).each do |t|
103
+ return t if re.match t
104
+ end
105
+ nil
115
106
  end
116
107
 
117
- def ambig_words_check(text)
108
+ MISSPELLED_WORDS_RE_STR = <<~REGEXP.freeze
109
+ \\b(
110
+ on-line | cyber_security | cyber-security
111
+ )\\b
112
+ REGEXP
113
+
114
+ def misspelled_words_check(text)
118
115
  @lang == "en" or return
119
- text.split(/\.\s+/).each do |t|
120
- return t if ambig_words_re.match t
116
+ re = str_to_regexp(self.class::MISSPELLED_WORDS_RE_STR)
117
+ text.gsub(/\s+/, " ").split(/\.\s+/).each do |t|
118
+ return t if re.match t
121
119
  end
122
120
  nil
123
121
  end
@@ -91,7 +91,7 @@ module Metanorma
91
91
  style_units(node, text)
92
92
  style_punct(node, text)
93
93
  style_subscript(node)
94
- style_ambig_words(node, text)
94
+ style_problem_words(node, text)
95
95
  end
96
96
 
97
97
  # https://www.iso.org/ISO-house-style.html#iso-hs-s-text-r-s-quantity
@@ -107,12 +107,17 @@ module Metanorma
107
107
 
108
108
  # https://www.iso.org/ISO-house-style.html#iso-hs-s-text-r-s-need
109
109
  # https://www.iso.org/ISO-house-style.html#iso-hs-s-text-r-s-might
110
- def style_ambig_words(node, text)
110
+ # https://www.iso.org/ISO-house-style.html#iso-hs-s-text-r-s-family
111
+ # https://www.iso.org/ISO-house-style.html#iso-hs-s-text-r-s-it
112
+ # https://www.iso.org/ISO-house-style.html#iso-hs-s-text-r-p-use-of
113
+ def style_problem_words(node, text)
111
114
  r = ambig_words_check(text) and
112
115
  style_warning(node, "may contain ambiguous provision", r,
113
116
  display: false)
114
- @lang == "en" and style_regex(/\b(?<num>billions?)\b/i,
115
- "ambiguous number", node, text)
117
+ r = misspelled_words_check(text) and
118
+ style_warning(node, "dispreferred spelling", r,
119
+ display: false)
120
+ style_regex(/\b(?<num>billions?)\b/i, "ambiguous number", node, text)
116
121
  end
117
122
 
118
123
  # ISO/IEC DIR 2, 9.1
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Iso
3
- VERSION = "3.1.0".freeze
3
+ VERSION = "3.1.2".freeze
4
4
  end
5
5
  end
@@ -25,7 +25,7 @@ template:
25
25
  manual: book
26
26
  techreport: book
27
27
  proceedings: book
28
- inbook: "{{ creatornames | selective_upcase }}. ({{role}}) {{ title }} . <em>{{host_title}}</em> ({{host_role}} {{ host_creatornames | replace: '+++', ''}}.) . {{ edition | capitalize_first }}. ({{ series }}). {% if place %}{{place}}:{%endif%} {{publisher}}. {{date}}. {{size}}. {{extent}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
28
+ inbook: "{{ creatornames | selective_upcase }}. ({{role}}) {{ title }} . <em>{{host_title}}</em> ({{host_role}} {{ host_creatornames | replace: '+++', ''}}) . {{ edition | capitalize_first }}. ({{ series }}). {% if place %}{{place}}:{%endif%} {{publisher}}. {{date}}. {{size}}. {{extent}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
29
29
  inproceedings: inbook
30
30
  incollection: inbook
31
31
  journal: "<em>{{ title}}</em> . {{ edition | capitalize_first }}. {{place}}: {{publisher}}. {{date}}. {{size}}. {{extent}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
@@ -50,5 +50,5 @@ spec.add_development_dependency "rubocop-performance"
50
50
  spec.add_development_dependency "simplecov", "~> 0.15"
51
51
  spec.add_development_dependency "timecop", "~> 0.9"
52
52
  spec.add_development_dependency "webmock"
53
- spec.add_development_dependency "xml-c14n"
53
+ spec.add_development_dependency "canon"
54
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-05 00:00:00.000000000 Z
11
+ date: 2025-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -249,7 +249,7 @@ dependencies:
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
251
  - !ruby/object:Gem::Dependency
252
- name: xml-c14n
252
+ name: canon
253
253
  requirement: !ruby/object:Gem::Requirement
254
254
  requirements:
255
255
  - - ">="