metanorma-itu 2.4.6 → 2.4.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -95,7 +95,7 @@
95
95
  <text/>
96
96
  </element>
97
97
  </define>
98
- <define name="LocalizedString1">
98
+ <define name="LocalizedStringAttrs">
99
99
  <optional>
100
100
  <!-- multiple languages and scripts possible: comma delimit them if so -->
101
101
  <attribute name="language"/>
@@ -106,6 +106,10 @@
106
106
  <optional>
107
107
  <attribute name="script"/>
108
108
  </optional>
109
+ </define>
110
+ <define name="LocalizedString1">
111
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
112
+ <ref name="LocalizedStringAttrs"/>
109
113
  <text/>
110
114
  </define>
111
115
  <define name="LocalizedString">
@@ -118,6 +122,23 @@
118
122
  </oneOrMore>
119
123
  </choice>
120
124
  </define>
125
+ <define name="LocalizedMarkedUpString1">
126
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
127
+ <ref name="LocalizedStringAttrs"/>
128
+ <oneOrMore>
129
+ <ref name="TextElement"/>
130
+ </oneOrMore>
131
+ </define>
132
+ <define name="LocalizedMarkedUpString">
133
+ <choice>
134
+ <ref name="LocalizedMarkedUpString1"/>
135
+ <oneOrMore>
136
+ <element name="variant">
137
+ <ref name="LocalizedMarkedUpString1"/>
138
+ </element>
139
+ </oneOrMore>
140
+ </choice>
141
+ </define>
121
142
  <!--
122
143
  Unlike UML, change type to format: type is overloaded
123
144
  Would be need if plain were default value and could omit the attribute
@@ -142,16 +163,8 @@
142
163
  <ref name="LocalizedStringOrXsAny"/>
143
164
  </define>
144
165
  <define name="LocalizedStringOrXsAny1">
145
- <optional>
146
- <!-- multiple languages and scripts possible: comma delimit them if so -->
147
- <attribute name="language"/>
148
- </optional>
149
- <optional>
150
- <attribute name="locale"/>
151
- </optional>
152
- <optional>
153
- <attribute name="script"/>
154
- </optional>
166
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
167
+ <ref name="LocalizedStringAttrs"/>
155
168
  <oneOrMore>
156
169
  <choice>
157
170
  <text/>
@@ -208,9 +221,7 @@
208
221
  </define>
209
222
  <define name="roledescription">
210
223
  <element name="description">
211
- <oneOrMore>
212
- <ref name="TextElement"/>
213
- </oneOrMore>
224
+ <ref name="LocalizedMarkedUpString"/>
214
225
  </element>
215
226
  </define>
216
227
  <define name="person">
@@ -335,9 +346,7 @@
335
346
  </define>
336
347
  <define name="affiliationdescription">
337
348
  <element name="description">
338
- <oneOrMore>
339
- <ref name="TextElement"/>
340
- </oneOrMore>
349
+ <ref name="LocalizedMarkedUpString"/>
341
350
  </element>
342
351
  </define>
343
352
  <define name="organization">
@@ -386,7 +395,7 @@
386
395
  </define>
387
396
  <define name="logo">
388
397
  <element name="logo">
389
- <ref name="image"/>
398
+ <ref name="image-no-id"/>
390
399
  </element>
391
400
  </define>
392
401
  <define name="depiction">
@@ -395,7 +404,7 @@
395
404
  <attribute name="scope"/>
396
405
  </optional>
397
406
  <zeroOrMore>
398
- <ref name="image"/>
407
+ <ref name="image-no-id"/>
399
408
  </zeroOrMore>
400
409
  </element>
401
410
  </define>
@@ -948,9 +957,7 @@
948
957
  <optional>
949
958
  <attribute name="type"/>
950
959
  </optional>
951
- <zeroOrMore>
952
- <ref name="TextElement"/>
953
- </zeroOrMore>
960
+ <ref name="LocalizedMarkedUpString"/>
954
961
  </define>
