metanorma-itu 1.2.3 → 1.2.8

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 +62 -0
  3. data/README.adoc +3 -4
  4. data/lib/asciidoctor/itu/basicdoc.rng +4 -11
  5. data/lib/asciidoctor/itu/converter.rb +3 -2
  6. data/lib/asciidoctor/itu/front.rb +55 -12
  7. data/lib/asciidoctor/itu/isodoc.rng +27 -50
  8. data/lib/asciidoctor/itu/itu.rng +68 -0
  9. data/lib/asciidoctor/itu/validate.rb +1 -8
  10. data/lib/isodoc/itu/base_convert.rb +1 -6
  11. data/lib/isodoc/itu/html/_coverpage.css +8 -1
  12. data/lib/isodoc/itu/html/_coverpage.scss +4 -0
  13. data/lib/isodoc/itu/html/header.html +8 -8
  14. data/lib/isodoc/itu/html/html_itu_titlepage.html +27 -13
  15. data/lib/isodoc/itu/html/htmlstyle.css +787 -776
  16. data/lib/isodoc/itu/html/htmlstyle.scss +6 -8
  17. data/lib/isodoc/itu/html/itu.css +43 -43
  18. data/lib/isodoc/itu/html/itu.scss +44 -43
  19. data/lib/isodoc/itu/html/word_itu_intro.html +18 -0
  20. data/lib/isodoc/itu/html/word_itu_titlepage.html +139 -4
  21. data/lib/isodoc/itu/html/wordstyle.css +37 -37
  22. data/lib/isodoc/itu/html/wordstyle.scss +37 -37
  23. data/lib/isodoc/itu/html_convert.rb +7 -2
  24. data/lib/isodoc/itu/i18n-en.yaml +14 -0
  25. data/lib/isodoc/itu/itu.recommendation-annex.xsl +1020 -179
  26. data/lib/isodoc/itu/itu.recommendation.xsl +1020 -179
  27. data/lib/isodoc/itu/itu.resolution.xsl +1020 -179
  28. data/lib/isodoc/itu/itu.technical-paper.xsl +5147 -0
  29. data/lib/isodoc/itu/itu.technical-report.xsl +5147 -0
  30. data/lib/isodoc/itu/metadata.rb +64 -3
  31. data/lib/isodoc/itu/pdf_convert.rb +2 -0
  32. data/lib/isodoc/itu/presentation_xml_convert.rb +16 -0
  33. data/lib/isodoc/itu/ref.rb +0 -13
  34. data/lib/isodoc/itu/terms.rb +7 -30
  35. data/lib/isodoc/itu/word_cleanup.rb +4 -1
  36. data/lib/isodoc/itu/word_convert.rb +6 -1
  37. data/lib/isodoc/itu/xref.rb +3 -2
  38. data/lib/metanorma/itu/fonts_manifest.yaml +4 -0
  39. data/lib/metanorma/itu/processor.rb +0 -8
  40. data/lib/metanorma/itu/version.rb +1 -1
  41. data/metanorma-itu.gemspec +4 -2
  42. metadata +38 -9
  43. data/.github/workflows/macos.yml +0 -38
  44. data/.github/workflows/ubuntu.yml +0 -56
  45. data/.github/workflows/windows.yml +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2928c54fd6da163508649bdf9367bdf62f8e65ec3c2f598f4ab7d66911da6429
4
- data.tar.gz: 21886b70fdec2eb308d94580d685bd78a6c7aa0faf5ced0556bd4a3ab59d245e
3
+ metadata.gz: 3a6bada1aaf7b5e637051d16c6ee680dd610219f37f80eddc03a5bd6ac5accbd
4
+ data.tar.gz: 1ac0ac45d4c860c4c71e22e2710655251d2afad206624f6daf30f71fcf936552
5
5
  SHA512:
