metanorma-itu 1.2.8 → 1.2.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -0
  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 +29 -14
  8. data/lib/asciidoctor/itu/isodoc.rng +114 -3
  9. data/lib/asciidoctor/itu/itu.rng +70 -0
  10. data/lib/asciidoctor/itu/validate.rb +14 -6
  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 +18 -3
  16. data/lib/isodoc/itu/html/htmlstyle.css +71 -12
  17. data/lib/isodoc/itu/html/htmlstyle.scss +26 -4
  18. data/lib/isodoc/itu/html/logo-sp.png +0 -0
  19. data/lib/isodoc/itu/html/word_itu_intro.html +17 -3
  20. data/lib/isodoc/itu/html/word_itu_titlepage.html +33 -6
  21. data/lib/isodoc/itu/html/word_itu_titlepage_sp.html +108 -0
  22. data/lib/isodoc/itu/html/wordstyle.css +34 -0
  23. data/lib/isodoc/itu/html/wordstyle.scss +33 -0
  24. data/lib/isodoc/itu/html_convert.rb +2 -2
  25. data/lib/isodoc/itu/i18n-en.yaml +32 -0
  26. data/lib/isodoc/itu/itu.recommendation-annex.xsl +933 -375
  27. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +5705 -0
  28. data/lib/isodoc/itu/itu.recommendation.xsl +933 -375
  29. data/lib/isodoc/itu/itu.resolution.xsl +933 -375
  30. data/lib/isodoc/itu/itu.technical-paper.xsl +933 -375
  31. data/lib/isodoc/itu/itu.technical-report.xsl +933 -375
  32. data/lib/isodoc/itu/metadata.rb +57 -9
  33. data/lib/isodoc/itu/pdf_convert.rb +1 -0
  34. data/lib/isodoc/itu/presentation_xml_convert.rb +100 -2
  35. data/lib/isodoc/itu/word_cleanup.rb +1 -0
  36. data/lib/isodoc/itu/word_convert.rb +11 -2
  37. data/lib/isodoc/itu/xref.rb +101 -43
  38. data/lib/metanorma/itu/processor.rb +11 -0
  39. data/lib/metanorma/itu/version.rb +1 -1
  40. data/metanorma-itu.gemspec +2 -2
  41. metadata +11 -8
  42. data/lib/metanorma/itu/fonts_manifest.yaml +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a6bada1aaf7b5e637051d16c6ee680dd610219f37f80eddc03a5bd6ac5accbd
4
- data.tar.gz: 1ac0ac45d4c860c4c71e22e2710655251d2afad206624f6daf30f71fcf936552
3
+ metadata.gz: 340bcccdb9ded5f73eebc8659e51d1dd84c7fb90b9fb8e46982b6f1e6d20e550
4
+ data.tar.gz: 918ca96ab247a0a7438851f23a4f7a9b0fb39df132387ef3dcb81ee5c14c2beb
5
5
  SHA512:
6
- metadata.gz: 632c22a49ec0c545ff27cb8554ec020eb94cc5966da6ccec38e643ec9c30e34a1538793d5dfc3d2311b1a233f3bbbee1460ae433471bc32fcfa7c1bac0431078
7
- data.tar.gz: 97b6073a3c8e1b98aeb09fc1b0b2ee617c7262fdfe46dd35d0f70ffee6d06435ff2cd000aefe27197d61c45854bf170b569862b827d41982e17f0f9963a965c9
6
+ metadata.gz: 3ace4c85c4d8b054bb6f071e4244a036dbc3329b951d32c35bec361c352de8c2f9d4fb5120fb36f30567e3e2556002622628d12cc508692072fc762363e8923d
7
+ data.tar.gz: e721fe79126d50a40035b32c0a9c6250316ae0be45d42381bf61482904c2eac840beca6499695f3604140d5a6243ba04334bf0c8ce9adec2cb7343c8c2f2a17c
@@ -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
@@ -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
@@ -126,12 +124,23 @@ module Asciidoctor
126
124
  end
127
125
  end
128
126
 
129
- 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)
130
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)
131
138
  return unless node.attr("docnumber")
132
139
  xml.docidentifier **{type: "ITU"} do |i|
133
- i << "ITU-#{bureau} "\
134
- "#{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)
135
144
  end
136
145
  xml.docnumber { |i| i << node.attr("docnumber") }
137
146
  end
@@ -188,14 +197,20 @@ module Asciidoctor
188
197
  end
189
198
  end
190
199
 
191
- # also used in tech paper
192
200
  def metadata_techreport(node, xml)
193
- 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
194
203
  a = node.attr("meeting-date") and metadata_meeting_date(a, xml)
195
204
  a = node.attr("intended-type") and xml.intended_type a
196
205
  a = node.attr("source") and xml.source a
197
206
  end
198
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
+
199
214
  def metadata_meeting_date(a, xml)
200
215
  xml.meeting_date do |m|
