metanorma-itu 1.2.9 → 1.2.14

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 +11 -22
  3. data/.rubocop.yml +0 -4
  4. data/lib/asciidoctor/itu/basicdoc.rng +20 -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 +118 -4
  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 +5705 -0
  26. data/lib/isodoc/itu/itu.in-force.xsl +5705 -0
  27. data/lib/isodoc/itu/itu.recommendation-annex.xsl +897 -376
  28. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +5705 -0
  29. data/lib/isodoc/itu/itu.recommendation.xsl +897 -376
  30. data/lib/isodoc/itu/itu.resolution.xsl +897 -376
  31. data/lib/isodoc/itu/itu.technical-paper.xsl +897 -376
  32. data/lib/isodoc/itu/itu.technical-report.xsl +897 -376
  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 +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: 4a55d05a3d934a812b372c286512e5fb68669e934fdf564af21ec47695680374
4
- data.tar.gz: c4a84f598551512a1dcd029c5af2b765a8ffa133f2d8f88df6e4b2fe04ff6bce
3
+ metadata.gz: bb90a7538cd02f6e27fb05a6315dcb7d4e346c366207a9a592e7c3cd0452ccea
4
+ data.tar.gz: 9ebf7d79f72c347f6d8e552fb052c9d6136d8e318703bff1b480d0b4475a9d4b
5
5
  SHA512:
6
- metadata.gz: f5b9e4c6265927997e40bb3178040efde32681cf159a1a33e560b02c0e982b8de2efa5851f161425860e487bb455eeac848c76b14d5823100bd2c5ffd7f8a310
7
- data.tar.gz: 2e2b8bab79a9085704a8fab36944fe0670ca37758e156e4fac20e67cb713f7337b0cc13a23042296e28ac313c1152cc6ca48212be033ccfffdfb074fbe30f074
6
+ metadata.gz: dd679ec6c5e2cd43a01b1ade453faaa224159e10f2e14e8bb7c94c4f22d86eeb7b8d37350d48c8fb8c5e5a4076ac734ee8725b031c8d82f89c60e7a9f8bd8a83
7
+ data.tar.gz: f7075597cb2b0bca44adfce25e6982781beb2d04d1b91d206e9807b218d1a6f106df7ce21dde2002bcb5e2265c594630b22a16b235c428431303231513900cc3
@@ -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,17 +16,17 @@ 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:
@@ -35,16 +35,7 @@ jobs:
35
35
  - uses: ruby/setup-ruby@v1
36
36
  with:
37
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
38
+ bundler-cache: true
48
39
 
49
40
  - run: bundle exec rake
50
41
 
@@ -52,11 +43,9 @@ jobs:
52
43
  needs: rake
53
44
  runs-on: ubuntu-latest
54
45
  steps:
55
- - name: Trigger tests passed event
56
- uses: Sibz/github-status-action@v1
46
+ - uses: peter-evans/repository-dispatch@v1
57
47
  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 }}
48
+ token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
49
+ repository: ${{ github.repository }}
50
+ event-type: notify
51
+ client-payload: '{"ref": "${{ github.ref }}", "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,12 +729,29 @@
729
729
  </define>
730
730
  <define name="index">
731
731
  <element name="index">
732
- <attribute name="primary"/>
733
732
  <optional>
734
- <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>
735
748
  </optional>
736
749
  <optional>
737
- <attribute name="tertiary"/>
750
+ <element name="tertiary">
751
+ <oneOrMore>
752
+ <ref name="PureTextElement"/>
753
+ </oneOrMore>
754
+ </element>
738
755
  </optional>
739
756
  </element>
740
757
  </define>
@@ -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("/")
@@ -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,9 @@
246
253
  <data type="boolean"/>
247
254
  </attribute>
248
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
249
259
  <optional>
250
260
  <ref name="colgroup"/>
251
261
  </optional>
@@ -779,6 +789,9 @@
779
789
  <attribute name="width"/>
780
790
  </element>
781
791
  </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
782
795
  <define name="TextElement" combine="choice">
783
796
  <ref name="concept"/>
784
797
  </define>
@@ -799,6 +812,8 @@
799
812
  <ref name="requirement"/>
800
813
  <ref name="recommendation"/>
