metanorma-itu 2.2.3 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,7 +46,7 @@ module Metanorma
46
46
  ins = xml.at("//sections").elements.first
47
47
  xml.at("//sections/clause[@type = 'scope']") or
48
48
  ins.previous =
49
- "<clause type='scope' #{add_id}><title>#{@i18n.scope}</title><p>"\
49
+ "<clause type='scope' #{add_id}><title>#{@i18n.scope}</title><p>" \
50
50
  "#{@i18n.clause_empty}</p></clause>"
51
51
  xml&.at("//sentinel")&.remove
52
52
  end
@@ -57,7 +57,7 @@ module Metanorma
57
57
  "<bibliography><sentinel/></bibliography>"
58
58
  ins = xml.at("//bibliography").elements.first
59
59
  xml.at("//bibliography/references[@normative = 'true']") or
60
- ins.previous = "<references #{add_id} normative='true'>"\
60
+ ins.previous = "<references #{add_id} normative='true'>" \
61
61
  "<title>#{@i18n.normref}</title></references>"
62
62
  xml&.at("//sentinel")&.remove
63
63
  end
@@ -72,7 +72,7 @@ module Metanorma
72
72
  ins = xml.at("//sections/terms") ||
73
73
  xml.at("//sections/clause[descendant::terms]")
74
74
  unless xml.at("//sections//definitions")
75
- ins.next = "<definitions #{add_id}>"\
75
+ ins.next = "<definitions #{add_id}>" \
76
76
  "<title>#{@i18n.symbolsabbrev}</title></definitions>"
77
77
  end
78
78
  end
@@ -81,8 +81,8 @@ module Metanorma
81
81
  ins = xml.at("//sections//definitions") ||
82
82
  xml.at("//sections/clause[descendant::definitions]")
83
83
  unless xml.at("//sections/clause[@type = 'conventions']")
84
- ins.next = "<clause #{add_id} type='conventions'>"\
85
- "<title>#{@i18n.conventions}</title><p>"\
84
+ ins.next = "<clause #{add_id} type='conventions'>" \
85
+ "<title>#{@i18n.conventions}</title><p>" \
86
86
  "#{@i18n.clause_empty}</p></clause>"
87
87
  end
88
88
  end
@@ -149,14 +149,14 @@ module Metanorma
149
149
  def section_names_terms_cleanup(xml)
150
150
  super
151
151
  replace_title(
152
- xml, "//terms[@type = 'internal'] | "\
153
- "//clause[./terms[@type = 'internal']]"\
152
+ xml, "//terms[@type = 'internal'] | " \
153
+ "//clause[./terms[@type = 'internal']]" \
154
154
  "[not(./terms[@type = 'external'])]",
155
155
  @i18n&.internal_termsdef
156
156
  )
157
157
  replace_title(
158
- xml, "//terms[@type = 'external'] | "\
159
- "//clause[./terms[@type = 'external']]"\
158
+ xml, "//terms[@type = 'external'] | " \
159
+ "//clause[./terms[@type = 'external']]" \
160
160
  "[not(./terms[@type = 'internal'])]",
161
161
  @i18n&.external_termsdef
162
162
  )
@@ -172,17 +172,16 @@ module Metanorma
172
172
 
173
173
  def pub_class(bib)
174
174
  return 1 if bib.at("#{PUBLISHER}[abbreviation = 'ITU']")