6
- metadata.gz: 782bc386c1bf33a61b33c953e427b9a695ae802e23489734e471a51c6ceca75a63e11111fd0d757864e899f0d2f8af190cf77862146622c29d9eb6f3c9da1804
7
- data.tar.gz: ac2dbe62d0dd1eb5f9c9c498c8b3708d29762d4f0865e102476a0848479d51357adbda59b92670ffa787e8386a5d902396a6465da757885f5385283643e30f0d
6
+ metadata.gz: 632c22a49ec0c545ff27cb8554ec020eb94cc5966da6ccec38e643ec9c30e34a1538793d5dfc3d2311b1a233f3bbbee1460ae433471bc32fcfa7c1bac0431078
7
+ data.tar.gz: 97b6073a3c8e1b98aeb09fc1b0b2ee617c7262fdfe46dd35d0f70ffee6d06435ff2cd000aefe27197d61c45854bf170b569862b827d41982e17f0f9963a965c9
@@ -0,0 +1,62 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: rake
4
+
5
+ on:
6
+ push:
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
9
+ pull_request:
10
+
11
+ jobs:
12
+ rake:
13
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
+ runs-on: ${{ matrix.os }}
15
+ continue-on-error: ${{ matrix.experimental }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: [ '2.6', '2.5', '2.4' ]
20
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
21
+ experimental: [ false ]
22
+ include:
23
+ - ruby: '2.7'
24
+ os: 'ubuntu-latest'
25
+ experimental: true
26
+ - ruby: '2.7'
27
+ os: 'windows-latest'
28
+ experimental: true
29
+ - ruby: '2.7'
30
+ os: 'macos-latest'
31
+ experimental: true
32
+ steps:
33
+ - uses: actions/checkout@master
34
+
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{ matrix.ruby }}
38
+
39
+ - uses: actions/cache@v2
40
+ with:
41
+ path: vendor/bundle
42
+ key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
43
+ restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
44
+
45
+ - run: bundle config set path 'vendor/bundle'
46
+
47
+ - run: bundle install --jobs 4 --retry 3
48
+
49
+ - run: bundle exec rake
50
+
51
+ tests-passed:
52
+ needs: rake
53
+ runs-on: ubuntu-latest
54
+ steps:
55
+ - name: Trigger tests passed event
56
+ uses: Sibz/github-status-action@v1
57
+ with:
58
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
59
+ context: 'tests-passed-successfully'
60
+ description: 'Tests passed successfully'
61
+ state: 'success'
62
+ 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
 
@@ -158,17 +158,7 @@
158
158
  <data type="ID"/>
159
159
  </attribute>
160
160
  <oneOrMore>
161
- <choice>
162
- <ref name="formula"/>
163
- <ref name="ul"/>
164
- <ref name="ol"/>
165
- <ref name="dl"/>
166
- <ref name="quote"/>
167
- <ref name="sourcecode"/>
168
- <ref name="paragraph"/>
169
- <ref name="table"/>
170
- <ref name="figure"/>
171
- </choice>
161
+ <ref name="paragraph"/>
172
162
  </oneOrMore>
173
163
  </element>
174
164
  </define>
@@ -1028,6 +1018,9 @@
1028
1018
  <value>alphabet_upper</value>
1029
1019
  </choice>
1030
1020
  </attribute>
1021
+ <optional>
1022
+ <attribute name="start"/>
1023
+ </optional>
1031
1024
  <oneOrMore>
1032
1025
  <ref name="li"/>
1033
1026
  </oneOrMore>
@@ -60,8 +60,9 @@ module Asciidoctor
60
60
  nil, false, "#{@filename}.html")
61
61
  doc_converter(node).convert(@filename + ".presentation.xml",
62
62
  nil, false, "#{@filename}.doc")
63
- pdf_converter(node)&.convert(@filename + ".presentation.xml",
64
- nil, false, "#{@filename}.pdf")
63
+ node.attr("no-pdf") or
64
+ pdf_converter(node)&.convert(@filename + ".presentation.xml",
65
+ nil, false, "#{@filename}.pdf")
65
66
  end
66
67
 
67
68
  def validate(doc)
@@ -34,32 +34,34 @@ module Asciidoctor
34
34
  type = /^annex/.match(k) ? "annex" : "main"
35
35
  xml.title **attr_code(language: lang, format: "text/plain",
36
36
  type: type) do |t|
37
- t << v
37
+ t << Asciidoctor::Standoc::Utils::asciidoc_sub(v)
38
38
  end
39
39
  end
40
40
  end
41
41
 
42
42
  def title(node, xml)
43
43
  super
44
- subtitle_english(node, xml)
45
- subtitle_otherlangs(node, xml)
44
+ %w(subtitle amendment-title corrigendum-title).each do |t|
45
+ other_title_english(node, xml, t)
46
+ other_title_otherlangs(node, xml, t)
47
+ end
46
48
  end
47
49
 
48
- def subtitle_english(node, xml)
49
- at = { language: "en", format: "text/plain", type: "subtitle" }
50
- a = node.attr("subtitle") || node.attr("subtitle-en")
50
+ def other_title_english(node, xml, type)
51
+ at = { language: "en", format: "text/plain", type: type.sub(/-title/, "") }
52
+ a = node.attr(type) || node.attr("#{type}-en")
51
53
  xml.title **attr_code(at) do |t|
52
54
  t << Asciidoctor::Standoc::Utils::asciidoc_sub(a)
53
55
  end
54
56
  end
55
57
 
56
- def subtitle_otherlangs(node, xml)
58
+ def other_title_otherlangs(node, xml, type)
57
59
  node.attributes.each do |k, v|
58
- next unless /^subtitle-(?<lang>.+)$/ =~ k
59
- next if lang == "en"
60
- xml.title **attr_code(language: lang, format: "text/plain",
61
- type: "subtitle") do |t|
62
- t << v
60
+ next unless m = /^#{type}-(?<lang>.+)$/.match(k)
61
+ next if m[:lang] == "en"
62
+ xml.title **attr_code(language: m[:lang], format: "text/plain",
63
+ type: type.sub(/-title/, "")) do |t|
64
+ t << Asciidoctor::Standoc::Utils::asciidoc_sub(v)
63
65
  end
64
66
  end
65
67
  end
@@ -114,6 +116,7 @@ module Asciidoctor
114
116
  def metadata_id(node, xml)
115
117
  provisional_id(node, xml)
116
118
  itu_id(node, xml)
119
+ recommendation_id(node, xml)
117
120
  end
118
121
 
119
122
  def provisional_id(node, xml)
@@ -133,6 +136,15 @@ module Asciidoctor
133
136
  xml.docnumber { |i| i << node.attr("docnumber") }
134
137
  end
135
138
 
139
+ def recommendation_id(node, xml)
140
+ return unless node.attr("recommendationnumber")
141
+ node.attr("recommendationnumber").split("/").each do |s|
142
+ xml.docidentifier **{type: "ITU-Recommendation"} do |i|
143
+ i << s
144
+ end
145
+ end
146
+ end
147
+
136
148
  def metadata_series(node, xml)
137
149
  node.attr("series") and
138
150
  xml.series **{ type: "main" } do |s|
@@ -171,6 +183,36 @@ module Asciidoctor
171
183
  i.bureau node.attr("bureau") || "T"
172
184
  i.docnumber node.attr("docnumber")
173
185
  a = node.attr("annexid") and i.annexid a
186
+ a = node.attr("amendment-number") and i.amendment a
187
+ a = node.attr("corrigendum-number") and i.corrigendum a
188
+ end
189
+ end
190
+
191
+ # also used in tech paper
192
+ def metadata_techreport(node, xml)
193
+ a = node.attr("meeting") and xml.meeting a
194
+ a = node.attr("meeting-date") and metadata_meeting_date(a, xml)
195
+ a = node.attr("intended-type") and xml.intended_type a
196
+ a = node.attr("source") and xml.source a
197
+ end
198
+
199
+ def metadata_meeting_date(a, xml)
200
+ xml.meeting_date do |m|
201
+ d = a.split("/")
202
+ if d.size > 1
203
+ m.from d[0]
204
+ m.to d[1]
205
+ else
206
+ m.on d[0]
207
+ end
208
+ end
209
+ end
210
+
211
+ def personal_role(node, c, suffix)
212
+ if node.attr("role#{suffix}")&.downcase == "rapporteur"
213
+ c.role "raporteur", **{ type: "editor" }
214
+ else
215
+ super
174
216
  end