955
962
  <!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
956
963
  <define name="TypedUri">
@@ -1041,18 +1048,7 @@
1041
1048
  <data type="boolean"/>
1042
1049
  </attribute>
1043
1050
  </optional>
1044
- <optional>
1045
- <attribute name="language"/>
1046
- </optional>
1047
- <optional>
1048
- <attribute name="locale"/>
1049
- </optional>
1050
- <optional>
1051
- <attribute name="script"/>
1052
- </optional>
1053
- <oneOrMore>
1054
- <ref name="TextElement"/>
1055
- </oneOrMore>
1051
+ <ref name="LocalizedMarkedUpString"/>
1056
1052
  </element>
1057
1053
  </define>
1058
1054
  <define name="docnumber">
@@ -1277,16 +1273,20 @@
1277
1273
  <optional>
1278
1274
  <attribute name="type"/>
1279
1275
  </optional>
1280
- <oneOrMore>
1281
- <ref name="TextElement"/>
1282
- </oneOrMore>
1276
+ <ref name="LocalizedMarkedUpString"/>
1283
1277
  </element>
1284
1278
  </define>
1285
1279
  <define name="bibabstract">
1286
1280
  <element name="abstract">
1287
- <oneOrMore>
1288
- <ref name="TextElement"/>
1289
- </oneOrMore>
1281
+ <ref name="LocalizedStringAttrs"/>
1282
+ <choice>
1283
+ <oneOrMore>
1284
+ <ref name="BasicBlockNoId"/>
1285
+ </oneOrMore>
1286
+ <oneOrMore>
1287
+ <ref name="TextElement"/>
1288
+ </oneOrMore>
1289
+ </choice>
1290
1290
  </element>
1291
1291
  </define>
1292
1292
  <define name="copyright">
@@ -1391,9 +1391,7 @@
1391
1391
  </attribute>
1392
1392
  <optional>
1393
1393
  <element name="description">
1394
- <oneOrMore>
1395
- <ref name="TextElement"/>
1396
- </oneOrMore>
1394
+ <ref name="LocalizedMarkedUpString"/>
1397
1395
  </element>
1398
1396
  </optional>
1399
1397
  <element name="bibitem">
@@ -35,11 +35,9 @@ module Metanorma
35
35
  super
36
36
  end
37
37
 
38
- def doctype(node)
39
- ret = node.attr("doctype")&.gsub(/\s+/, "-")&.downcase ||
40
- "recommendation"
41
- ret = "recommendation" if ret == "article"
42
- ret
38
+ def init_misc(node)
39
+ super
40
+ @default_doctype = "recommendation"
43
41
  end
44
42
 
45
43
  def olist(node)
@@ -16,19 +16,18 @@ module Metanorma
16
16
  super + %w(complements)
17
17
  end
18
18
 
19
- def title_attr(type, lang = "en")
20
- { language: lang, format: "text/plain", type: type }
19
+ def insert_title(xml, type, lang, content)
20
+ attr = { language: lang, format: "text/plain", type: type }
21
+ xml.title **attr_code(attr) do |t|
22
+ t << Metanorma::Utils::asciidoc_sub(content)
23
+ end
21
24
  end
22
25
 
23
26
  def title_defaultlang(node, xml)
24
- a = node.attr("title") || node.attr("title-#{@lang}")
25
- xml.title **attr_code(title_attr("main", @lang)) do |t|
26
- t << (Metanorma::Utils::asciidoc_sub(a) || node.title)
27
- end
27
+ a = node.attr("title") || node.attr("title-#{@lang}") || node.title
28
+ insert_title(xml, "main", @lang, a)
28
29
  if a = node.attr("annextitle") || node.attr("annextitle-#{@lang}")
29
- xml.title **attr_code(title_attr("annex", @lang)) do |t|
30
- t << Metanorma::Utils::asciidoc_sub(a)
31
- end
30
+ insert_title(xml, "annex", @lang, a)
32
31
  end