175
- return 1 if bib.at("#{PUBLISHER}[name = 'International "\
175
+ return 1 if bib.at("#{PUBLISHER}[name = 'International " \
176
176
  "Telecommunication Union']")
177
177
  return 2 if bib.at("#{PUBLISHER}[abbreviation = 'ISO']")
178
- return 2 if bib.at("#{PUBLISHER}[name = 'International Organization "\
178
+ return 2 if bib.at("#{PUBLISHER}[name = 'International Organization " \
179
179
  "for Standardization']")
180
180
  return 3 if bib.at("#{PUBLISHER}[abbreviation = 'IEC']")
181
- return 3 if bib.at("#{PUBLISHER}[name = 'International "\
181
+ return 3 if bib.at("#{PUBLISHER}[name = 'International " \
182
182
  "Electrotechnical Commission']")
183
- return 4 if bib.at("./docidentifier[@type][not(@type = 'DOI' or "\
184
- "@type = 'metanorma' or @type = 'ISSN' or @type = "\
185
- "'ISBN')]")
183
+ return 4 if bib.at("./docidentifier[@type][not(#{skip_docid} or " \
184
+ "@type = 'metanorma')]")
186
185
 
187
186
  5
188
187
  end
@@ -199,8 +198,8 @@ module Metanorma
199
198
  # then title
200
199
  def sort_biblio_key(bib)
201
200
  pubclass = pub_class(bib)
202
- id = bib&.at("./docidentifier[not(@type = 'DOI' or @type = "\
203
- "'metanorma' or @type = 'ISSN' or @type = 'ISBN')]")
201
+ id = bib&.at("./docidentifier[not(#{skip_docid} or @type = " \
202
+ "'metanorma')]")
204
203
  metaid = bib&.at("./docidentifier[@type = 'metanorma']")&.text
205
204
  abbrid = metaid unless /^\[\d+\]$/.match?(metaid)
206
205
  type = id["type"] if id
@@ -3,18 +3,25 @@ module Metanorma
3
3
  class Converter < Standoc::Converter
4
4
  def metadata_id(node, xml)
5
5
  provisional_id(node, xml)
6
+ td_id(node, xml)
6
7
  itu_id(node, xml)
7
8
  recommendation_id(node, xml)
8
9
  end
9
10
 
10
11
  def provisional_id(node, xml)
11
- return unless node.attr("provisional-name")
12
-
13
- xml.docidentifier **{ type: "ITU-provisional" } do |i|
12
+ node.attr("provisional-name") or return
13
+ xml.docidentifier type: "ITU-provisional" do |i|
14
14
  i << node.attr("provisional-name")
15
15
  end
16
16
  end
17
17
 
18
+ def td_id(node, xml)
19
+ node.attr("td-number") or return
20
+ xml.docidentifier type: "ITU-TemporaryDocument" do |i|
21
+ i << node.attr("td-number")
22
+ end
23
+ end
24
+
18
25
  ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S",
19
26
  "zh" => "C", "ru" => "R" }.freeze
20
27
 
@@ -32,10 +39,10 @@ module Metanorma
32
39
  def itu_id(node, xml)
33
40
  return unless node.attr("docnumber")
34
41
 
35
- xml.docidentifier **{ type: "ITU" } do |i|
42
+ xml.docidentifier type: "ITU" do |i|
36
43
  i << itu_id1(node, false)
37
44
  end
38
- xml.docidentifier **{ type: "ITU-lang" } do |i|
45
+ xml.docidentifier type: "ITU-lang" do |i|
39
46
  i << itu_id1(node, true)
40
47
  end
41
48
  xml.docnumber { |i| i << node.attr("docnumber") }
@@ -45,7 +52,7 @@ module Metanorma
45
52
  return unless node.attr("recommendationnumber")
46
53
 
47
54
  node.attr("recommendationnumber").split("/").each do |s|
48
- xml.docidentifier **{ type: "ITU-Recommendation" } do |i|
55
+ xml.docidentifier type: "ITU-Recommendation" do |i|
49
56
  i << s
50
57
  end
51
58
  end
@@ -66,6 +66,7 @@
66
66
  <value>caution</value>
67
67
  <value>statement</value>
68
68
  <value>editorial</value>
69
+ <value>box</value>
69
70
  </choice>
70
71
  </define>
71
72
  <define name="index">
@@ -571,6 +572,11 @@
571
572
  <ref name="MultilingualRenderingType"/>
572
573
  </attribute>
573
574
  </optional>
575
+ <optional>
576
+ <attribute name="linenums">
577
+ <data type="boolean"/>
578
+ </attribute>
579
+ </optional>
574
580
  <optional>
575
581
  <ref name="tname"/>
576
582
  </optional>
@@ -1575,7 +1581,7 @@
1575
1581
  </element>
1576
1582
  </define>
1577
1583
  <define name="misccontainer">
1578
- <element name="misc-container">
1584
+ <element name="metanorma-extension">
1579
1585
  <oneOrMore>
1580
1586
  <ref name="AnyElement"/>
1581
1587
  </oneOrMore>
@@ -98,8 +98,8 @@ module Metanorma
98
98
 
99
99
  def itu_identifier_validate(xmldoc)
100
100
  xmldoc.xpath("//bibdata/docidentifier[@type = 'ITU']").each do |x|
101
- /^ITU-[RTD] [AD-VX-Z]\.[0-9]+$/.match(x.text) or
102
- @log.add("Style", nil, "#{x.text} does not match ITU document "\
101
+ /^ITU-[RTD] [AD-VX-Z]\.\d+(\.\d+)?$/.match(x.text) or
102
+ @log.add("Style", nil, "#{x.text} does not match ITU document " \
103
103
  "identifier conventions")
104
104
  end
105
105
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "2.2.3".freeze
3
+ VERSION = "2.2.5".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.5
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-12-30 00:00:00.000000000 Z
11
+ date: 2023-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities