metanorma-itu 1.2.6 → 1.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +29 -8
  3. data/README.adoc +3 -4
  4. data/lib/asciidoctor/itu/basicdoc.rng +50 -3
  5. data/lib/asciidoctor/itu/boilerplate.xml +8 -2
  6. data/lib/asciidoctor/itu/cleanup.rb +9 -0
  7. data/lib/asciidoctor/itu/converter.rb +1 -0
  8. data/lib/asciidoctor/itu/front.rb +42 -8
  9. data/lib/asciidoctor/itu/isodoc.rng +61 -3
  10. data/lib/asciidoctor/itu/itu.rng +71 -0
  11. data/lib/asciidoctor/itu/validate.rb +14 -13
  12. data/lib/isodoc/itu/base_convert.rb +65 -58
  13. data/lib/isodoc/itu/cleanup.rb +55 -0
  14. data/lib/isodoc/itu/html/header.html +12 -16
  15. data/lib/isodoc/itu/html/html_itu_intro.html +4 -3
  16. data/lib/isodoc/itu/html/html_itu_titlepage.html +23 -17
  17. data/lib/isodoc/itu/html/htmlstyle.css +793 -745
  18. data/lib/isodoc/itu/html/htmlstyle.scss +15 -12
  19. data/lib/isodoc/itu/html/itu.css +43 -43
  20. data/lib/isodoc/itu/html/itu.scss +44 -43
  21. data/lib/isodoc/itu/html/logo-sp.png +0 -0
  22. data/lib/isodoc/itu/html/word_itu_intro.html +19 -3
  23. data/lib/isodoc/itu/html/word_itu_titlepage.html +37 -8
  24. data/lib/isodoc/itu/html/word_itu_titlepage_sp.html +108 -0
  25. data/lib/isodoc/itu/html/wordstyle.css +40 -37
  26. data/lib/isodoc/itu/html/wordstyle.scss +40 -37
  27. data/lib/isodoc/itu/html_convert.rb +4 -1
  28. data/lib/isodoc/itu/i18n-en.yaml +44 -0
  29. data/lib/isodoc/itu/itu.recommendation-annex.xsl +720 -154
  30. data/lib/isodoc/itu/itu.recommendation.xsl +720 -154
  31. data/lib/isodoc/itu/itu.resolution.xsl +720 -154
  32. data/lib/isodoc/itu/itu.technical-paper.xsl +5284 -0
  33. data/lib/isodoc/itu/itu.technical-report.xsl +5284 -0
  34. data/lib/isodoc/itu/metadata.rb +59 -9
  35. data/lib/isodoc/itu/pdf_convert.rb +2 -0
  36. data/lib/isodoc/itu/presentation_xml_convert.rb +104 -2
  37. data/lib/isodoc/itu/ref.rb +0 -13
  38. data/lib/isodoc/itu/terms.rb +7 -30
  39. data/lib/isodoc/itu/word_cleanup.rb +5 -1
  40. data/lib/isodoc/itu/word_convert.rb +15 -1
  41. data/lib/isodoc/itu/xref.rb +93 -39
  42. data/lib/metanorma/itu/processor.rb +10 -8
  43. data/lib/metanorma/itu/version.rb +1 -1
  44. data/metanorma-itu.gemspec +2 -2
  45. metadata +11 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb287ff921a50fb1e0bc7f1c6e6508d96ed8850e973d0dc1da25720fa0e3856f
4
- data.tar.gz: 55782324626afcec59caf220ae8129d0b9bf3acc66197b95146b909cba834590
3
+ metadata.gz: ebf36f8725648a2e24bf148c5b6eca7227892eb9f91a18cc7f274a62981db6e2
4
+ data.tar.gz: c4e7229799f091ce3cf6ac21e2fbb202d39e7bf57d1f72e0e74c726f7fb0441e
5
5
  SHA512:
6
- metadata.gz: 1ffb8747c3b8c3574393a27a1186842a0528840c2d02dc77a1154296db777d98ffbe31072833f08aa8802c39b0e2731cdbd10459ec68ddb0ca4467a341f3303b
7
- data.tar.gz: 5c9519836a9c530132183ff18870764ffa97a6f88c36691cf554d423b1bd23f65ff4bc506fb4dcbe9a90198104b87b7e9ba70e25aae4759ecee9a4510748efb2
6
+ metadata.gz: 924c0c3a471675ad01f3b52dd1e28192cff5a5124b1808f867417a96d28ee6357268820ab00301f6710752afec711d256909b5bac24a714d77ff951129b6ca62
7
+ data.tar.gz: 6da337d4917c9f6d537636540ba5ea8569a3d410100261ca79beb3f1082438db50af7cd33a1065b08fb8a0226b2d4fb814c4fc94bc615721b68c0e2826f7c19c
@@ -4,7 +4,8 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master ]
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
8
9
  pull_request:
9
10
 
10
11
  jobs:
@@ -31,14 +32,34 @@ jobs:
31
32
  steps:
32
33
  - uses: actions/checkout@master
33
34
 
34
- - name: Use Ruby
35
- uses: ruby/setup-ruby@v1
35
+ - uses: ruby/setup-ruby@v1
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
- bundler-cache: true
39
38
 
40
- - name: Update gems
41
- run: bundle install --jobs 4 --retry 3
39
+ - if: matrix.os == 'macos-latest'
40
+ run: brew install autoconf automake libtool
42
41
 
43
- - name: Run specs
44
- run: bundle exec rake
42
+ - uses: actions/cache@v2
43
+ with:
44
+ path: vendor/bundle
45
+ key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
46
+ restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
47
+
48
+ - run: bundle config set path 'vendor/bundle'
49
+
50
+ - run: bundle install --jobs 4 --retry 3
51
+
52
+ - run: bundle exec rake
53
+
54
+ tests-passed:
55
+ needs: rake
56
+ runs-on: ubuntu-latest
57
+ steps:
58
+ - name: Trigger tests passed event
59
+ uses: Sibz/github-status-action@v1
60
+ with:
61
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
62
+ context: 'tests-passed-successfully'
63
+ description: 'Tests passed successfully'
64
+ state: 'success'
65
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -1,16 +1,15 @@
1
1
  = metanorma-itu: Metanorma for ITU
2
2
 
3
3
  image:https://img.shields.io/gem/v/metanorma-itu.svg["Gem Version", link="https://rubygems.org/gems/metanorma-itu"]
4
- image:https://github.com/metanorma/metanorma-itu/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-itu/actions?workflow=macos"]
5
- image:https://github.com/metanorma/metanorma-itu/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-itu/actions?workflow=ubuntu"]
6
- image:https://github.com/metanorma/metanorma-itu/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-itu/actions?workflow=windows"]
4
+ image:https://github.com/metanorma/metanorma-itu/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-itu/actions?workflow=rake"]
7
5
  image:https://codeclimate.com/github/metanorma/metanorma-itu/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-itu"]
8
6
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-itu.svg["Pull Requests", link="https://github.com/metanorma/metanorma-itu/pulls"]
9
7
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-itu/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-itu/releases"]
10
8
 
11
9
  == Functionality
12
10
 
13
- This gem processes Metanorma input for generating ITU (ITU-T, ITU-D) documents.
11
+ This gem processes https://www.metanorma.com[Metanorma documents] following a template for generating ITU
12
+ standards and documents.
14
13
 
15
14
  The implementation inherits from https://github.com/metanorma/metanorma-standoc.
16
15
 
@@ -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,15 +729,61 @@
728
729
  </define>
729
730
  <define name="index">
730
731
  <element name="index">
731
- <attribute name="primary"/>
732
+ <attribute name="to">
733
+ <data type="IDREF"/>
734
+ </attribute>
735
+ <element name="primary">
736
+ <oneOrMore>
737
+ <ref name="PureTextElement"/>
738
+ </oneOrMore>
739
+ </element>
732
740
  <optional>
733
- <attribute name="secondary"/>
741
+ <element name="secondary">
742
+ <oneOrMore>
743
+ <ref name="PureTextElement"/>
744
+ </oneOrMore>
745
+ </element>
734
746
  </optional>
735
747
  <optional>
736
- <attribute name="tertiary"/>
748
+ <element name="tertiary">
749
+ <oneOrMore>
750
+ <ref name="PureTextElement"/>
751
+ </oneOrMore>
752
+ </element>
737
753
  </optional>
738
754
  </element>
739
755
  </define>
756
+ <define name="index-xref">
757
+ <element name="index-xref">
758
+ <attribute name="also">
759
+ <data type="boolean"/>
760
+ </attribute>
761
+ <element name="primary">
762
+ <oneOrMore>
763
+ <ref name="PureTextElement"/>
764
+ </oneOrMore>
765
+ </element>
766
+ <optional>
767
+ <element name="secondary">
768
+ <oneOrMore>
769
+ <ref name="PureTextElement"/>
770
+ </oneOrMore>
771
+ </element>
772
+ </optional>
773
+ <optional>
774
+ <element name="tertiary">
775
+ <oneOrMore>
776
+ <ref name="PureTextElement"/>
777
+ </oneOrMore>
778
+ </element>
779
+ </optional>
780
+ <element name="target">
781
+ <oneOrMore>
782
+ <ref name="PureTextElement"/>
783
+ </oneOrMore>
784
+ </element>
785
+ </element>
786
+ </define>
740
787
  <!-- bare ID element, used for referencing arbitrary spans of text -->