175
217
  end
176
218
 
@@ -180,6 +222,7 @@ module Asciidoctor
180
222
  metadata_ics(node, xml)
181
223
  metadata_recommendationstatus(node, xml)
182
224
  metadata_ip_notice(node, xml)
225
+ metadata_techreport(node, xml)
183
226
  structured_id(node, xml)
184
227
  end
185
228
  end
@@ -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">
@@ -42,7 +50,6 @@
42
50
  </define>
43
51
  <define name="xref">
44
52
  <element name="xref">
45
- <!-- attribute target { xsd:IDREF }, -->
46
53
  <attribute name="target">
47
54
  <data type="string">
48
55
  <param name="pattern">\i\c*|\c+#\c+</param>
@@ -64,6 +71,11 @@
64
71
  </choice>
65
72
  </attribute>
66
73
  </optional>
74
+ <optional>
75
+ <attribute name="droploc">
76
+ <data type="boolean"/>
77
+ </attribute>
78
+ </optional>
67
79
  <text/>
68
80
  </element>
69
81
  </define>
@@ -137,6 +149,11 @@
137
149
  <data type="boolean"/>
138
150
  </attribute>
139
151
  </optional>
152
+ <optional>
153
+ <attribute name="key">
154
+ <data type="boolean"/>
155
+ </attribute>
156
+ </optional>
140
157
  <oneOrMore>
141
158
  <ref name="dt"/>
142
159
  <ref name="dd"/>
@@ -859,6 +876,13 @@
859
876
  </define>
860
877
  <define name="standard-document">
861
878
  <element name="standard-document">
879
+ <attribute name="version"/>
880
+ <attribute name="type">
881
+ <choice>
882
+ <value>semantic</value>
883
+ <value>presentation</value>
884
+ </choice>
885
+ </attribute>
862
886
  <ref name="bibdata"/>
863
887
  <optional>
864
888
  <ref name="boilerplate"/>
@@ -880,7 +904,7 @@
880
904
  <oneOrMore>
881
905
  <choice>
882
906
  <ref name="content"/>
883
- <ref name="preface_abstract"/>
907
+ <ref name="abstract"/>
884
908
  <ref name="foreword"/>
885
909
  <ref name="introduction"/>
886
910
  <ref name="acknowledgements"/>
@@ -1153,49 +1177,7 @@
1153
1177
  </define>
1154
1178
  <define name="annex">
1155
1179
  <element name="annex">
1156
- <optional>
1157
- <attribute name="id">
1158
- <data type="ID"/>
1159
- </attribute>
1160
- </optional>
1161
- <optional>
1162
- <attribute name="language"/>
1163
- </optional>
1164
- <optional>
1165
- <attribute name="script"/>
1166
- </optional>
1167
- <optional>
1168
- <attribute name="inline-header">
1169
- <data type="boolean"/>
1170
- </attribute>
1171
- </optional>
1172
- <attribute name="obligation">
1173
- <choice>
1174
- <value>normative</value>
1175
- <value>informative</value>
1176
- </choice>
1177
- </attribute>
1178
- <optional>
1179
- <ref name="section-title"/>
1180
- </optional>
1181
- <group>
1182
- <group>
1183
- <zeroOrMore>
1184
- <ref name="BasicBlock"/>
1185
- </zeroOrMore>
1186
- <zeroOrMore>
1187
- <ref name="note"/>
1188
- </zeroOrMore>
1189
- </group>
1190
- <zeroOrMore>
1191
- <choice>
1192
- <ref name="annex-subsection"/>
1193
- <ref name="terms"/>
1194
- <ref name="definitions"/>
1195
- <ref name="references"/>
1196
- </choice>
1197
- </zeroOrMore>
1198
- </group>
1180
+ <ref name="Annex-Section"/>
1199
1181
  </element>
