metanorma-itu 1.2.10 → 1.2.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a5e5576a553c84c8a975e21c6f7187fb3d959486fb82da54caa4bae59bc70e4
4
- data.tar.gz: 06e43014128a730fe43d6e602a6a1c83280d09043c458620ecf7c3488e8d29c6
3
+ metadata.gz: ebf36f8725648a2e24bf148c5b6eca7227892eb9f91a18cc7f274a62981db6e2
4
+ data.tar.gz: c4e7229799f091ce3cf6ac21e2fbb202d39e7bf57d1f72e0e74c726f7fb0441e
5
5
  SHA512:
6
- metadata.gz: ec9c3c73670e489535e88bb5abed0956a53dcc692d6fbb95b11507b085f3e8e01342be19fd4ee7ab3d55a11d08fe8566cb643670af29e1ef72979f3653f5b5f0
7
- data.tar.gz: b2996860abd9e0354985b288a2c562b19d8456c0b7b6d4afcdb208f4c29d9efbabc559eb266dcc879fd23569a0fa3542335384d9f7d91567d7de830a6f0ad54a
6
+ metadata.gz: 924c0c3a471675ad01f3b52dd1e28192cff5a5124b1808f867417a96d28ee6357268820ab00301f6710752afec711d256909b5bac24a714d77ff951129b6ca62
7
+ data.tar.gz: 6da337d4917c9f6d537636540ba5ea8569a3d410100261ca79beb3f1082438db50af7cd33a1065b08fb8a0226b2d4fb814c4fc94bc615721b68c0e2826f7c19c
@@ -36,6 +36,9 @@ jobs:
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
38
 
39
+ - if: matrix.os == 'macos-latest'
40
+ run: brew install autoconf automake libtool
41
+
39
42
  - uses: actions/cache@v2
40
43
  with:
41
44
  path: vendor/bundle
@@ -3,10 +3,11 @@
3
3
  {% else %}
4
4
  <copyright-statement>
5
5
  <clause>
6
- <p>&copy; ITU {{ docyear }}</p>
6
+ <p>&#xa9; ITU {{ docyear }}</p>
7
7
  <p>All rights reserved. No part of this publication may be reproduced, by any means whatsoever, without the prior written permission of ITU.</p>
8
8
  </clause>
9
9
  </copyright-statement>
10
+ {% if doctype == "Recommendation" %}
10
11
  <license-statement>
11
12
  <clause>
12
13
  <title>INTELLECTUAL PROPERTY RIGHTS</title>
@@ -15,6 +16,7 @@
15
16
  </p>
16
17
  </clause>
17
18
  </license-statement>
19
+ {% endif %}
18
20
  <legal-statement>
19
21
  <clause>
20
22
  <title>FOREWORD</title>
@@ -23,12 +25,13 @@
23
25
  <p>The approval of ITU-T Recommendations is covered by the procedure laid down in WTSA Resolution 1 .</p>
24
26
  <p>In some areas of information technology which fall within ITU-T's purview, the necessary standards are prepared on a collaborative basis with ISO and IEC.</p>
25
27
 
26
-
28
+ {% if doctype == "Recommendation" %}
27
29
  <clause>
28
30
  <title>NOTE</title>
29
31
  <p>In this Recommendation, the expression "Administration" is used for conciseness to indicate both a telecommunication administration and a recognized operating agency .</p>
30
32
  <p>Compliance with this Recommendation is voluntary. However, the Recommendation may contain certain mandatory provisions (to ensure, e.g., interoperability or applicability) and compliance with the Recommendation is achieved when all of these mandatory provisions are met. The words "shall" or some other obligatory language such as "must" and the negative equivalents are used to express requirements. The use of such words does not suggest that compliance with the Recommendation is required of any party .</p>
31
33
  </clause>
34
+ {% endif %}
32
35
  </clause>
33
36
 
34
37
  {% if unpublished %}
@@ -5,6 +5,15 @@ module Asciidoctor
5
5
  super
6
6
  insert_missing_sections(x) unless @no_insert_missing_sections
7
7
  insert_empty_clauses(x)
8
+ resolution_inline_header(x)
9
+ end
10
+
11
+ def resolution_inline_header(x)
12
+ return unless x&.at("//bibdata/ext/doctype")&.text == "resolution"
13
+ x.xpath("//clause//clause").each do |c|
14
+ next if title = c.at("./title") and !title&.text&.empty?
15
+ c["inline-header"] = true
16
+ end
8
17
  end
9
18
 
10
19
  def table_cleanup(xmldoc)