201
216
  d = a.split("/")
@@ -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>
@@ -784,6 +812,8 @@
784
812
  <ref name="requirement"/>
785
813
  <ref name="recommendation"/>
786
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
787
817
  </choice>
788
818
  </define>
789
819
  <define name="bibliography">
@@ -814,6 +844,9 @@
814
844
  <data type="boolean"/>
815
845
  </attribute>
816
846
  </optional>
847
+ <optional>
848
+ <attribute name="number"/>
849
+ </optional>
817
850
  <optional>
818
851
  <attribute name="obligation">
819
852
  <choice>
@@ -869,9 +902,11 @@
869
902
  <element name="code">
870
903
  <text/>
871
904
  </element>
872
- <element name="text">
873
- <text/>
874
- </element>
905
+ <optional>
906
+ <element name="text">
907
+ <text/>
908
+ </element>
909
+ </optional>
875
910
  </element>
876
911
  </define>
877
912
  <define name="standard-document">
@@ -1041,6 +1076,9 @@
1041
1076
  </choice>
1042
1077
  </attribute>
1043
1078
  </optional>
1079
+ <optional>
1080
+ <attribute name="number"/>
1081
+ </optional>
1044
1082
  <optional>
1045
1083
  <attribute name="type"/>
1046
1084
  </optional>
@@ -1094,6 +1132,9 @@
1094
1132
  <optional>
1095
1133
  <attribute name="type"/>
1096
1134
  </optional>
1135
+ <optional>
1136
+ <attribute name="number"/>
1137
+ </optional>
1097
1138
  <optional>
1098
1139
  <ref name="section-title"/>
1099
1140
  </optional>
@@ -1196,6 +1237,9 @@
1196
1237
  <optional>
1197
1238
  <attribute name="type"/>
1198
1239
  </optional>
1240
+ <optional>
1241
+ <attribute name="number"/>
1242
+ </optional>
1199
1243
  <optional>
1200
1244
  <attribute name="obligation">
1201
1245
  <choice>
@@ -1524,6 +1568,7 @@
1524
1568
  <value>add</value>
1525
1569
  <value>modify</value>
1526
1570
  <value>delete</value>
1571
+ <value>replace</value>
1527
1572
  </choice>
1528
1573
  </attribute>
1529
1574
  <optional>
@@ -1554,6 +1599,11 @@
1554
1599
  </optional>
1555
1600
  <optional>
1556
1601
  <element name="newcontent">
1602
+ <optional>
1603
+ <attribute name="id">
1604
+ <data type="ID"/>
1605
+ </attribute>
1606
+ </optional>
1557
1607
  <zeroOrMore>
1558
1608
  <ref name="BasicBlock"/>
1559
1609
  </zeroOrMore>
@@ -1587,4 +1637,65 @@
1587
1637
  <text/>
1588
1638
  </element>
1589
1639
  </define>
1640
+ <define name="imagemap">
1641
+ <element name="imagemap">
1642
+ <ref name="figure"/>
1643
+ <zeroOrMore>
1644
+ <element name="area">
1645
+ <attribute name="type">
1646
+ <choice>
1647
+ <value>rect</value>
1648
+ <value>circle</value>
1649
+ <value>ellipse</value>
1650
+ <value>poly</value>
1651
+ </choice>
1652
+ </attribute>
1653
+ <choice>
1654
+ <ref name="xref"/>
1655
+ <ref name="hyperlink"/>
1656
+ <ref name="eref"/>
1657
+ </choice>
1658
+ <oneOrMore>
1659
+ <element name="coords">
1660
+ <attribute name="x">
1661
+ <data type="float"/>
1662
+ </attribute>
1663
+ <attribute name="y">
1664
+ <data type="float"/>
1665
+ </attribute>
1666
+ </element>
1667
+ </oneOrMore>
1668
+ <optional>
1669
+ <element name="radius">
1670
+ <attribute name="x">
1671
+ <data type="float"/>
1672
+ </attribute>
1673
+ <optional>
1674
+ <attribute name="y">
1675
+ <data type="float"/>
1676
+ </attribute>
1677
+ </optional>
1678
+ </element>
1679
+ </optional>
1680
+ </element>
1681
+ </zeroOrMore>
1682
+ </element>
1683
+ </define>
1684
+ <define name="svgmap">
1685
+ <element name="svgmap">
1686
+ <ref name="figure"/>
1687
+ <zeroOrMore>
1688
+ <element name="target">
1689
+ <attribute name="href">
1690
+ <data type="anyURI"/>
1691
+ </attribute>
1692
+ <choice>
1693
+ <ref name="xref"/>
1694
+ <ref name="hyperlink"/>
1695
+ <ref name="eref"/>
1696
+ </choice>
1697
+ </element>
1698
+ </zeroOrMore>
1699
+ </element>
1700
+ </define>
1590
1701
  </grammar>