metanorma-itu 1.2.7 → 1.2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +7 -5
  3. data/lib/asciidoctor/itu/basicdoc.rng +52 -3
  4. data/lib/asciidoctor/itu/boilerplate.xml +8 -2
  5. data/lib/asciidoctor/itu/cleanup.rb +9 -0
  6. data/lib/asciidoctor/itu/converter.rb +2 -1
  7. data/lib/asciidoctor/itu/front.rb +47 -13
  8. data/lib/asciidoctor/itu/isodoc.rng +51 -3
  9. data/lib/asciidoctor/itu/itu.rng +71 -0
  10. data/lib/asciidoctor/itu/validate.rb +15 -14
  11. data/lib/isodoc/itu/base_convert.rb +70 -52
  12. data/lib/isodoc/itu/cleanup.rb +55 -0
  13. data/lib/isodoc/itu/html/header.html +12 -16
  14. data/lib/isodoc/itu/html/html_itu_intro.html +4 -3
  15. data/lib/isodoc/itu/html/html_itu_titlepage.html +23 -17
  16. data/lib/isodoc/itu/html/htmlstyle.css +804 -745
  17. data/lib/isodoc/itu/html/htmlstyle.scss +32 -12
  18. data/lib/isodoc/itu/html/itu.css +43 -43
  19. data/lib/isodoc/itu/html/itu.scss +44 -43
  20. data/lib/isodoc/itu/html/logo-sp.png +0 -0
  21. data/lib/isodoc/itu/html/word_itu_intro.html +19 -3
  22. data/lib/isodoc/itu/html/word_itu_titlepage.html +37 -8
  23. data/lib/isodoc/itu/html/word_itu_titlepage_sp.html +108 -0
  24. data/lib/isodoc/itu/html/wordstyle.css +71 -37
  25. data/lib/isodoc/itu/html/wordstyle.scss +70 -37
  26. data/lib/isodoc/itu/html_convert.rb +6 -3
  27. data/lib/isodoc/itu/i18n-en.yaml +44 -0
  28. data/lib/isodoc/itu/itu.recommendation-annex.xsl +1010 -238
  29. data/lib/isodoc/itu/itu.recommendation.xsl +1010 -238
  30. data/lib/isodoc/itu/itu.resolution.xsl +1010 -238
  31. data/lib/isodoc/itu/itu.technical-paper.xsl +5583 -0
  32. data/lib/isodoc/itu/itu.technical-report.xsl +5583 -0
  33. data/lib/isodoc/itu/metadata.rb +59 -9
  34. data/lib/isodoc/itu/pdf_convert.rb +2 -0
  35. data/lib/isodoc/itu/presentation_xml_convert.rb +100 -2
  36. data/lib/isodoc/itu/ref.rb +0 -13
  37. data/lib/isodoc/itu/word_cleanup.rb +5 -1
  38. data/lib/isodoc/itu/word_convert.rb +17 -3
  39. data/lib/isodoc/itu/xref.rb +101 -43
  40. data/lib/metanorma/itu/processor.rb +11 -8
  41. data/lib/metanorma/itu/version.rb +1 -1
  42. data/metanorma-itu.gemspec +2 -2
  43. metadata +11 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ec6ae3e4b2d44ccd7e6ab9addb0f53c6d84aa9750ceddd4e78a17db546c1714
4
- data.tar.gz: 0e3b9e4225a67f3dfdc9c774e9a1f1bc90b5348fbec12056ae15e03baec7ef8d
3
+ metadata.gz: b83dc88219111d0638c307ac05020a1b3234dd000050548539b55e9944ad5562
4
+ data.tar.gz: cf2800c450d29d9228b807ea8a52b754ad68684ce2fe573eea6d622825b44639
5
5
  SHA512:
6
- metadata.gz: feb1aff54a346048fbe9fe1ae0e88c2721ce9a95488c74f663942e9db84853c94fc2181eac6c2e84c74724be68108dd567b98fd0eedecaae87a9d2a6efa43e1d
7
- data.tar.gz: a1e4f89fdbae6f567e1e310e82b4b3c36a6cad23117aa9ee5e3530eefd9a22a8fb7fd3019366a9b0d3b04046eda67c5eb4e98c8f1cfc1c26e9d67e4216ac1fe8
6
+ metadata.gz: 873af5c00c3ed8c65aef1551ad74dca628759a4cb558c6fec136365910efdfb6582836e2a088f7364e3c72148cec7249970d673b9705f23af2362bbc9df44b46
7
+ data.tar.gz: 93c68a94ba74666bba34faf2cb46bc86be84fc42c6392722dc51e6224d9d0ecc86f21a953a79b826002f50db14e0485e1a228ffb1b394cde9475f5af1187ea7c
@@ -36,7 +36,10 @@ jobs:
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
38
 