@@ -116,6 +116,7 @@ module Asciidoctor
116
116
  end
117
117
 
118
118
  def clause_parse(attrs, xml, node)
119
+ node.option?("unnumbered") and attrs[:unnumbered] = true
119
120
  case clausetype = sectiontype1(node)
120
121
  when "conventions" then attrs = attrs.merge(type: "conventions")
121
122
  when "history"
@@ -8,8 +8,7 @@ module Asciidoctor
8
8
  def metadata_status(node, xml)
9
9
  xml.status do |s|
10
10
  s.stage (node.attributes.has_key?("draft") ? "draft" :
11
- (node.attr("status") || node.attr("docstage") ||
12
- "published" ))
11
+ (node.attr("status") || node.attr("docstage") || "published" ))
13
12
  end
14
13
  end
15
14
 
@@ -32,8 +31,7 @@ module Asciidoctor
32
31
  next unless /^(annex)?title-(?<lang>.+)$/ =~ k
33
32
  next if lang == "en"
34
33
  type = /^annex/.match(k) ? "annex" : "main"
35
- xml.title **attr_code(language: lang, format: "text/plain",
36
- type: type) do |t|
34
+ xml.title **attr_code(language: lang, format: "text/plain", type: type) do |t|
37
35
  t << Asciidoctor::Standoc::Utils::asciidoc_sub(v)
38
36
  end
39
37
  end
@@ -126,18 +124,13 @@ module Asciidoctor
126
124
  end
127
125
  end
128
126
 
129
- ITULANG = {
130
- "en" => "E", "fr" => "F", "ar" => "A",
131
- "es" => "S", "zh" => "C", "ru" => "R"
132
- }.freeze
127
+ ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S", "zh" => "C", "ru" => "R" }.freeze
133
128
 
134
129
  def itu_id1(node, lang)
135
130
  bureau = node.attr("bureau") || "T"
136
- id = if doctype(node) == "service-publication"
137
- @i18n.annex_to_itu_ob_abbrev.sub(/%/, node.attr("docnumber"))
138
- else
139
- "ITU-#{bureau} #{node.attr("docnumber")}"
140
- end
131
+ id = doctype(node) == "service-publication" ?
132
+ @i18n.annex_to_itu_ob_abbrev.sub(/%/, node.attr("docnumber")) :
133
+ "ITU-#{bureau} #{node.attr("docnumber")}"
141
134
  id + (lang ? "-#{ITULANG[@lang]}" : "")
142
135
  end
143
136
 
@@ -204,14 +197,20 @@ module Asciidoctor
204
197
  end
205
198
  end
206
199
 
207
- # also used in tech paper
208
200
  def metadata_techreport(node, xml)
209
- a = node.attr("meeting") and xml.meeting a
201
+ a = node.attr("meeting") and metadata_meeting(a, node.attr("meeting-acronym"), xml)
202
+ a = node.attr("meeting-place") and xml.meeting_place a
210
203
  a = node.attr("meeting-date") and metadata_meeting_date(a, xml)
211
204
  a = node.attr("intended-type") and xml.intended_type a
212
205
  a = node.attr("source") and xml.source a
213
206
  end
214
207
 
208
+ def metadata_meeting(mtg, acronym, xml)
209
+ xml.meeting **attr_code(acronym: acronym) do |m|
210
+ m << mtg
211
+ end
212
+ end
213
+
215
214
  def metadata_meeting_date(a, xml)
216
215
  xml.meeting_date do |m|
217
216
  d = a.split("/")
@@ -253,6 +253,9 @@
253
253
  <data type="boolean"/>
254
254
  </attribute>
255
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
256
259
  <optional>
257
260
  <ref name="colgroup"/>
258
261
  </optional>
@@ -836,6 +839,9 @@
836
839
  <data type="boolean"/>
837
840
  </attribute>
838
841
  </optional>
842
+ <optional>
843
+ <attribute name="number"/>
844
+ </optional>
839
845
  <optional>
840
846
  <attribute name="obligation">
841
847
  <choice>
@@ -891,9 +897,11 @@
891
897
  <element name="code">
892
898
  <text/>
893
899
  </element>
894
- <element name="text">
895
- <text/>
896
- </element>
900
+ <optional>
901
+ <element name="text">
902
+ <text/>
903
+ </element>
904
+ </optional>
897
905
  </element>
898
906
  </define>
899
907
  <define name="standard-document">
@@ -1063,6 +1071,9 @@
1063
1071
  </choice>
1064
1072
  </attribute>
1065
1073
  </optional>