1200
1182
  </define>
1201
1183
  <define name="terms">
@@ -1481,11 +1463,6 @@
1481
1463
  </optional>
1482
1464
  </element>
1483
1465
  </define>
1484
- <define name="preface_abstract">
1485
- <element name="abstract">
1486
- <ref name="Basic-Section"/>
1487
- </element>
1488
- </define>
1489
1466
  <define name="term-clause">
1490
1467
  <element name="clause">
1491
1468
  <optional>
@@ -41,6 +41,7 @@
41
41
  <value>technical-report</value>
42
42
  <value>joint-itu-iso-iec</value>
43
43
  <value>resolution</value>
44
+ <value>service-publication</value>
44
45
  </choice>
45
46
  </define>
46
47
  <define name="editorialgroup">
@@ -68,6 +69,16 @@
68
69
  <text/>
69
70
  </element>
70
71
  </optional>
72
+ <optional>
73
+ <element name="amendment">
74
+ <data type="int"/>
75
+ </element>
76
+ </optional>
77
+ <optional>
78
+ <element name="corrigendum">
79
+ <data type="int"/>
80
+ </element>
81
+ </optional>
71
82
  </element>
72
83
  </define>
73
84
  <define name="BibDataExtensionType">
@@ -84,6 +95,18 @@
84
95
  <optional>
85
96
  <ref name="ipnoticereceived"/>
86
97
  </optional>
98
+ <optional>
99
+ <ref name="meeting"/>
100
+ </optional>
101
+ <optional>
102
+ <ref name="meeting-date"/>
103
+ </optional>
104
+ <optional>
105
+ <ref name="intended-type"/>
106
+ </optional>
107
+ <optional>
108
+ <ref name="ext_source"/>
109
+ </optional>
87
110
  <optional>
88
111
  <ref name="structuredidentifier"/>
89
112
  </optional>
@@ -103,6 +126,44 @@
103
126
  </element>
104
127
  </define>
105
128
  </include>
129
+ <define name="meeting">
130
+ <element name="meeting">
131
+ <text/>
132
+ </element>
133
+ </define>
134
+ <define name="meeting-date">
135
+ <element name="meeting-date">
136
+ <choice>
137
+ <group>
138
+ <element name="from">
139
+ <ref name="ISO8601Date"/>
140
+ </element>
141
+ <optional>
142
+ <element name="to">
143
+ <ref name="ISO8601Date"/>
144
+ </element>
145
+ </optional>
146
+ </group>
147
+ <element name="on">
148
+ <ref name="ISO8601Date"/>
149
+ </element>
150
+ </choice>
151
+ </element>
152
+ </define>
153
+ <define name="intended-type">
154
+ <element name="intended-type">
155
+ <choice>
156
+ <value>R</value>
157
+ <value>C</value>
158
+ <value>TD</value>
159
+ </choice>
160
+ </element>
161
+ </define>
162
+ <define name="ext_source">
163
+ <element name="source">
164
+ <text/>
165
+ </element>
166
+ </define>
106
167
  <define name="TextElement" combine="choice">
107
168
  <choice>
108
169
  <ref name="add"/>
@@ -244,6 +305,13 @@
244
305
  </define>
245
306
  <define name="itu">
246
307
  <element name="itu-standard">
308
+ <attribute name="version"/>
309
+ <attribute name="type">
310
+ <choice>
311
+ <value>semantic</value>
312
+ <value>presentation</value>
313
+ </choice>
314
+ </attribute>
247
315
  <ref name="bibdata"/>
248
316
  <zeroOrMore>
249
317
  <ref name="termdocsource"/>