metanorma-iso 3.1.0 → 3.1.1

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.
@@ -48,7 +48,6 @@ module IsoDoc
48
48
  c = IsoDoc::XrefGen::Counter.new
49
49
  clause.xpath(ns(".//formula")).noblank.each do |t|
50
50
  @anchors[t["id"]] = anchor_struct(
51
- #"#{num}#{hier_separator}#{c.increment(t).print}", t,
52
51
  hiersemx(clause, num, c.increment(t), t), t,
53
52
  t["inequality"] ? @labels["inequality"] : @labels["formula"],
54
53
  "formula", { unnumb: t["unnumbered"], container: true }
@@ -86,8 +85,8 @@ module IsoDoc
86
85
  @anchors[elem["id"]][:label] = sublabel
87
86
  @anchors[elem["id"]][:xref] = @anchors[elem.parent["id"]][:xref] +
88
87
  " " + semx(elem, sublabel) + delim_wrap(subfigure_delim)
89
- x = @anchors[elem.parent["id"]][:container] and
90
- @anchors[elem["id"]][:container] = x
88
+ x = @anchors[elem.parent["id"]][:container] and
89
+ @anchors[elem["id"]][:container] = x
91
90
  end
92
91
  end
93
92
 
@@ -128,7 +127,6 @@ module IsoDoc
128
127
  j = 0
129
128
  clause.xpath(ns(FIGURE_NO_CLASS)).noblank.each do |t|
130
129
  j = subfigure_increment(j, c, t)
131
- #label = "#{num}#{hier_separator}#{c.print}"
132
130
  sublabel = subfigure_label(j)
133
131
  figure_anchor(t, sublabel, hiersemx(clause, num, c, t), "figure")
134
132
  end
@@ -142,9 +140,9 @@ module IsoDoc
142
140
  .noblank.each do |t|
143
141
  c[t["class"]] ||= IsoDoc::XrefGen::Counter.new
144
142
  j = subfigure_increment(j, c[t["class"]], t)
145
- #label = "#{num}#{hier_separator}#{c.print}"
146
143
  sublabel = j.zero? ? nil : "#{(j + 96).chr})"
147
- figure_anchor(t, sublabel, hiersemx(clause, num, c[t["class"]], t), t["class"])
144
+ figure_anchor(t, sublabel, hiersemx(clause, num, c[t["class"]], t),
145
+ t["class"])
148
146
  end
149
147
  end
150
148
 
@@ -160,7 +158,7 @@ module IsoDoc
160
158
  s.xpath(ns(".//appendix//ol")) - s.xpath(ns(".//ol//ol"))
161
159
  c = Counter.new
162
160
  notes.noblank.each do |n|
163
- #n["id"] ||= "_#{UUIDTools::UUID.random_create}"
161
+ # n["id"] ||= "_#{UUIDTools::UUID.random_create}"
164
162
  @anchors[n["id"]] = anchor_struct(increment_label(notes, n, c), n,
165
163
  @labels["list"], "list",
166
164
  { unnumb: false, container: true })
@@ -197,22 +195,20 @@ module IsoDoc
197
195
  end
198
196
 
199
197
  def modspec_table_components_xrefs(table, table_label, container: false)
200
- table.xpath(ns(".//tr[@id] | .//td[@id] | .//bookmark[@id]")).each do |tr|
198
+ table
199
+ .xpath(ns(".//tr[@id] | .//td[@id] | .//bookmark[@id]")).each do |tr|
201
200
  xref_to_modspec(tr["id"], table_label) or next
202
201
  container or @anchors[tr["id"]].delete(:container)
203
202
  end
204
203
  end
205
204
 
206
205
  def xref_to_modspec(id, table_label)
207
- #(@anchors[id] && !@anchors[id][:has_modspec]) or return
206
+ # (@anchors[id] && !@anchors[id][:has_modspec]) or return
208
207
  (@anchors[id] && !@anchors[id][:has_table_prefix]) or return
209
208
  @anchors[id][:has_table_prefix] = true
210
209
  x = @anchors_previous[id][:xref_bare] || @anchors_previous[id][:xref]
211
- # @anchors[id][:xref] = l10n("#{table_label}<span class='fmt-comma'>,</span> #{x}")
212
-
213
210
  @anchors[id][:xref] = l10n(@klass.connectives_spans(@i18n.nested_xref
214
211
  .sub("%1", table_label).sub("%2", x)))
215
-
216
212
  @anchors[id][:modspec] = @anchors_previous[id][:modspec]
217
213
  @anchors[id][:subtype] = "modspec" # prevents citetbl style from beign applied
218
214
  true
@@ -198,14 +198,14 @@ Applicable to modify and delete</a:documentation>
198
198
  </zeroOrMore>
199
199
  </element>
200
200
  </optional>
201
- <optional>
201
+ <zeroOrMore>
202
202
  <element name="description">
203
- <a:documentation>Description of the change described in this block</a:documentation>
204
- <zeroOrMore>
203
+ <a:documentation>Description(s) of the change described in this block</a:documentation>
204
+ <oneOrMore>
205
205
  <ref name="BasicBlock"/>
206
- </zeroOrMore>
206
+ </oneOrMore>
207
207
  </element>
208
- </optional>
208
+ </zeroOrMore>
209
209
  <optional>
210
210
  <element name="newcontent">
211
211
  <a:documentation>New content to be added to the document; applicable to add and modify</a:documentation>
@@ -187,9 +187,6 @@ module Metanorma
187
187
 
188
188
  def iso_id_default(params)
189
189
  params_nolang = params.dup.tap { |hs| hs.delete(:language) }
190
- #params1 = if params[:unpublished]
191
- #params_nolang.dup.tap { |hs| hs.delete(:year) }
192
- #else params_nolang end
193
190
  params1 = params_nolang
194
191
  params1.delete(:unpublished)
195
192
  pubid_select(params1).create(**params1)
@@ -205,9 +202,6 @@ module Metanorma
205
202
  end
206
203
 
207
204
  def iso_id_with_lang(params)
208
- #params1 = if params[:unpublished]
209
- #params.dup.tap { |hs| hs.delete(:year) }
210
- #else params end
211
205
  params1 = params
212
206
  params1.delete(:unpublished)
213
207
  pubid_select(params1).create(**params1)
@@ -220,7 +214,7 @@ module Metanorma
220
214
 
221
215
  def structured_id(node, xml)
222
216
  node.attr("docnumber") or return
223
- part, subpart = node&.attr("partnumber")&.split("-")
217
+ part, subpart = node.attr("partnumber")&.split("-")
224
218
  xml.structuredidentifier do |i|
225
219
  i.project_number(node.attr("docnumber"), **attr_code(
226
220
  part:, subpart:,
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!-- VERSION v2.0.8 -->
3
+ <!-- VERSION v2.1.0 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -735,6 +735,12 @@ titlecase, or lowercase</a:documentation>
735
735
  <ref name="BlockAttributes"/>
736
736
  </define>
737
737
  <define name="TableAttributes" combine="interleave">
738
+ <optional>
739
+ <attribute name="plain">
740
+ <a:documentation>Render as a plain attribute, with no shading or borders</a:documentation>
741
+ <data type="boolean"/>
742
+ </attribute>
743
+ </optional>
738
744
  <optional>
739
745
  <attribute name="width">
740
746
  <a:documentation>Width of the table block in rendering</a:documentation>
@@ -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.1".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}}]."
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.1
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-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc