metanorma-iso 3.0.10 → 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.
@@ -29,13 +29,13 @@ module IsoDoc
29
29
  def warning_for_missing_metadata_post(docxml, ret)
30
30
  from = docxml.at(ns("//sections/*/@id"))&.text or return
31
31
  ret = <<~REVIEW
32
- <review date='#{Date.today}' reviewer='Metanorma' #{add_id_text} from='#{from}' to='#{from}'>
32
+ <annotation date='#{Date.today}' reviewer='Metanorma' #{add_id_text} from='#{from}' to='#{from}'>
33
33
  <p><strong>Metadata warnings:</strong></p> #{ret}
34
- </review>
34
+ </annotation>
35
35
  REVIEW
36
- unless ins = docxml.at(ns("//review-container"))
37
- docxml.root << "<review-container></review-container>"
38
- ins = docxml.at(ns("//review-container"))
36
+ unless ins = docxml.at(ns("//annotation-container"))
37
+ docxml.root << "<annotation-container></annotation-container>"
38
+ ins = docxml.at(ns("//annotation-container"))
39
39
  end
40
40
  ins.add_first_child ret
41
41
  end
@@ -139,7 +139,7 @@ module IsoDoc
139
139
  end
140
140
 
141
141
  def table1_fmt_xref_modspec(elem)
142
- p = elem.parent.parent.at(ns("./fmt-xref-label"))
142
+ p = elem.parent.parent.at(ns("./fmt-xref-label")) or return
143
143
  t = elem.at(ns("./fmt-xref-label"))&.remove or return
144
144
  n = t.at(ns("./span[@class='fmt-element-name'][2]")) or return
145
145
  while i = n.next
@@ -123,6 +123,7 @@ module IsoDoc
123
123
 
124
124
  def authority_copyright_style(auth)
125
125
  auth.xpath(".//p[not(@class)]").each { |p| p["class"] = "zzCopyright" }
126
+ auth.xpath(".//p[@class = 'Tablebody']").each { |p| p["class"] = "zzCopyright" }
126
127
  auth.xpath(".//p[@id = 'boilerplate-message']").each do |p|
127
128
  p["class"] = "zzCopyright1"
128
129
  end
@@ -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
@@ -65,9 +65,9 @@ module Metanorma
65
65
  end
66
66
 
67
67
  def ol_attrs(node)
68
- attr_code(keep_attrs(node).merge(id_attr(node))
69
- .merge("explicit-type": olist_style(node.attributes[1]),
70
- start: node.attr("start")))
68
+ ret = super
69
+ ret.delete(:type)
70
+ ret
71
71
  end
72
72
 
73
73
  def admonition_name(node)
@@ -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>
@@ -33,6 +33,9 @@ module Metanorma
33
33
  end
34
34
 
35
35
  def ol_cleanup(doc)
36
+ doc.xpath("//ol[@type]").each do |x|
37
+ x.delete("type")
38
+ end
36
39
  doc.xpath("//ol[@explicit-type]").each do |x|
37
40
  x["type"] = x["explicit-type"]
38
41
  x.delete("explicit-type")
@@ -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.7 -->
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
@@ -72,6 +72,46 @@ but to `@anchor`, the user-supplied cross-reference</a:documentation>
72
72
  </oneOrMore>
73
73
  </element>
74
74
  </define>
75
+ <define name="review">
76
+ <a:documentation>Generalise BasicDoc element from just review comments, to general annotations;
77
+ the type attribute defaults to `review` for reviews</a:documentation>
78
+ <element name="annotation">
79
+ <ref name="RequiredId"/>
80
+ <ref name="ReviewAttributes"/>
81
+ <oneOrMore>
82
+ <ref name="paragraph">
83
+ <a:documentation>Reviewer comments content</a:documentation>
84
+ </ref>
85
+ </oneOrMore>
86
+ </element>
87
+ </define>
88
+ <define name="ruby_pronunciation">
89
+ <a:documentation>Ruby annotation giving pronunciation of text: change tag from BasicDoc for disambiguation</a:documentation>
90
+ <element name="ruby-pronunciation">
91
+ <attribute name="value">
92
+ <a:documentation>Ruby annotation value</a:documentation>
93
+ </attribute>
94
+ <ref name="LocalizedStringAttributes"/>
95
+ </element>
96
+ </define>
97
+ <define name="ruby_annotation">
98
+ <a:documentation>Ruby annotation giving information other than pronunciation of text: change tag from BasicDoc for disambiguation</a:documentation>
99
+ <element name="ruby-annotation">
100
+ <attribute name="value">
101
+ <a:documentation>Ruby annotation value</a:documentation>
102
+ </attribute>
103
+ <ref name="LocalizedStringAttributes"/>
104
+ </element>
105
+ </define>
106
+ <define name="annotation">
107
+ <a:documentation>Source code annotation, corresponding to a callout</a:documentation>
108
+ <element name="callout-annotation">
109
+ <ref name="RequiredId"/>
110
+ <oneOrMore>
111
+ <ref name="paragraph"/>
112
+ </oneOrMore>
113
+ </element>
114
+ </define>
75
115
  <define name="section-title">
76
116
  <a:documentation>Title(s) of a clause</a:documentation>
77
117
  <element name="title">
@@ -540,7 +580,7 @@ normative or informative references, some split references into sections organiz
540
580
  <ref name="OptionalId"/>
541
581
  <optional>
542
582
  <attribute name="style">
543
- <a:documentation>CSS style: only background-color supported</a:documentation>
583
+ <a:documentation>CSS style: only background-color, color, border supported</a:documentation>
544
584
  </attribute>
545
585
  </optional>
546
586
  </define>
@@ -620,7 +660,7 @@ This is done if the footnote reference is already presented in some other form,
620
660
  <ref name="RequiredId"/>
621
661
  <optional>
622
662
  <attribute name="style">
623
- <a:documentation>CSS style: only background-color supported</a:documentation>
663
+ <a:documentation>CSS style: only background-color, color, border supported</a:documentation>
624
664
  </attribute>
625
665
  </optional>
626
666
  </define>
@@ -695,11 +735,22 @@ titlecase, or lowercase</a:documentation>
695
735
  <ref name="BlockAttributes"/>
696
736
  </define>
697
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>
698
744
  <optional>
699
745
  <attribute name="width">
700
746
  <a:documentation>Width of the table block in rendering</a:documentation>
701
747
  </attribute>
702
748
  </optional>
749
+ <optional>
750
+ <attribute name="style">
751
+ <a:documentation>CSS style: only background-color, color, border supported</a:documentation>
752
+ </attribute>
753
+ </optional>
703
754
  <ref name="BlockAttributes"/>
704
755
  </define>
705
756
  <define name="FigureAttributes" combine="interleave">
@@ -1417,7 +1468,7 @@ numbers</a:documentation>
1417
1468
  </optional>
1418
1469
  <ref name="DocumentBody"/>
1419
1470
  <optional>
1420
- <ref name="review-container">
1471
+ <ref name="annotation-container">
1421
1472
  <a:documentation>Annotations to the document</a:documentation>
1422
1473
  </ref>
1423
1474
  </optional>
@@ -1461,8 +1512,8 @@ numbers</a:documentation>
1461
1512
  </oneOrMore>
1462
1513
  </element>
1463
1514
  </define>
1464
- <define name="review-container">
1465
- <element name="review-container">
1515
+ <define name="annotation-container">
1516
+ <element name="annotation-container">
1466
1517
  <oneOrMore>
1467
1518
  <ref name="review"/>
1468
1519
  </oneOrMore>
@@ -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.0.10".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.0.10
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-06-23 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