39
- - uses: actions/cache@v1
39
+ - if: matrix.os == 'macos-latest'
40
+ run: brew install autoconf automake libtool
41
+
42
+ - uses: actions/cache@v2
40
43
  with:
41
44
  path: vendor/bundle
42
45
  key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
@@ -48,15 +51,14 @@ jobs:
48
51
 
49
52
  - run: bundle exec rake
50
53
 
51
- notify:
52
- name: Trigger notify workflow
54
+ tests-passed:
53
55
  needs: rake
54
56
  runs-on: ubuntu-latest
55
57
  steps:
56
- - name: Trigger notify workflow
58
+ - name: Trigger tests passed event
57
59
  uses: Sibz/github-status-action@v1
58
60
  with:
59
- authToken: ${{ secrets.GITHUB_TOKEN }}
61
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
60
62
  context: 'tests-passed-successfully'
61
63
  description: 'Tests passed successfully'
62
64
  state: 'success'
@@ -596,6 +596,7 @@
596
596
  <ref name="bookmark"/>
597
597
  <ref name="image"/>
598
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
599
600
  </choice>
600
601
  </define>
601
602
  <define name="PureTextElement">
@@ -728,13 +729,61 @@
728
729
  </define>
729
730
  <define name="index">
730
731
  <element name="index">
731
- <attribute name="primary"/>
732
732
  <optional>
733
- <attribute name="secondary"/>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
737
+ <element name="primary">
738
+ <oneOrMore>
739
+ <ref name="PureTextElement"/>
740
+ </oneOrMore>
741
+ </element>
742
+ <optional>
743
+ <element name="secondary">
744
+ <oneOrMore>
745
+ <ref name="PureTextElement"/>
746
+ </oneOrMore>
747
+ </element>
748
+ </optional>
749
+ <optional>
750
+ <element name="tertiary">
751
+ <oneOrMore>
752
+ <ref name="PureTextElement"/>
753
+ </oneOrMore>
754
+ </element>
755
+ </optional>
756
+ </element>
757
+ </define>
758
+ <define name="index-xref">
759
+ <element name="index-xref">
760
+ <attribute name="also">
761
+ <data type="boolean"/>
762
+ </attribute>
763
+ <element name="primary">
764
+ <oneOrMore>
765
+ <ref name="PureTextElement"/>
766
+ </oneOrMore>
767
+ </element>
768
+ <optional>
769
+ <element name="secondary">
770
+ <oneOrMore>
771
+ <ref name="PureTextElement"/>
772
+ </oneOrMore>
773
+ </element>
734
774
  </optional>
735
775
  <optional>
736
- <attribute name="tertiary"/>
776
+ <element name="tertiary">
777
+ <oneOrMore>
778
+ <ref name="PureTextElement"/>
779
+ </oneOrMore>
780
+ </element>
737
781
  </optional>
782
+ <element name="target">
783
+ <oneOrMore>
784
+ <ref name="PureTextElement"/>
785
+ </oneOrMore>
786
+ </element>
738
787
  </element>
739
788
  </define>
740
789
  <!-- bare ID element, used for referencing arbitrary spans of text -->
@@ -1,10 +1,13 @@
1
1
  <boilerplate>
2
+ {% if doctype == "Service Publication" %}
3
+ {% else %}
2
4
  <copyright-statement>
3
5
  <clause>
4
- <p>&copy; ITU {{ docyear }}</p>
6
+ <p>&#xa9; ITU {{ docyear }}</p>
5
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>
6
8
  </clause>
7
9
  </copyright-statement>
10
+ {% if doctype == "Recommendation" %}
8
11
  <license-statement>
9
12
  <clause>
10
13
  <title>INTELLECTUAL PROPERTY RIGHTS</title>
@@ -13,6 +16,7 @@
13
16
  </p>
14
17
  </clause>
15
18
  </license-statement>
19
+ {% endif %}
16
20
  <legal-statement>
17
21
  <clause>
18
22
  <title>FOREWORD</title>
@@ -21,12 +25,13 @@
21
25
  <p>The approval of ITU-T Recommendations is covered by the procedure laid down in WTSA Resolution 1 .</p>
22
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>
23
27
 
24
-
28
+ {% if doctype == "Recommendation" %}
25
29
  <clause>
26
30
  <title>NOTE</title>
27
31
  <p>In this Recommendation, the expression "Administration" is used for conciseness to indicate both a telecommunication administration and a recognized operating agency .</p>
28
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>
29
33
  </clause>
34
+ {% endif %}
30
35
  </clause>
31
36
 
32
37
  {% if unpublished %}
@@ -40,6 +45,7 @@
40
45
  </clause>
41
46
  {% endif %}
42
47
  </legal-statement>
48
+ {% endif %}
43
49
  </boilerplate>