1074
+ <optional>
1075
+ <attribute name="number"/>
1076
+ </optional>
1066
1077
  <optional>
1067
1078
  <attribute name="type"/>
1068
1079
  </optional>
@@ -1116,6 +1127,9 @@
1116
1127
  <optional>
1117
1128
  <attribute name="type"/>
1118
1129
  </optional>
1130
+ <optional>
1131
+ <attribute name="number"/>
1132
+ </optional>
1119
1133
  <optional>
1120
1134
  <ref name="section-title"/>
1121
1135
  </optional>
@@ -1218,6 +1232,9 @@
1218
1232
  <optional>
1219
1233
  <attribute name="type"/>
1220
1234
  </optional>
1235
+ <optional>
1236
+ <attribute name="number"/>
1237
+ </optional>
1221
1238
  <optional>
1222
1239
  <attribute name="obligation">
1223
1240
  <choice>
@@ -1546,6 +1563,7 @@
1546
1563
  <value>add</value>
1547
1564
  <value>modify</value>
1548
1565
  <value>delete</value>
1566
+ <value>replace</value>
1549
1567
  </choice>
1550
1568
  </attribute>
1551
1569
  <optional>
@@ -1576,6 +1594,11 @@
1576
1594
  </optional>
1577
1595
  <optional>
1578
1596
  <element name="newcontent">
1597
+ <optional>
1598
+ <attribute name="id">
1599
+ <data type="ID"/>
1600
+ </attribute>
1601
+ </optional>
1579
1602
  <zeroOrMore>
1580
1603
  <ref name="BasicBlock"/>
1581
1604
  </zeroOrMore>
@@ -42,6 +42,8 @@
42
42
  <value>joint-itu-iso-iec</value>
43
43
  <value>resolution</value>
44
44
  <value>service-publication</value>
45
+ <value>handbook</value>
46
+ <value>question</value>
45
47
  </choice>
46
48
  </define>
47
49
  <define name="editorialgroup">
@@ -98,6 +100,9 @@
98
100
  <optional>
99
101
  <ref name="meeting"/>
100
102
  </optional>
103
+ <optional>
104
+ <ref name="meeting-place"/>
105
+ </optional>
101
106
  <optional>
102
107
  <ref name="meeting-date"/>
103
108
  </optional>
@@ -125,9 +130,74 @@
125
130
  </oneOrMore>
126
131
  </element>
127
132
  </define>
133
+ <define name="Clause-Section">
134
+ <optional>
135
+ <attribute name="id">
136
+ <data type="ID"/>
137
+ </attribute>
138
+ </optional>
139
+ <optional>
140
+ <attribute name="language"/>
141
+ </optional>
142
+ <optional>
143
+ <attribute name="script"/>
144
+ </optional>
145
+ <optional>
146
+ <attribute name="inline-header">
147
+ <data type="boolean"/>
148
+ </attribute>
149
+ </optional>
150
+ <optional>
151
+ <attribute name="obligation">
152
+ <choice>
153
+ <value>normative</value>
154
+ <value>informative</value>
155
+ </choice>
156
+ </attribute>
157
+ </optional>
158
+ <optional>
159
+ <attribute name="type"/>
160
+ </optional>
161
+ <optional>
162
+ <attribute name="unnumbered">
163
+ <data type="boolean"/>
164
+ </attribute>
165
+ </optional>
166
+ <optional>
167
+ <ref name="section-title"/>
168
+ </optional>
169
+ <group>
170
+ <choice>
171
+ <group>
172
+ <zeroOrMore>
173
+ <ref name="BasicBlock"/>
174
+ </zeroOrMore>
175
+ <zeroOrMore>
176
+ <ref name="note"/>
177
+ </zeroOrMore>
178
+ </group>
179
+ <ref name="amend"/>
180
+ </choice>
181
+ <zeroOrMore>
182
+ <choice>
183
+ <ref name="clause-subsection"/>
184
+ <ref name="terms"/>
185
+ <ref name="definitions"/>
186
+ </choice>
187
+ </zeroOrMore>
188
+ </group>
189
+ </define>
128
190
  </include>
129
191
  <define name="meeting">
130
192
  <element name="meeting">
193
+ <optional>
194
+ <attribute name="acronym"/>
195
+ </optional>
196
+ <text/>
197
+ </element>
198
+ </define>
199
+ <define name="meeting-place">
200
+ <element name="meeting-place">
131
201
  <text/>
132
202
  </element>
133
203
  </define>
@@ -12,8 +12,7 @@ module Asciidoctor
12
12
  recommendation-corrigendum recommendation-errata recommendation-annex
