metanorma-itu 1.2.10 → 1.2.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +9 -29
  3. data/.rubocop.yml +0 -4
  4. data/lib/asciidoctor/itu/basicdoc.rng +5 -3
  5. data/lib/asciidoctor/itu/boilerplate.xml +5 -2
  6. data/lib/asciidoctor/itu/cleanup.rb +9 -0
  7. data/lib/asciidoctor/itu/converter.rb +2 -1
  8. data/lib/asciidoctor/itu/front.rb +19 -20
  9. data/lib/asciidoctor/itu/isodoc.rng +134 -5
  10. data/lib/asciidoctor/itu/itu.rng +76 -0
  11. data/lib/asciidoctor/itu/validate.rb +13 -5
  12. data/lib/isodoc/itu/base_convert.rb +70 -52
  13. data/lib/isodoc/itu/cleanup.rb +55 -0
  14. data/lib/isodoc/itu/html/header.html +12 -8
  15. data/lib/isodoc/itu/html/html_itu_intro.html +1 -1
  16. data/lib/isodoc/itu/html/html_itu_titlepage.html +15 -3
  17. data/lib/isodoc/itu/html/htmlstyle.css +59 -12
  18. data/lib/isodoc/itu/html/htmlstyle.scss +26 -5
  19. data/lib/isodoc/itu/html/word_itu_intro.html +8 -2
  20. data/lib/isodoc/itu/html/word_itu_titlepage.html +29 -6
  21. data/lib/isodoc/itu/html/wordstyle.css +34 -0
  22. data/lib/isodoc/itu/html/wordstyle.scss +33 -0
  23. data/lib/isodoc/itu/html_convert.rb +2 -2
  24. data/lib/isodoc/itu/i18n-en.yaml +4 -0
  25. data/lib/isodoc/itu/itu.implementers-guide.xsl +5889 -0
  26. data/lib/isodoc/itu/itu.in-force.xsl +5889 -0
  27. data/lib/isodoc/itu/itu.recommendation-annex.xsl +1059 -438
  28. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +5889 -0
  29. data/lib/isodoc/itu/itu.recommendation.xsl +1059 -438
  30. data/lib/isodoc/itu/itu.resolution.xsl +1059 -438
  31. data/lib/isodoc/itu/itu.technical-paper.xsl +1059 -438
  32. data/lib/isodoc/itu/itu.technical-report.xsl +1059 -438
  33. data/lib/isodoc/itu/metadata.rb +41 -7
  34. data/lib/isodoc/itu/pdf_convert.rb +5 -8
  35. data/lib/isodoc/itu/presentation_xml_convert.rb +49 -3
  36. data/lib/isodoc/itu/word_convert.rb +2 -2
  37. data/lib/isodoc/itu/xref.rb +101 -43
  38. data/lib/metanorma/itu/processor.rb +1 -0
  39. data/lib/metanorma/itu/version.rb +1 -1
  40. data/metanorma-itu.gemspec +3 -3
  41. metadata +13 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a5e5576a553c84c8a975e21c6f7187fb3d959486fb82da54caa4bae59bc70e4
4
- data.tar.gz: 06e43014128a730fe43d6e602a6a1c83280d09043c458620ecf7c3488e8d29c6
3
+ metadata.gz: ffb983ed512580a604a3c27ad83a232cebe458f4d5596a4a71f3dedfcb7810db
4
+ data.tar.gz: 2f75e990f258c04e5fc8415234b033c9f103bf3d359a2e545bf27b4cabf68877
5
5
  SHA512:
6
- metadata.gz: ec9c3c73670e489535e88bb5abed0956a53dcc692d6fbb95b11507b085f3e8e01342be19fd4ee7ab3d55a11d08fe8566cb643670af29e1ef72979f3653f5b5f0
7
- data.tar.gz: b2996860abd9e0354985b288a2c562b19d8456c0b7b6d4afcdb208f4c29d9efbabc559eb266dcc879fd23569a0fa3542335384d9f7d91567d7de830a6f0ad54a
6
+ metadata.gz: a209fa5be357695a99566411b459852154f5eafd065ce88f6b2bd8d6c32ce8a0720cd0ae1eca1c3881aa4a4590476cf135035804e6120445c2fdc22bd1fc451d
7
+ data.tar.gz: a8bc66759c3be7fe9e072c4e6947737781286c51930f766e314e69f53069c2292e6c505bbfc3e373a5c9c5f4b7c5ba46e5655bd23c45339616c7183bbd272757
@@ -4,7 +4,7 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master, main ]
7
+ branches: [ master, main ]
8
8
  tags: [ v* ]