44
50
 
45
51
 
@@ -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)
@@ -45,7 +45,7 @@ module Asciidoctor
45
45
  end
46
46
 
47
47
  def olist(node)
48
- id = Asciidoctor::Standoc::Utils::anchor_or_uuid(node)
48
+ id = Metanorma::Utils::anchor_or_uuid(node)
49
49
  noko do |xml|
50
50
  xml.ol **attr_code(id: id, class: node.attr("class")) do |xml_ol|
51
51
  node.items.each { |item| li(xml_ol, item) }
@@ -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
 
@@ -17,12 +16,12 @@ module Asciidoctor
17
16
  at = { language: "en", format: "text/plain", type: "main" }
18
17
  a = node.attr("title") || node.attr("title-en")
19
18
  xml.title **attr_code(at) do |t|
20
- t << (Asciidoctor::Standoc::Utils::asciidoc_sub(a) || node.title)
19
+ t << (Metanorma::Utils::asciidoc_sub(a) || node.title)
21
20
  end
22
21
  if a = node.attr("annextitle") || node.attr("annextitle-en")
23
22
  at[:type] = "annex"
24
23
  xml.title **attr_code(at) do |t|
25
- t << Asciidoctor::Standoc::Utils::asciidoc_sub(a)
24
+ t << Metanorma::Utils::asciidoc_sub(a)
26
25
  end
27
26
  end
28
27
  end
@@ -32,9 +31,8 @@ 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|
37
- t << Asciidoctor::Standoc::Utils::asciidoc_sub(v)
34
+ xml.title **attr_code(language: lang, format: "text/plain", type: type) do |t|
35
+ t << Metanorma::Utils::asciidoc_sub(v)
38
36
  end
39
37
  end
40
38
  end
@@ -51,7 +49,7 @@ module Asciidoctor
51
49
  at = { language: "en", format: "text/plain", type: type.sub(/-title/, "") }
52
50
  a = node.attr(type) || node.attr("#{type}-en")
53
51
  xml.title **attr_code(at) do |t|
54
- t << Asciidoctor::Standoc::Utils::asciidoc_sub(a)
52
+ t << Metanorma::Utils::asciidoc_sub(a)
55
53
  end
56
54
  end
57
55
 
@@ -61,7 +59,7 @@ module Asciidoctor
61
59
  next if m[:lang] == "en"
62
60
  xml.title **attr_code(language: m[:lang], format: "text/plain",
63
61
  type: type.sub(/-title/, "")) do |t|
64
- t << Asciidoctor::Standoc::Utils::asciidoc_sub(v)
62
+ t << Metanorma::Utils::asciidoc_sub(v)
65
63
  end
66
64
  end
67
65
  end
@@ -116,6 +114,7 @@ module Asciidoctor
116
114
  def metadata_id(node, xml)
117
115
  provisional_id(node, xml)
118
116
  itu_id(node, xml)
117
+ recommendation_id(node, xml)
119
118
  end
120
119
 
121
120
  def provisional_id(node, xml)
@@ -125,16 +124,36 @@ module Asciidoctor
125
124
  end
126
125
  end
127
126
 
128
- def itu_id(node, xml)
127
+ ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S", "zh" => "C", "ru" => "R" }.freeze
128
+
129
+ def itu_id1(node, lang)
129
130
  bureau = node.attr("bureau") || "T"
131
+ id = doctype(node) == "service-publication" ?
132
+ @i18n.annex_to_itu_ob_abbrev.sub(/%/, node.attr("docnumber")) :
133
+ "ITU-#{bureau} #{node.attr("docnumber")}"
134
+ id + (lang ? "-#{ITULANG[@lang]}" : "")
135
+ end
136
+
137
+ def itu_id(node, xml)
130
138
  return unless node.attr("docnumber")
131
139
  xml.docidentifier **{type: "ITU"} do |i|
132
- i << "ITU-#{bureau} "\
133
- "#{node.attr("docnumber")}"
140
+ i << itu_id1(node, false)
141
+ end
142
+ xml.docidentifier **{type: "ITU-lang"} do |i|
143
+ i << itu_id1(node, true)
134
144
  end
135
145
  xml.docnumber { |i| i << node.attr("docnumber") }
136
146
  end
137
147
 
148
+ def recommendation_id(node, xml)
149
+ return unless node.attr("recommendationnumber")
150
+ node.attr("recommendationnumber").split("/").each do |s|
151
+ xml.docidentifier **{type: "ITU-Recommendation"} do |i|
152
+ i << s
153
+ end
154
+ end
155
+ end
156
+
138
157
  def metadata_series(node, xml)
139
158
  node.attr("series") and
140
159
  xml.series **{ type: "main" } do |s|
@@ -179,12 +198,19 @@ module Asciidoctor
179
198
  end
180
199
 