801
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
802
817
  </choice>
803
818
  </define>
804
819
  <define name="bibliography">
@@ -829,6 +844,9 @@
829
844
  <data type="boolean"/>
830
845
  </attribute>
831
846
  </optional>
847
+ <optional>
848
+ <attribute name="number"/>
849
+ </optional>
832
850
  <optional>
833
851
  <attribute name="obligation">
834
852
  <choice>
@@ -884,9 +902,11 @@
884
902
  <element name="code">
885
903
  <text/>
886
904
  </element>
887
- <element name="text">
888
- <text/>
889
- </element>
905
+ <optional>
906
+ <element name="text">
907
+ <text/>
908
+ </element>
909
+ </optional>
890
910
  </element>
891
911
  </define>
892
912
  <define name="standard-document">
@@ -899,6 +919,9 @@
899
919
  </choice>
900
920
  </attribute>
901
921
  <ref name="bibdata"/>
922
+ <optional>
923
+ <ref name="misccontainer"/>
924
+ </optional>
902
925
  <optional>
903
926
  <ref name="boilerplate"/>
904
927
  </optional>
@@ -909,11 +932,21 @@
909
932
  <zeroOrMore>
910
933
  <ref name="annex"/>
911
934
  </zeroOrMore>
935
+ <optional>
936
+ <ref name="bibliography"/>
937
+ </optional>
912
938
  <zeroOrMore>
913
- <ref name="references"/>
939
+ <ref name="indexsect"/>
914
940
  </zeroOrMore>
915
941
  </element>
916
942
  </define>
943
+ <define name="misccontainer">
944
+ <element name="misc-container">
945
+ <oneOrMore>
946
+ <ref name="AnyElement"/>
947
+ </oneOrMore>
948
+ </element>
949
+ </define>
917
950
  <define name="preface">
918
951
  <element name="preface">
919
952
  <oneOrMore>
@@ -937,6 +970,11 @@
937
970
  <ref name="Content-Section"/>
938
971
  </element>
939
972
  </define>
973
+ <define name="indexsect">
974
+ <element name="indexsect">
975
+ <ref name="Content-Section"/>
976
+ </element>
977
+ </define>
940
978
  <define name="boilerplate">
941
979
  <element name="boilerplate">
942
980
  <optional>
@@ -1056,6 +1094,9 @@
1056
1094
  </choice>
1057
1095
  </attribute>
1058
1096
  </optional>
1097
+ <optional>
1098
+ <attribute name="number"/>
1099
+ </optional>
1059
1100
  <optional>
1060
1101
  <attribute name="type"/>
1061
1102
  </optional>
@@ -1109,6 +1150,9 @@
1109
1150
  <optional>
1110
1151
  <attribute name="type"/>
1111
1152
  </optional>
1153
+ <optional>
1154
+ <attribute name="number"/>
1155
+ </optional>
1112
1156
  <optional>
1113
1157
  <ref name="section-title"/>
1114
1158
  </optional>
@@ -1211,6 +1255,9 @@
1211
1255
  <optional>
1212
1256
  <attribute name="type"/>
1213
1257
  </optional>
1258
+ <optional>
1259
+ <attribute name="number"/>
1260
+ </optional>
1214
1261
  <optional>
1215
1262
  <attribute name="obligation">
1216
1263
  <choice>
@@ -1539,6 +1586,7 @@
1539
1586
  <value>add</value>
1540
1587
  <value>modify</value>
1541
1588
  <value>delete</value>
1589
+ <value>replace</value>
1542
1590
  </choice>
1543
1591
  </attribute>
1544
1592
  <optional>
@@ -1569,6 +1617,11 @@
1569
1617
  </optional>
1570
1618
  <optional>
1571
1619
  <element name="newcontent">
1620
+ <optional>
1621
+ <attribute name="id">
1622
+ <data type="ID"/>
1623
+ </attribute>
1624
+ </optional>
1572
1625
  <zeroOrMore>
1573
1626
  <ref name="BasicBlock"/>
1574
1627
  </zeroOrMore>
@@ -1602,4 +1655,65 @@
1602
1655
  <text/>
1603
1656
  </element>
1604
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>
1605
1719
  </grammar>