33
32
  end
34
33
 
@@ -37,9 +36,7 @@ module Metanorma
37
36
  /^(?:annex)?title-(?<lang>.+)$/ =~ k or next
38
37
  lang == @lang and next
39
38
  type = /^annex/.match?(k) ? "annex" : "main"
40
- xml.title **attr_code(title_attr(type, lang)) do |t|
41
- t << Metanorma::Utils::asciidoc_sub(v)
42
- end
39
+ insert_title(xml, type, lang, v)
43
40
  end
44
41
  end
45
42
 
@@ -55,19 +52,14 @@ module Metanorma
55
52
 
56
53
  def other_title_defaultlang(node, xml, type)
57
54
  a = node.attr(type) || node.attr("#{type}-#{@lang}")
58
- xml.title **attr_code(title_attr(type.sub(/-title/, ""), @lang)) do |t|
59
- t << Metanorma::Utils::asciidoc_sub(a)
60
- end
55
+ insert_title(xml, type.sub(/-title/, ""), @lang, a)
61
56
  end
62
57
 
63
58
  def other_title_otherlangs(node, xml, type)
64
59
  node.attributes.each do |k, v|
65
60
  m = /^#{type}-(?<lang>.+)$/.match(k) or next
66
61
  m[:lang] == @lang and next
67
- xml.title **attr_code(title_attr(type.sub(/-title/, ""),
68
- m[:lang])) do |t|
69
- t << Metanorma::Utils::asciidoc_sub(v)
70
- end
62
+ insert_title(xml, type.sub(/-title/, ""), m[:lang], v)
71
63
  end
72
64
  end
73
65
 
@@ -78,9 +70,7 @@ module Metanorma
78
70
  def org_abbrev
79
71
  if @i18n.get["ITU"]
80
72
  { @i18n.international_telecommunication_union => @i18n.get["ITU"] }
81
- else
82
- {}
83
- end
73
+ else {} end
84
74
  end
85
75
 
86
76
  def metadata_committee(node, xml)
@@ -166,15 +156,15 @@ module Metanorma
166
156
  end
167
157
 
168
158
  def metadata_recommendationstatus(node, xml)
169
- node.attr("recommendation-from") or return
159
+ node.attr("recommendation-from") || node.attr("approval-process") or
160
+ return
170
161
  xml.recommendationstatus do |s|
171
- s.from node.attr("recommendation-from")
172
- s.to node.attr("recommendation-to") if node.attr("recommendation-to")
173
- if node.attr("approval-process")
174
- s.approvalstage **{ process: node.attr("approval-process") } do |a|
175
- a << node.attr("approval-status")
162
+ a = node.attr("recommendation-from") and s.from a
163
+ a = node.attr("recommendation-to") and s.to a
164
+ node.attr("approval-process") and
165
+ s.approvalstage **{ process: node.attr("approval-process") } do |x|
166
+ x << node.attr("approval-status")
176
167
  end
177
- end
178
168
  end
179
169
  end
180
170
 
@@ -197,6 +187,12 @@ module Metanorma
197
187
  end
198
188
  end
199
189
 
190
+ def metadata_contribution(node, xml)
191
+ %w(timing).each do |k|
192
+ a = node.attr(k) and xml.send k, a
193
+ end
194
+ end
195
+
200
196
  def metadata_meeting_date(val, xml)
201
197
  xml.meeting_date do |m|
202
198
  d = val.split("/")
@@ -237,6 +233,7 @@ module Metanorma
237
233
  metadata_recommendationstatus(node, xml)
238
234
  metadata_ip_notice(node, xml)
239
235
  metadata_techreport(node, xml)
236
+ metadata_contribution(node, xml)
240
237
  structured_id(node, xml)
241
238
  metadata_coverpage_images(node, xml)
242
239
  end