metanorma-ietf 3.7.16 → 3.7.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6017975715700fdc60b2600471d983155750c2a7686cda5bca82fa68ce7383fc
4
- data.tar.gz: d5db755aeba979c55aa1b1535c87f3500e140ca04ce2dd1b8563b7e5f606311f
3
+ metadata.gz: abcc3856de061ccbe82625eec533e0d60595eac991405092b05e706b8725f1bd
4
+ data.tar.gz: 44356953e5d937b8419015b0772e9beefcfc7be99c7f7fcf0506d246c01fadc7
5
5
  SHA512:
6
- metadata.gz: 92c566797f915c4b70921a87222ac1e081f11a5662483d93fb80ef186455f5adc82c563bb5812f97d6e9a81d220345729e8c94e831a2b1bee2285594d2c92ace
7
- data.tar.gz: 77c73d1853cd751c2544dfd9ea96644a76b01c3dd873c026cf0fe5e74fb6cc5ac9594857359913a43f90153d98404aa2f3903db8f8ac8412a85696f63540f73e
6
+ metadata.gz: 45a5436a0a28a429670aae9537ee3e595b1dd9459709294d3ff2f0fcc86fed4edfb4a37a8c7d3701c659e831cf3be551222d0f46f7deeb4b18b769783e47e522
7
+ data.tar.gz: ba8129dfac06cb1666508c5ddfe4b1f9182ce05e9a0134b72230a8cd4124e7d8bf1ba0fb82f2e2678ca763b5ae46b4136d6133124f5ffc86b084625c3afc64e1
@@ -60,6 +60,7 @@
60
60
  <value>IAB</value>
61
61
  <value>IRTF</value>
62
62
  <value>independent</value>
63
+ <value>editorial</value>
63
64
  </choice>
64
65
  </attribute>
65
66
  </optional>
@@ -1265,6 +1266,8 @@
1265
1266
  <choice>
1266
1267
  <ref name="artset"/>
1267
1268
  <ref name="artwork"/>
1269
+ <ref name="aside"/>
1270
+ <ref name="blockquote"/>
1268
1271
  <ref name="dl"/>
1269
1272
  <ref name="figure"/>
1270
1273
  <ref name="ol"/>
@@ -1576,6 +1579,8 @@
1576
1579
  <ref name="iref"/>
1577
1580
  <ref name="relref"/>
1578
1581
  <ref name="strong"/>
1582
+ <ref name="sub"/>
1583
+ <ref name="sup"/>
1579
1584
  <ref name="tt"/>
1580
1585
  <ref name="xref"/>
1581
1586
  </choice>
@@ -1600,6 +1605,8 @@
1600
1605
  <ref name="iref"/>
1601
1606
  <ref name="relref"/>
1602
1607
  <ref name="strong"/>
1608
+ <ref name="sub"/>
1609
+ <ref name="sup"/>
1603
1610
  <ref name="tt"/>
1604
1611
  <ref name="xref"/>
1605
1612
  </choice>
@@ -2378,6 +2385,7 @@
2378
2385
  <value>IAB</value>
2379
2386
  <value>IRTF</value>
2380
2387
  <value>independent</value>
2388
+ <value>editorial</value>
2381
2389
  </choice>
2382
2390
  </optional>
2383
2391
  </element>
@@ -2430,6 +2438,7 @@
2430
2438
  <value>IAB</value>
2431
2439
  <value>IRTF</value>
2432
2440
  <value>independent</value>
2441
+ <value>editorial</value>
2433
2442
  </choice>
2434
2443
  </attribute>
2435
2444
  </optional>
@@ -4,6 +4,12 @@ module Metanorma
4
4
  module Ietf
5
5
  module Transformer
6
6
  module FrontTransformer
7
+ # RFC 7991 s2.29 subseries pointer names, keyed by the
8
+ # intended-series title the flavor accepts
9
+ SERIES_INFO_NAMES = {
10
+ "standard" => "STD", "std" => "STD", "full-standard" => "STD",
11
+ "bcp" => "BCP", "fyi" => "FYI",
12
+ }.freeze
7
13
 
8
14
  def build_front
9
15
  front = Rfcxml::V3::Front.new
@@ -85,12 +91,21 @@ module Metanorma
85
91
  series_list = [series_list] unless series_list.is_a?(Array)
86
92
  series_list.each do |s|
87
93
  next unless s.type == "intended"
88
- si = Rfcxml::V3::SeriesInfo.new
89
- si.name = ""
90
- # the intended-series number ("BCP 14" -> value=14, #298)
94
+ # RFC 7991 s2.29: the subseries pointers carry a name and
95
+ # number ("BCP 14" -> name="BCP" value="14", #298); the
96
+ # informational/experimental/historic statuses have no
97
+ # subseries (they live on the rfc category), and a
98
+ # seriesInfo without a number has nothing valid to point
99
+ # at — the former empty name="" value="" entries were
100
+ # schema-legal junk
101
+ title = ls_text(s.title)
102
+ name = title && SERIES_INFO_NAMES[title.downcase]
91
103
  num = s.respond_to?(:number) ? ls_text(s.number) : nil