9
9
  pull_request:
10
10
 
@@ -16,47 +16,27 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.6', '2.5', '2.4' ]
19
+ ruby: [ '2.7', '2.6', '2.5', '2.4' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  include:
23
- - ruby: '2.7'
23
+ - ruby: '3.0'
24
24
  os: 'ubuntu-latest'
25
25
  experimental: true
26
- - ruby: '2.7'
26
+ - ruby: '3.0'
27
27
  os: 'windows-latest'
28
28
  experimental: true
29
- - ruby: '2.7'
29
+ - ruby: '3.0'
30
30
  os: 'macos-latest'
31
31
  experimental: true
32
32
  steps:
33
- - uses: actions/checkout@master
33
+ - uses: actions/checkout@v2
34
+ with:
35
+ submodules: true
34
36
 
35
37
  - uses: ruby/setup-ruby@v1
36
38
  with:
37
39
  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
40
+ bundler-cache: true
48
41
 
49
42
  - 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 }}
data/.rubocop.yml CHANGED
@@ -4,7 +4,3 @@
4
4
 
5
5
  inherit_from:
6
6
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
- AllCops:
8
- TargetRubyVersion: 2.3
9
- Rails:
10
- Enabled: true
@@ -729,9 +729,11 @@
729
729
  </define>
730
730
  <define name="index">
731
731
  <element name="index">
732
- <attribute name="to">
733
- <data type="IDREF"/>
734
- </attribute>
732
+ <optional>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
735
737
  <element name="primary">
736
738
  <oneOrMore>
737
739
  <ref name="PureTextElement"/>
@@ -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)
@@ -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,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("/")
@@ -102,7 +102,7 @@
102
102
  </attribute>
103
103
  </optional>
104
104
  <oneOrMore>
105
- <ref name="li"/>
105
+ <ref name="ul_li"/>
106
106
  </oneOrMore>
107
107
  <zeroOrMore>
108
108
  <ref name="note"/>
@@ -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>
@@ -786,6 +789,9 @@
786
789
  <attribute name="width"/>
787
790
  </element>
788
791
  </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
789
795
  <define name="TextElement" combine="choice">
790
796
  <ref name="concept"/>
791
797
  </define>
@@ -806,6 +812,8 @@
806
812
  <ref name="requirement"/>
807
813
  <ref name="recommendation"/>
808
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
809
817
  </choice>
810
818
  </define>
811
819
  <define name="bibliography">
@@ -836,6 +844,9 @@
836
844
  <data type="boolean"/>
837
845
  </attribute>
838
846
  </optional>
847
+ <optional>
848
+ <attribute name="number"/>
849
+ </optional>
839
850
  <optional>
840
851
  <attribute name="obligation">
841
852
  <choice>
@@ -891,9 +902,11 @@
891
902
  <element name="code">
892
903
  <text/>
893
904
  </element>
894
- <element name="text">
895
- <text/>
896
- </element>
905
+ <optional>
906
+ <element name="text">
907
+ <text/>
908
+ </element>
909
+ </optional>
897
910
  </element>
898
911
  </define>
899
912
  <define name="standard-document">
@@ -906,6 +919,9 @@
906
919
  </choice>
907
920
  </attribute>
908
921
  <ref name="bibdata"/>
922
+ <optional>
923
+ <ref name="misccontainer"/>
924
+ </optional>
909
925
  <optional>
910
926
  <ref name="boilerplate"/>
911
927
  </optional>
@@ -916,11 +932,21 @@
916
932
  <zeroOrMore>
917
933
  <ref name="annex"/>
918
934
  </zeroOrMore>
935
+ <optional>
936
+ <ref name="bibliography"/>
937
+ </optional>
919
938
  <zeroOrMore>
920
- <ref name="references"/>
939
+ <ref name="indexsect"/>
921
940
  </zeroOrMore>
922
941
  </element>
923
942
  </define>
943
+ <define name="misccontainer">
944
+ <element name="misc-container">
945
+ <oneOrMore>
946
+ <ref name="AnyElement"/>
947
+ </oneOrMore>
948
+ </element>
949
+ </define>
924
950
  <define name="preface">
925
951
  <element name="preface">
926
952
  <oneOrMore>
@@ -944,6 +970,11 @@
944
970
  <ref name="Content-Section"/>
945
971
  </element>
946
972
  </define>
973
+ <define name="indexsect">
974
+ <element name="indexsect">
975
+ <ref name="Content-Section"/>
976
+ </element>
977
+ </define>
947
978
  <define name="boilerplate">
948
979
  <element name="boilerplate">
949
980
  <optional>