13
13
  focus-group implementers-guide technical-paper technical-report
14
14
  joint-itu-iso-iec service-publication).include? doctype or
15
- @log.add("Document Attributes", nil,
16
- "#{doctype} is not a recognised document type")
15
+ @log.add("Document Attributes", nil, "#{doctype} is not a recognised document type")
17
16
  end
18
17
 
19
18
  def stage_validate(xmldoc)
@@ -41,8 +40,7 @@ module Asciidoctor
41
40
  xmldoc.xpath("//bibdata/series/title").each do |s|
42
41
  series = s.text.sub(/^[A-Z]: /, "")
43
42
  t.downcase.include?(series.downcase) and
44
- @log.add("Document Attributes", nil,
45
- "Title includes series name #{series}")
43
+ @log.add("Document Attributes", nil, "Title includes series name #{series}")
46
44
  end
47
45
  end
48
46
 
@@ -108,6 +106,16 @@ module Asciidoctor
108
106
  def section_validate(doc)
109
107
  super
110
108
  section_check(doc.root)
109
+ unnumbered_check(doc.root)
110
+ end
111
+
112
+ def unnumbered_check(xmldoc)
113
+ doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
114
+ xmldoc.xpath("//clause[@unnumbered = 'true']").each do |c|
115
+ next if doctype == "resolution" and c.parent.name == "sections" and
116
+ !c.at("./preceding-sibling::clause")
117
+ @log.add("Style", c, "Unnumbered clause out of place")
118
+ end
111
119
  end
112
120
 
113
121
  # Editing Guidelines 7.2, 7.3
@@ -3,6 +3,7 @@ require "fileutils"
3
3
  require_relative "./ref.rb"
4
4
  require_relative "./xref.rb"
5
5
  require_relative "./terms.rb"
6
+ require_relative "./cleanup.rb"
6
7
 
7
8
  module IsoDoc
8
9
  module ITU
@@ -48,21 +49,19 @@ module IsoDoc
48
49
  div.h1 **{ class: r_a ? "RecommendationAnnex" : "Annex" } do |t|
49
50
  name&.children&.each { |c2| parse(c2, t) }
50
51
  end
51
- annex_obligation_subtitle(annex, div)
52
+ annex_obligation_subtitle(annex, div) unless @meta.get[:doctype_original] == "resolution"
52
53
  end
53
54
 
54
55
  def annex_obligation_subtitle(annex, div)
55
56
  info = annex["obligation"] == "informative"
56
57
  div.p **{class: "annex_obligation" } do |p|
57
- p << (info ? @i18n.inform_annex : @i18n.norm_annex).
58
- sub(/%/, @meta.get[:doctype] || "")
58
+ p << (info ? @i18n.inform_annex : @i18n.norm_annex).sub(/%/, @meta.get[:doctype] || "")
59
59
  end
60
60
  end
61
61
 
62
62
  def annex(isoxml, out)
63
63
  isoxml.xpath(ns("//annex")).each do |c|
64
- @meta.get[:doctype_original] == "recommendation-annex" or
65
- page_break(out)
64
+ @meta.get[:doctype_original] == "recommendation-annex" or page_break(out)
66
65
  out.div **attr_code(id: c["id"], class: "Section3") do |s|
67
66
  annex_name(c, nil, s) unless c.at(ns("./title"))
68
67
  c.elements.each do |c1|
@@ -75,67 +74,52 @@ module IsoDoc
75
74
  end
76
75
  end
77
76
 
78
- def cleanup(docxml)
77
+ def info(isoxml, out)
78
+ @meta.ip_notice_received isoxml, out
79
+ @meta.techreport isoxml, out
79
80
  super
80
- term_cleanup(docxml)
81
- refs_cleanup(docxml)
82
- title_cleanup(docxml)
83
81
  end
84
82
 
85
- def title_cleanup(docxml)
86
- docxml.xpath("//h1[@class = 'RecommendationAnnex']").each do |h|
87
- h.name = "p"
88
- h["class"] = "h1Annex"
89
- end
90
- docxml
91
- end
92
-
93
- def term_cleanup(docxml)
94
- term_cleanup1(docxml)
95
- term_cleanup2(docxml)
96
- docxml
97
- end
98
-
99
- def term_cleanup1(docxml)
100
- docxml.xpath("//p[@class = 'Terms']").each do |d|
101
- h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
102
- d.children.first.previous = "<b>#{h2.children.to_xml}</b>&nbsp;"
103
- d["id"] = h2["id"]
104
- h2.remove
83
+ def middle_title(isoxml, out)
84
+ if @meta.get[:doctype] == "Resolution"
85
+ middle_title_resolution(isoxml, out)
86
+ else
87
+ middle_title_recommendation(isoxml, out)
105
88
  end