181
200
  def metadata_techreport(node, xml)
182
- 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
183
203
  a = node.attr("meeting-date") and metadata_meeting_date(a, xml)
184
204
  a = node.attr("intended-type") and xml.intended_type a
185
205
  a = node.attr("source") and xml.source a
186
206
  end
187
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
+
188
214
  def metadata_meeting_date(a, xml)
189
215
  xml.meeting_date do |m|
190
216
  d = a.split("/")
@@ -197,6 +223,14 @@ module Asciidoctor
197
223
  end
198
224
  end
199
225
 
226
+ def personal_role(node, c, suffix)
227
+ if node.attr("role#{suffix}")&.downcase == "rapporteur"
228
+ c.role "raporteur", **{ type: "editor" }
229
+ else
230
+ super
231
+ end
232
+ end
233
+
200
234
  def metadata_ext(node, xml)
201
235
  metadata_doctype(node, xml)
202
236
  metadata_committee(node, xml)
@@ -55,6 +55,13 @@
55
55
  <param name="pattern">\i\c*|\c+#\c+</param>
56
56
  </data>
57
57
  </attribute>
58
+ <optional>
59
+ <attribute name="to">
60
+ <data type="string">
61
+ <param name="pattern">\i\c*|\c+#\c+</param>
62
+ </data>
63
+ </attribute>
64
+ </optional>
58
65
  <optional>
59
66
  <attribute name="type">
60
67
  <ref name="ReferenceFormat"/>
@@ -246,6 +253,12 @@
246
253
  <data type="boolean"/>
247
254
  </attribute>
248
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
259
+ <optional>
260
+ <ref name="colgroup"/>
261
+ </optional>
249
262
  <optional>
250
263
  <ref name="tname"/>
251
264
  </optional>
@@ -764,6 +777,21 @@
764
777
  </define>
765
778
  </include>
766
779
  <!-- end overrides -->
780
+ <define name="colgroup">
781
+ <element name="colgroup">
782
+ <oneOrMore>
783
+ <ref name="col"/>
784
+ </oneOrMore>
785
+ </element>
786
+ </define>
787
+ <define name="col">
788
+ <element name="col">
789
+ <attribute name="width"/>
790
+ </element>
791
+ </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
767
795
  <define name="TextElement" combine="choice">
768
796
  <ref name="concept"/>
769
797
  </define>
@@ -814,6 +842,9 @@
814
842
  <data type="boolean"/>
815
843
  </attribute>
816
844
  </optional>
845
+ <optional>
846
+ <attribute name="number"/>
847
+ </optional>
817
848
  <optional>
818
849
  <attribute name="obligation">
819
850
  <choice>
@@ -869,9 +900,11 @@
869
900
  <element name="code">
870
901
  <text/>
871
902
  </element>
872
- <element name="text">
873
- <text/>
874
- </element>
903
+ <optional>
904
+ <element name="text">
905
+ <text/>
906
+ </element>
907
+ </optional>
875
908
  </element>
876
909
  </define>
877
910
  <define name="standard-document">
@@ -1041,6 +1074,9 @@
1041
1074
  </choice>
1042
1075
  </attribute>
1043
1076
  </optional>
1077
+ <optional>
1078
+ <attribute name="number"/>
1079
+ </optional>
1044
1080
  <optional>
1045
1081
  <attribute name="type"/>
1046
1082
  </optional>
@@ -1094,6 +1130,9 @@
1094
1130
  <optional>
1095
1131
  <attribute name="type"/>
1096
1132
  </optional>
1133
+ <optional>
1134
+ <attribute name="number"/>
1135
+ </optional>
1097
1136
  <optional>
1098
1137
  <ref name="section-title"/>
1099
1138
  </optional>
@@ -1196,6 +1235,9 @@
1196
1235
  <optional>
1197
1236
  <attribute name="type"/>
1198
1237
  </optional>
1238
+ <optional>
1239
+ <attribute name="number"/>
1240
+ </optional>
1199
1241
  <optional>
1200
1242
  <attribute name="obligation">
1201
1243
  <choice>
@@ -1524,6 +1566,7 @@
1524
1566
  <value>add</value>
1525
1567
  <value>modify</value>
1526
1568
  <value>delete</value>
1569
+ <value>replace</value>
1527
1570
  </choice>
1528
1571
  </attribute>
1529
1572
  <optional>
@@ -1554,6 +1597,11 @@
1554
1597
  </optional>
1555
1598
  <optional>
1556
1599
  <element name="newcontent">
1600
+ <optional>
1601
+ <attribute name="id">
1602
+ <data type="ID"/>
1603
+ </attribute>
1604
+ </optional>
1557
1605
  <zeroOrMore>
1558
1606
  <ref name="BasicBlock"/>
1559
1607
  </zeroOrMore>