92
- si.value = num && !num.to_s.strip.empty? ? num.to_s.strip : ""
93
- si.status = ls_text(s.title)
104
+ num = num&.strip
105
+ next unless name && num && !num.empty?
106
+ si = Rfcxml::V3::SeriesInfo.new
107
+ si.name = name
108
+ si.value = num
94
109
  infos << si
95
110
  end
96
111
  end
@@ -119,7 +119,16 @@ module Metanorma
119
119
  return SERIES2CATEGORY.fetch(title.downcase, "std") if title
120
120
  end
121
121
  end
122
- "std"
122
+ category_default
123
+ end
124
+
125
+ # With no intended series declared, fall back to a category the
126
+ # stream actually carries (RFC 7841): xml2rfc's preptool dies
127
+ # on stream/category combinations it has no boilerplate for,
128
+ # and the former blanket std default handed every independent
129
+ # document one
130
+ def category_default
131
+ extract_submission_type == "IETF" ? "std" : "info"
123
132
  end
124
133
 
125
134
  def extract_doc_name
@@ -193,6 +193,7 @@ module Metanorma
193
193
  ret += link_check(xml)
194
194
  ret += series_info_check(xml)
195
195
  ret += ipr_check(xml)
196
+ ret += submission_type_check(xml)
196
197
  ret
197
198
  end
198
199
 
@@ -242,6 +243,87 @@ module Metanorma
242
243
  "#{xml.root['ipr']}"]
243
244
  []
244
245
  end
246
+
247
+ # RFC 7991 s2.45.11: the legal submissionType (stream) values.
248
+ RFC7841_STREAMS = %w(IETF IAB IRTF independent editorial).freeze
249
+
250
+ # RFC 7841 s2: the category each stream may carry; source of
251
+ # truth is the xml2rfc boilerplate_rfc_7841.py
252
+ # boilerplate_rfc_status_of_memo table
253
+ RFC7841_STREAM_CATEGORIES = {
254
+ "IETF" => %w(std bcp exp historic info),
255
+ "IAB" => %w(info historic),
256
+ "IRTF" => %w(exp historic info),
257
+ "independent" => %w(exp historic info),
258
+ "editorial" => %w(info),
259
+ }.freeze
260
+
261
+ # Stream consistency across <rfc>, <front> <seriesInfo>,
262
+ # <category> and <consensus>. The schema enum rejects unknown
263
+ # stream values, but schema errors do not quarantine output;
264
+ # these content checks do, with messages citing the document
265
+ # attribute that produced the value. Mirrors xml2rfc preptool
266
+ # 5.4.x stream checks.
267
+ def submission_type_check(xml)
268
+ ret = []
269
+ ret += submission_type_enum_check(xml)
270
+ ret += stream_category_check(xml)
271
+ ret += series_info_stream_check(xml)
272
+ ret += consensus_check(xml)
273
+ ret
274
+ end
275
+
276
+ def submission_type_enum_check(xml)
277
+ st = xml.root["submissionType"] or return []
278
+ RFC7841_STREAMS.include?(st) or
279
+ return ["Unknown submissionType (stream) on <rfc> element " \
280
+ "(:submission-type: #{st}): must be one of " \
281
+ "#{RFC7841_STREAMS.join(', ')}"]
282
+ []
283
+ end
284
+
285
+ def stream_category_check(xml)
286
+ st = xml.root["submissionType"] || "IETF"
287
+ cat = xml.root["category"] or return []
288
+ legal = RFC7841_STREAM_CATEGORIES[st] or return []
289
+ legal.include?(cat) or
290
+ return ["The category of <rfc> (:intended-series: TYPE " \
291
+ "NUMBER) is invalid for the #{st} stream: must be " \
292
+ "one of #{legal.join(', ')}, but is #{cat}"]
293
+ []
294
+ end
295
+
296
+ # 5.4.2.1. Compare <rfc> "submissionType" and
297
+ # <seriesInfo> "stream"
298
+ def series_info_stream_check(xml)
299
+ st = xml.root["submissionType"] || "IETF"
300
+ xml.xpath("//front//seriesInfo[@stream]").each do |s|
301
+ s["stream"] == st or
302
+ return ["The stream setting of <front> <seriesInfo> " \
303
+ "(#{s['stream']}) is inconsistent with the " \
304
+ "submissionType of <rfc> (#{st})"]
305
+ end
306
+ []
307
+ end
308
+
309
+ # 5.4.2.2. "Status of This Memo" Insertion: the independent
310
+ # and editorial streams take no consensus setting, and the
311
+ # IRTF stream only when the document names a workgroup
312
+ def consensus_check(xml)
313
+ st = xml.root["submissionType"] || "IETF"
314
+ c = xml.root["consensus"] or return []
315
+ if %w(independent editorial).include?(st)
316
+ return ["Expected no consensus setting for the #{st} " \
317
+ "stream (:consensus: #{c}); remove the " \
318
+ ":consensus: document attribute"]
319
+ end
320
+ if st == "IRTF" && xml.at("//front/workgroup").nil?
321
+ return ["Expected no consensus setting for the IRTF " \
322
+ "stream with no workgroup (:consensus: #{c}); " \
323
+ "declare :workgroup: or remove :consensus:"]
324
+ end
325
+ []
326
+ end
245
327
  end
246
328
  end
247
329
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "3.7.16".freeze
3
+ VERSION = "3.7.17".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.16
4
+ version: 3.7.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.