106
89
  end
107
90
 
108
- def term_cleanup2(docxml)
109
- docxml.xpath("//p[@class = 'TermNum']").each do |d|
110
- d1 = d.next_element and d1.name == "p" or next
111
- d1.children.each { |e| e.parent = d }
112
- d1.remove
91
+ def middle_title_resolution(isoxml, out)
92
+ res = isoxml.at(ns("//bibdata/title[@type = 'resolution']"))
93
+ out.p(**{ align: "center", style: "text-align:center;" }) do |p|
94
+ res.children.each { |n| parse(n, p) }
113
95
  end
96
+ out.p(**{ class: "zzSTDTitle2" }) { |p| p << @meta.get[:doctitle] }
97
+ middle_title_resolution_subtitle(isoxml, out)
114
98
  end
115
99
 
116
- def refs_cleanup(docxml)
117
- docxml.xpath("//tx[following-sibling::tx]").each do |tx|
118
- tx << tx.next_element.remove.children
119
- end
120
- docxml.xpath("//tx").each do |tx|
121
- tx.name = "td"
122
- tx["colspan"] = "2"
123
- tx.wrap("<tr></tr>")
100
+ def middle_title_resolution_subtitle(isoxml, out)
101
+ out.p(**{ align: "center", style: "text-align:center;" }) do |p|
102
+ p.i do |i|
103
+ i << "("
104
+ isoxml.at(ns("//bibdata/title[@type = 'resolution-placedate']")).children.each { |n| parse(n, i) }
105
+ i << ")"
106
+ end
107
+ isoxml.xpath(ns("//note[@type = 'title-footnote']")).each do |f|
108
+ footnote_parse(f, p)
109
+ end
124
110
  end
125
- docxml
126
- end
127
-
128
- def info(isoxml, out)
129
- @meta.ip_notice_received isoxml, out
130
- @meta.techreport isoxml, out
131
- super
132
111
  end
133
112
 
134
- def middle_title(out)
113
+ def middle_title_recommendation(isoxml, out)
135
114
  out.p(**{ class: "zzSTDTitle1" }) do |p|
136
115
  id = @meta.get[:docnumber] and p << "#{@meta.get[:doctype]} #{id}"
137
116
  end
138
- out.p(**{ class: "zzSTDTitle2" }) { |p| p << @meta.get[:doctitle] }
117
+ out.p(**{ class: "zzSTDTitle2" }) do |p|
118
+ p << @meta.get[:doctitle]
119
+ isoxml.xpath(ns("//note[@type = 'title-footnote']")).each do |f|
120
+ footnote_parse(f, p)
121
+ end
122
+ end
139
123
  s = @meta.get[:docsubtitle] and
140
124
  out.p(**{ class: "zzSTDTitle3" }) { |p| p << s }
141
125
  end
@@ -178,7 +162,6 @@ module IsoDoc
178
162
  div.p do |p|
179
163
  name and p.span **{ class: "note_label" } do |s|
180
164
  name.children.each { |n| parse(n, s) }
181
- #s << note_delim
182
165
  end
183
166
  end
184
167
  node.children.each { |n| parse(n, div) }
@@ -187,6 +170,36 @@ module IsoDoc
187
170
  def table_footnote_reference_format(a)
188
171
  a.content = a.content + ")"
189
172
  end
173
+
174
+ def note_parse(node, out)
175
+ return if node["type"] == "title-footnote"
176
+ super
177
+ end
178
+
179
+ # can have supertitle in resolution
180
+ def clause(isoxml, out)
181
+ isoxml.xpath(ns(middle_clause(isoxml))).each do |c|
182
+ clause_core(c, out)
183
+ end
184
+ end
185
+
186
+ def clause_core(c, out)
187
+ out.div **attr_code(clause_attrs(c)) do |s|
188
+ c.elements.each do |c1|
189
+ if c1.name == "title" then clause_name(nil, c1, s, nil)
190
+ else
191
+ parse(c1, s)
192
+ end
193
+ end
194
+ end
195
+ end
196
+
197
+ def scope(isoxml, out, num)
198
+ return super unless @meta.get[:doctype_original] == "resolution"
199
+ f = isoxml.at(ns("//clause[@type = 'scope']")) or return num
200
+ clause_core(f, out)
201
+ num + 1
202
+ end
190
203
  end
191
204
  end
192
205
  end