741
788
  <define name="bookmark">
742
789
  <element name="bookmark">
@@ -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)
@@ -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
@@ -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)
@@ -24,6 +24,14 @@
24
24
  <start>
25
25
  <ref name="standard-document"/>
26
26
  </start>
27
+ <define name="doctype">
28
+ <element name="doctype">
29
+ <optional>
30
+ <attribute name="abbreviation"/>
31
+ </optional>
32
+ <ref name="DocumentType"/>
33
+ </element>
34
+ </define>
27
35
  <define name="hyperlink">
28
36
  <element name="link">
29
37
  <attribute name="target">
@@ -47,6 +55,13 @@
47
55
  <param name="pattern">\i\c*|\c+#\c+</param>
48
56
  </data>
49
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>
50
65
  <optional>
51
66
  <attribute name="type">
52
67
  <ref name="ReferenceFormat"/>
@@ -141,6 +156,11 @@
141
156
  <data type="boolean"/>
142
157
  </attribute>
143
158
  </optional>
159
+ <optional>
160
+ <attribute name="key">
161
+ <data type="boolean"/>
162
+ </attribute>
163
+ </optional>
144
164
  <oneOrMore>
145
165
  <ref name="dt"/>
146
166
  <ref name="dd"/>
@@ -233,6 +253,12 @@
233
253
  <data type="boolean"/>
234
254
  </attribute>
235
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
259
+ <optional>
260
+ <ref name="colgroup"/>
261
+ </optional>
236
262
  <optional>
237
263
  <ref name="tname"/>
238
264
  </optional>
@@ -751,6 +777,18 @@
751
777
  </define>
752
778
  </include>
753
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>
754
792
  <define name="TextElement" combine="choice">
755
793
  <ref name="concept"/>
756
794
  </define>
@@ -801,6 +839,9 @@
801
839
  <data type="boolean"/>
802
840
  </attribute>
803
841
  </optional>
842
+ <optional>
843
+ <attribute name="number"/>
844
+ </optional>
804
845
  <optional>
805
846
  <attribute name="obligation">
806
847
  <choice>
@@ -856,9 +897,11 @@
856
897
  <element name="code">
857
898
  <text/>
858
899
  </element>
859
- <element name="text">
860
- <text/>
861
- </element>
900
+ <optional>
901
+ <element name="text">
902
+ <text/>
903
+ </element>
904
+ </optional>
862
905
  </element>
863
906
  </define>
864
907
  <define name="standard-document">
@@ -1028,6 +1071,9 @@
1028
1071
  </choice>
1029
1072
  </attribute>
1030
1073
  </optional>
1074
+ <optional>
1075
+ <attribute name="number"/>
1076
+ </optional>
1031
1077
  <optional>
1032
1078
  <attribute name="type"/>
1033
1079
  </optional>
@@ -1081,6 +1127,9 @@
1081
1127
  <optional>
1082
1128
  <attribute name="type"/>
1083
1129
  </optional>
1130
+ <optional>
1131
+ <attribute name="number"/>
1132
+ </optional>
1084
1133
  <optional>
1085
1134
  <ref name="section-title"/>
1086
1135
  </optional>
@@ -1183,6 +1232,9 @@
1183
1232
  <optional>
1184
1233
  <attribute name="type"/>
1185
1234
  </optional>
1235
+ <optional>
1236
+ <attribute name="number"/>
1237
+ </optional>
1186
1238
  <optional>
1187
1239
  <attribute name="obligation">
1188
1240
  <choice>
@@ -1511,6 +1563,7 @@
1511
1563
  <value>add</value>
1512
1564
  <value>modify</value>
1513
1565
  <value>delete</value>
1566
+ <value>replace</value>
1514
1567
  </choice>
1515
1568
  </attribute>
1516
1569
  <optional>
@@ -1541,6 +1594,11 @@
1541
1594
  </optional>
1542
1595
  <optional>
1543
1596
  <element name="newcontent">
1597
+ <optional>
1598
+ <attribute name="id">
1599
+ <data type="ID"/>
1600
+ </attribute>
1601
+ </optional>
1544
1602
  <zeroOrMore>
1545
1603
  <ref name="BasicBlock"/>
1546
1604
  </zeroOrMore>