metanorma-itu 1.3.0 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ed5bdd15fc291b42dd7b7760aea1a16d11e20cbd098baed7d9670cf4377bef6
4
- data.tar.gz: dd1cae93081ac5da55e4b1efee4fd908bf9fde4e01e244ae59ea061cb2d0262e
3
+ metadata.gz: 6c0181164c1a02d09ba04043e4b8e0ffe8fc2c3d217d5c141118e8fdb283e438
4
+ data.tar.gz: d9b9f89b8e7156114e69a5b489ec916ae94cfe848961e7f3703b070f59f17f8f
5
5
  SHA512:
6
- metadata.gz: 42380cb1f49fed3fc99f51e3455049cdf907b158dad19da9ae2a244a761802924ff1727af053f604bfbfab933dab73bd3b225c03af9318fd15362aebf7d89d7c
7
- data.tar.gz: 1b4ced1d5237dd83b90254a77a47ed71f3ee97e4b9dc468e09789f8a4d9dd5efda9fd418b42a2e618ee6e66c0404ec43bbd9b0bc1d5e57bf0b8457d0ee5507d3
6
+ metadata.gz: b95365c930cccd659f770fa364f79208f6720b21af9ef60437f34a974f5555ec6f8d31ebb36fe209601f07da8d4e63bbc2ff43c552cdf872d037ee83a9fc2937
7
+ data.tar.gz: e947079f69907e22483af10044997e7adbd4fe65294f975362cf119d0419728ca7c0965e6f7215dd9523320de04142013a6380ae96c436ff18b39e6d77c5e748
@@ -16,19 +16,9 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.7', '2.6', '2.5', '2.4' ]
19
+ ruby: [ '3.0', '2.7', '2.6', '2.5', '2.4' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
- include:
23
- - ruby: '3.0'
24
- os: 'ubuntu-latest'
25
- experimental: true
26
- - ruby: '3.0'
27
- os: 'windows-latest'
28
- experimental: true
29
- - ruby: '3.0'
30
- os: 'macos-latest'
31
- experimental: true
32
22
  steps:
33
23
  - uses: actions/checkout@v2
34
24
  with:
@@ -40,3 +30,14 @@ jobs:
40
30
  bundler-cache: true
41
31
 
42
32
  - run: bundle exec rake
33
+
34
+ tests-passed:
35
+ needs: rake
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: peter-evans/repository-dispatch@v1
39
+ with:
40
+ token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
41
+ repository: ${{ github.repository }}
42
+ event-type: tests-passed
43
+ client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
data/.hound.yml CHANGED
@@ -1,3 +1,5 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
1
3
  ruby:
2
- Enabled: true
4
+ enabled: true
3
5
  config_file: .rubocop.yml
data/.rubocop.yml CHANGED
@@ -1,14 +1,10 @@
1
- # This project follows the Ribose OSS style guide.
2
- # https://github.com/riboseinc/oss-guides
3
- # All project-specific additions and overrides should be specified in this file.
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
4
3
  inherit_from:
5
4
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
6
5
 
7
6
  # local repo-specific modifications
7
+ # ...
8
8
 
9
9
  AllCops:
10
- DisplayCopNames: false
11
- StyleGuideCopsOnly: false
12
- TargetRubyVersion: 2.4
13
- Rails:
14
- Enabled: true
10
+ TargetRubyVersion: 2.5
@@ -787,6 +787,7 @@
787
787
  <value>adapted</value>
788
788
  <value>vote-started</value>
789
789
  <value>vote-ended</value>
790
+ <value>announced</value>
790
791
  </choice>
791
792
  </define>
792
793
  <define name="bdate">
@@ -48,14 +48,14 @@ module Asciidoctor
48
48
  end
49
49
 
50
50
  def outputs(node, ret)
51
- File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
52
- presentation_xml_converter(node).convert(@filename + ".xml")
53
- html_converter(node).convert(@filename + ".presentation.xml",
51
+ File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
52
+ presentation_xml_converter(node).convert("#{@filename}.xml")
53
+ html_converter(node).convert("#{@filename}.presentation.xml",
54
54
  nil, false, "#{@filename}.html")
55
- doc_converter(node).convert(@filename + ".presentation.xml",
55
+ doc_converter(node).convert("#{@filename}.presentation.xml",
56
56
  nil, false, "#{@filename}.doc")
57
57
  node.attr("no-pdf") or
58
- pdf_converter(node)&.convert(@filename + ".presentation.xml",
58
+ pdf_converter(node)&.convert("#{@filename}.presentation.xml",
59
59
  nil, false, "#{@filename}.pdf")
60
60
  end
61
61
 
@@ -65,8 +65,8 @@ module Asciidoctor
65
65
  File.join(File.dirname(__FILE__), "itu.rng"))
66
66
  end
67
67
 
68
- def style(n, t)
69
- return
68
+ def style(_node, _text)
69
+ nil
70
70
  end
71
71
 
72
72
  def sectiontype_streamline(ret)
@@ -84,16 +84,16 @@ module Asciidoctor
84
84
  def sectiontype(node, level = true)
85
85
  ret = super
86
86
  hdr = sectiontype_streamline(node&.attr("heading")&.downcase)
87
- return nil if ret == "terms and definitions" &&
87
+ return nil if ret == "terms and definitions" &&
88
88
  hdr != "terms and definitions" && node.level > 1
89
- return nil if ret == "symbols and abbreviated terms" &&
89
+ return nil if ret == "symbols and abbreviated terms" &&
90
90
  hdr != "symbols and abbreviated terms" && node.level > 1
91
91
 
92
92
  ret
93
93
  end
94
94
 
95
95
  def term_def_subclause_parse(attrs, xml, node)
96
- case clausetype = sectiontype1(node)
96
+ case sectiontype1(node)
97
97
  when "terms defined in this recommendation"
98
98
  term_def_parse(attrs.merge(type: "internal"), xml, node, false)
99
99
  when "terms defined elsewhere"
@@ -106,11 +106,17 @@ module Asciidoctor
106
106
  def metadata_keywords(node, xml)
107
107
  return unless node.attr("keywords")
108
108
 
109
- node.attr("keywords").split(/,[ ]*/).sort.each_with_index do |kw, i|
110
- xml.keyword (i == 0 ? kw.capitalize : kw)
109
+ node.attr("keywords").split(/, */).sort.each_with_index do |kw, i|
110
+ xml.keyword (i.zero? ? strict_capitalize(kw) : kw)
111
111
  end
112
112
  end
113
113
 
114
+ def strict_capitalize(str)
115
+ letters = str.split("")
116
+ letters.first.upcase!
117
+ letters.join
118
+ end
119
+
114
120
  def clause_parse(attrs, xml, node)
115
121
  node.option?("unnumbered") and attrs[:unnumbered] = true
116
122
  case sectiontype1(node)
@@ -6,21 +6,24 @@ module Asciidoctor
6
6
  module ITU
7
7
  class Converter < Standoc::Converter
8
8
  def metadata_status(node, xml)
9
+ stage = (node.attr("status") || node.attr("docstage") || "published")
10
+ stage = "draft" if node.attributes.has_key?("draft")
9
11
  xml.status do |s|
10
- s.stage (node.attributes.has_key?("draft") ? "draft" :
11
- (node.attr("status") || node.attr("docstage") || "published" ))
12
+ s.stage stage
12
13
  end
13
14
  end
14
15
 
16
+ def title_attr(type, lang = "en")
17
+ { language: lang, format: "text/plain", type: type }
18
+ end
19
+
15
20
  def title_english(node, xml)
16
- at = { language: "en", format: "text/plain", type: "main" }
17
21
  a = node.attr("title") || node.attr("title-en")
18
- xml.title **attr_code(at) do |t|
22
+ xml.title **attr_code(title_attr("main")) do |t|
19
23
  t << (Metanorma::Utils::asciidoc_sub(a) || node.title)
20
24
  end
21
25
  if a = node.attr("annextitle") || node.attr("annextitle-en")
22
- at[:type] = "annex"
23
- xml.title **attr_code(at) do |t|
26
+ xml.title **attr_code(title_attr("annex")) do |t|
24
27
  t << Metanorma::Utils::asciidoc_sub(a)
25
28
  end
26
29
  end
@@ -30,8 +33,9 @@ module Asciidoctor
30
33
  node.attributes.each do |k, v|
31
34
  next unless /^(annex)?title-(?<lang>.+)$/ =~ k
32
35
  next if lang == "en"
33
- type = /^annex/.match(k) ? "annex" : "main"
34
- xml.title **attr_code(language: lang, format: "text/plain", type: type) do |t|
36
+
37
+ type = /^annex/.match?(k) ? "annex" : "main"
38
+ xml.title **attr_code(title_attr(type, lang)) do |t|
35
39
  t << Metanorma::Utils::asciidoc_sub(v)
36
40
  end
37
41
  end
@@ -40,15 +44,14 @@ module Asciidoctor
40
44
  def title(node, xml)
41
45
  super
42
46
  %w(subtitle amendment-title corrigendum-title).each do |t|
43
- other_title_english(node, xml, t)
44
- other_title_otherlangs(node, xml, t)
47
+ other_title_english(node, xml, t)
48
+ other_title_otherlangs(node, xml, t)
45
49
  end
46
50
  end
47
51
 
48
52
  def other_title_english(node, xml, type)
49
- at = { language: "en", format: "text/plain", type: type.sub(/-title/, "") }
50
53
  a = node.attr(type) || node.attr("#{type}-en")
51
- xml.title **attr_code(at) do |t|
54
+ xml.title **attr_code(title_attr(type.sub(/-title/, ""))) do |t|
52
55
  t << Metanorma::Utils::asciidoc_sub(a)
53
56
  end
54
57
  end
@@ -57,8 +60,9 @@ module Asciidoctor
57
60
  node.attributes.each do |k, v|
58
61
  next unless m = /^#{type}-(?<lang>.+)$/.match(k)
59
62
  next if m[:lang] == "en"
60
- xml.title **attr_code(language: m[:lang], format: "text/plain",
61
- type: type.sub(/-title/, "")) do |t|
63
+
64
+ xml.title **attr_code(title_attr(type.sub(/-title/, ""),
65
+ m[:lang])) do |t|
62
66
  t << Metanorma::Utils::asciidoc_sub(v)
63
67
  end
64
68
  end
@@ -79,7 +83,7 @@ module Asciidoctor
79
83
 
80
84
  def metadata_committee1(node, xml, suffix)
81
85
  xml.editorialgroup do |a|
82
- a.bureau ( node.attr("bureau#{suffix}") || "T" )
86
+ a.bureau ( node.attr("bureau#{suffix}") || "T")
83
87
  if node.attr("group#{suffix}")
84
88
  a.group **attr_code(type: node.attr("grouptype#{suffix}")) do |g|
85
89
  metadata_committee2(node, g, suffix, "")
@@ -119,27 +123,30 @@ module Asciidoctor
119
123
 
120
124
  def provisional_id(node, xml)
121
125
  return unless node.attr("provisional-name")
122
- xml.docidentifier **{type: "ITU-provisional"} do |i|
126
+
127
+ xml.docidentifier **{ type: "ITU-provisional" } do |i|
123
128
  i << node.attr("provisional-name")
124
129
  end
125
130
  end
126
131
 
127
- ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S", "zh" => "C", "ru" => "R" }.freeze
132
+ ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S",
133
+ "zh" => "C", "ru" => "R" }.freeze
128
134
 
129
135
  def itu_id1(node, lang)
130
136
  bureau = node.attr("bureau") || "T"
131
137
  id = doctype(node) == "service-publication" ?
132
138
  @i18n.annex_to_itu_ob_abbrev.sub(/%/, node.attr("docnumber")) :
133
- "ITU-#{bureau} #{node.attr("docnumber")}"
139
+ "ITU-#{bureau} #{node.attr('docnumber')}"
134
140
  id + (lang ? "-#{ITULANG[@lang]}" : "")
135
141
  end
136
142
 
137
143
  def itu_id(node, xml)
138
144
  return unless node.attr("docnumber")
139
- xml.docidentifier **{type: "ITU"} do |i|
145
+
146
+ xml.docidentifier **{ type: "ITU" } do |i|
140
147
  i << itu_id1(node, false)
141
148
  end
142
- xml.docidentifier **{type: "ITU-lang"} do |i|
149
+ xml.docidentifier **{ type: "ITU-lang" } do |i|
143
150
  i << itu_id1(node, true)
144
151
  end
145
152
  xml.docnumber { |i| i << node.attr("docnumber") }
@@ -147,8 +154,9 @@ module Asciidoctor
147
154
 
148
155
  def recommendation_id(node, xml)
149
156
  return unless node.attr("recommendationnumber")
157
+
150
158
  node.attr("recommendationnumber").split("/").each do |s|
151
- xml.docidentifier **{type: "ITU-Recommendation"} do |i|
159
+ xml.docidentifier **{ type: "ITU-Recommendation" } do |i|
152
160
  i << s
153
161
  end
154
162
  end
@@ -171,11 +179,12 @@ module Asciidoctor
171
179
 
172
180
  def metadata_recommendationstatus(node, xml)
173
181
  return unless node.attr("recommendation-from")
182
+
174
183
  xml.recommendationstatus do |s|
175
184
  s.from node.attr("recommendation-from")
176
185
  s.to node.attr("recommendation-to") if node.attr("recommendation-to")
177
186
  if node.attr("approval-process")
178
- s.approvalstage **{process: node.attr("approval-process")} do |a|
187
+ s.approvalstage **{ process: node.attr("approval-process") } do |a|
179
188
  a << node.attr("approval-status")
180
189
  end
181
190
  end
@@ -188,6 +197,7 @@ module Asciidoctor
188
197
 
189
198
  def structured_id(node, xml)
190
199
  return unless node.attr("docnumber")
200
+
191
201
  xml.structuredidentifier do |i|
192
202
  i.bureau node.attr("bureau") || "T"
193
203
  i.docnumber node.attr("docnumber")
@@ -198,7 +208,8 @@ module Asciidoctor
198
208
  end
199
209
 
200
210
  def metadata_techreport(node, xml)
201
- a = node.attr("meeting") and metadata_meeting(a, node.attr("meeting-acronym"), xml)
211
+ a = node.attr("meeting") and
212
+ metadata_meeting(a, node.attr("meeting-acronym"), xml)
202
213
  a = node.attr("meeting-place") and xml.meeting_place a
203
214
  a = node.attr("meeting-date") and metadata_meeting_date(a, xml)
204
215
  a = node.attr("intended-type") and xml.intended_type a
@@ -233,6 +244,7 @@ module Asciidoctor
233
244
 
234
245
  def metadata_ext(node, xml)
235
246
  metadata_doctype(node, xml)
247
+ metadata_subdoctype(node, xml)
236
248
  metadata_committee(node, xml)
237
249
  metadata_ics(node, xml)
238
250
  metadata_recommendationstatus(node, xml)
@@ -45,6 +45,11 @@
45
45
  <optional>
46
46
  <attribute name="alt"/>
47
47
  </optional>
48
+ <optional>
49
+ <attribute name="updatetype">
50
+ <data type="boolean"/>
51
+ </attribute>
52
+ </optional>
48
53
  <text/>
49
54
  </element>
50
55
  </define>
@@ -543,6 +548,9 @@
543
548
  </define>
544
549
  <define name="BibDataExtensionType">
545
550
  <ref name="doctype"/>
551
+ <optional>
552
+ <ref name="docsubtype"/>
553
+ </optional>
546
554
  <optional>
547
555
  <ref name="editorialgroup"/>
548
556
  </optional>
@@ -876,8 +884,28 @@
876
884
  </zeroOrMore>
877
885
  </element>
878
886
  </define>
887
+ <define name="pagebreak">
888
+ <element name="pagebreak">
889
+ <optional>
890
+ <attribute name="orientation">
891
+ <choice>
892
+ <value>landscape</value>
893
+ <value>portrait</value>
894
+ </choice>
895
+ </attribute>
896
+ </optional>
897
+ </element>
898
+ </define>
879
899
  </include>
880
900
  <!-- end overrides -->
901
+ <define name="docsubtype">
902
+ <element name="docsubtype">
903
+ <ref name="DocumentSubtype"/>
904
+ </element>
905
+ </define>
906
+ <define name="DocumentSubtype">
907
+ <text/>
908
+ </define>
881
909
  <define name="colgroup">
882
910
  <element name="colgroup">
883
911
  <oneOrMore>
@@ -943,8 +971,170 @@
943
971
  <ref name="permission"/>
944
972
  <ref name="imagemap"/>
945
973
  <ref name="svgmap"/>
974
+ <ref name="inputform"/>
975
+ </choice>
976
+ </define>
977
+ <define name="inputform">
978
+ <element name="form">
979
+ <attribute name="id">
980
+ <data type="ID"/>
981
+ </attribute>
982
+ <attribute name="name"/>
983
+ <attribute name="action"/>
984
+ <zeroOrMore>
985
+ <choice>
986
+ <ref name="TextElement"/>
987
+ <ref name="FormInput"/>
988
+ </choice>
989
+ </zeroOrMore>
990
+ </element>
991
+ </define>
992
+ <define name="FormInput">
993
+ <choice>
994
+ <ref name="input"/>
995
+ <ref name="formlabel"/>
996
+ <ref name="select"/>
997
+ <ref name="textarea"/>
998
+ </choice>
999
+ </define>
1000
+ <define name="InputType">
1001
+ <choice>
1002
+ <value>button</value>
1003
+ <value>checkbox</value>
1004
+ <value>date</value>
1005
+ <value>file</value>
1006
+ <value>password</value>
1007
+ <value>radio</value>
1008
+ <value>submit</value>
1009
+ <value>text</value>
946
1010
  </choice>
947
1011
  </define>
1012
+ <define name="input">
1013
+ <element name="input">
1014
+ <attribute name="type">
1015
+ <ref name="InputType"/>
1016
+ </attribute>
1017
+ <optional>
1018
+ <attribute name="checked">
1019
+ <data type="boolean"/>
1020
+ </attribute>
1021
+ </optional>
1022
+ <optional>
1023
+ <attribute name="disabled">
1024
+ <data type="boolean"/>
1025
+ </attribute>
1026
+ </optional>
1027
+ <optional>
1028
+ <attribute name="readonly">
1029
+ <data type="boolean"/>
1030
+ </attribute>
1031
+ </optional>
1032
+ <optional>
1033
+ <attribute name="maxlength">
1034
+ <data type="int"/>
1035
+ </attribute>
1036
+ </optional>
1037
+ <optional>
1038
+ <attribute name="minlength">
1039
+ <data type="int"/>
1040
+ </attribute>
1041
+ </optional>
1042
+ <optional>
1043
+ <attribute name="name"/>
1044
+ </optional>
1045
+ <optional>
1046
+ <attribute name="value"/>
1047
+ </optional>
1048
+ <optional>
1049
+ <attribute name="id">
1050
+ <data type="ID"/>
1051
+ </attribute>
1052
+ </optional>
1053
+ </element>
1054
+ </define>
1055
+ <define name="formlabel">
1056
+ <element name="label">
1057
+ <attribute name="for">
1058
+ <data type="IDREF"/>
1059
+ </attribute>
1060
+ <zeroOrMore>
1061
+ <ref name="PureTextElement"/>
1062
+ </zeroOrMore>
1063
+ </element>
1064
+ </define>
1065
+ <define name="select">
1066
+ <element name="select">
1067
+ <optional>
1068
+ <attribute name="name"/>
1069
+ </optional>
1070
+ <optional>
1071
+ <attribute name="value"/>
1072
+ </optional>
1073
+ <optional>
1074
+ <attribute name="id">
1075
+ <data type="ID"/>
1076
+ </attribute>
1077
+ </optional>
1078
+ <optional>
1079
+ <attribute name="disabled">
1080
+ <data type="boolean"/>
1081
+ </attribute>
1082
+ </optional>
1083
+ <optional>
1084
+ <attribute name="multiple">
1085
+ <data type="boolean"/>
1086
+ </attribute>
1087
+ </optional>
1088
+ <optional>
1089
+ <attribute name="size">
1090
+ <data type="int"/>
1091
+ </attribute>
1092
+ </optional>
1093
+ <oneOrMore>
1094
+ <ref name="option"/>
1095
+ </oneOrMore>
1096
+ </element>
1097
+ </define>
1098
+ <define name="option">
1099
+ <element name="option">
1100
+ <optional>
1101
+ <attribute name="disabled">
1102
+ <data type="boolean"/>
1103
+ </attribute>
1104
+ </optional>
1105
+ <optional>
1106
+ <attribute name="value"/>
1107
+ </optional>
1108
+ <zeroOrMore>
1109
+ <ref name="PureTextElement"/>
1110
+ </zeroOrMore>
1111
+ </element>
1112
+ </define>
1113
+ <define name="textarea">
1114
+ <element name="textarea">
1115
+ <optional>
1116
+ <attribute name="name"/>
1117
+ </optional>
1118
+ <optional>
1119
+ <attribute name="value"/>
1120
+ </optional>
1121
+ <optional>
1122
+ <attribute name="id">
1123
+ <data type="ID"/>
1124
+ </attribute>
1125
+ </optional>
1126
+ <optional>
1127
+ <attribute name="rows">
1128
+ <data type="int"/>
1129
+ </attribute>
1130
+ </optional>
1131
+ <optional>
1132
+ <attribute name="cols">
1133
+ <data type="int"/>
1134
+ </attribute>
1135
+ </optional>
1136
+ </element>
1137
+ </define>
948
1138
  <define name="bibliography">
949
1139
  <element name="bibliography">
950
1140
  <oneOrMore>
@@ -1017,9 +1207,7 @@
1017
1207
  </define>
1018
1208
  <define name="IsoWorkgroup">
1019
1209
  <optional>
1020
- <attribute name="number">
1021
- <data type="int"/>
1022
- </attribute>
1210
+ <attribute name="number"/>
1023
1211
  </optional>
1024
1212
  <optional>
1025
1213
  <attribute name="type"/>