@@ -1063,6 +1094,9 @@
1063
1094
  </choice>
1064
1095
  </attribute>
1065
1096
  </optional>
1097
+ <optional>
1098
+ <attribute name="number"/>
1099
+ </optional>
1066
1100
  <optional>
1067
1101
  <attribute name="type"/>
1068
1102
  </optional>
@@ -1116,6 +1150,9 @@
1116
1150
  <optional>
1117
1151
  <attribute name="type"/>
1118
1152
  </optional>
1153
+ <optional>
1154
+ <attribute name="number"/>
1155
+ </optional>
1119
1156
  <optional>
1120
1157
  <ref name="section-title"/>
1121
1158
  </optional>
@@ -1218,6 +1255,9 @@
1218
1255
  <optional>
1219
1256
  <attribute name="type"/>
1220
1257
  </optional>
1258
+ <optional>
1259
+ <attribute name="number"/>
1260
+ </optional>
1221
1261
  <optional>
1222
1262
  <attribute name="obligation">
1223
1263
  <choice>
@@ -1546,6 +1586,7 @@
1546
1586
  <value>add</value>
1547
1587
  <value>modify</value>
1548
1588
  <value>delete</value>
1589
+ <value>replace</value>
1549
1590
  </choice>
1550
1591
  </attribute>
1551
1592
  <optional>
@@ -1576,6 +1617,11 @@
1576
1617
  </optional>
1577
1618
  <optional>
1578
1619
  <element name="newcontent">
1620
+ <optional>
1621
+ <attribute name="id">
1622
+ <data type="ID"/>
1623
+ </attribute>
1624
+ </optional>
1579
1625
  <zeroOrMore>
1580
1626
  <ref name="BasicBlock"/>
1581
1627
  </zeroOrMore>
@@ -1609,4 +1655,87 @@
1609
1655
  <text/>
1610
1656
  </element>
1611
1657
  </define>
1658
+ <define name="imagemap">
1659
+ <element name="imagemap">
1660
+ <ref name="figure"/>
1661
+ <zeroOrMore>
1662
+ <element name="area">
1663
+ <attribute name="type">
1664
+ <choice>
1665
+ <value>rect</value>
1666
+ <value>circle</value>
1667
+ <value>ellipse</value>
1668
+ <value>poly</value>
1669
+ </choice>
1670
+ </attribute>
1671
+ <choice>
1672
+ <ref name="xref"/>
1673
+ <ref name="hyperlink"/>
1674
+ <ref name="eref"/>
1675
+ </choice>
1676
+ <oneOrMore>
1677
+ <element name="coords">
1678
+ <attribute name="x">
1679
+ <data type="float"/>
1680
+ </attribute>
1681
+ <attribute name="y">
1682
+ <data type="float"/>
1683
+ </attribute>
1684
+ </element>
1685
+ </oneOrMore>
1686
+ <optional>
1687
+ <element name="radius">
1688
+ <attribute name="x">
1689
+ <data type="float"/>
1690
+ </attribute>
1691
+ <optional>
1692
+ <attribute name="y">
1693
+ <data type="float"/>
1694
+ </attribute>
1695
+ </optional>
1696
+ </element>
1697
+ </optional>
1698
+ </element>
1699
+ </zeroOrMore>
1700
+ </element>
1701
+ </define>
1702
+ <define name="svgmap">
1703
+ <element name="svgmap">
1704
+ <ref name="figure"/>
1705
+ <zeroOrMore>
1706
+ <element name="target">
1707
+ <attribute name="href">
1708
+ <data type="anyURI"/>
1709
+ </attribute>
1710
+ <choice>
1711
+ <ref name="xref"/>
1712
+ <ref name="hyperlink"/>
1713
+ <ref name="eref"/>
1714
+ </choice>
1715
+ </element>
1716
+ </zeroOrMore>
1717
+ </element>
1718
+ </define>
1719
+ <define name="ul_li">
1720
+ <element name="li">
1721
+ <optional>
1722
+ <attribute name="id">
1723
+ <data type="ID"/>
1724
+ </attribute>
1725
+ </optional>
1726
+ <optional>
1727
+ <attribute name="uncheckedcheckbox">
1728
+ <data type="boolean"/>
1729
+ </attribute>
1730
+ </optional>
1731
+ <optional>
1732
+ <attribute name="checkedcheckbox">
1733
+ <data type="boolean"/>
1734
+ </attribute>
1735
+ </optional>
1736
+ <oneOrMore>
1737
+ <ref name="BasicBlock"/>
1738
+ </oneOrMore>
1739
+ </element>
1740
+ </define>
1612
1741
  </grammar>