20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/asciidoctor/rfc/v3/front.rb', line 20
def series_info(node, xml)
docname = node.attr("name")
return if docname.nil? || docname&.empty?
is_rfc = docname =~ /^rfc-?/i || node.attr("doctype") == "rfc"
if is_rfc
name = docname.gsub(/^rfc-?/i, "")
nameattr = "RFC"
else
name = docname
nameattr = "Internet-Draft"
end
value = name.gsub(/\.[^\/]+$/, "")
seriesInfo_attributes = {
name: nameattr,
status: node.attr("status"),
stream: node.attr("submission-type") || "IETF",
value: value,
}
xml.seriesInfo **attr_code(seriesInfo_attributes)
intendedstatus = node.attr("intended-series")
if !is_rfc && !intendedstatus.nil?
unless intendedstatus =~ /^(standard|full-standard|bcp|fyi|informational|experimental|historic)$/
warn %(asciidoctor: WARNING (#{current_location(node)}): disallowed value for intended-series in document header: #{intendedstatus})
end
seriesInfo_attributes = {
name: "",
status: intendedstatus,
value: value,
}
xml.seriesInfo **attr_code(seriesInfo_attributes)
end
rfcstatus = intendedstatus
if is_rfc && !rfcstatus.nil?
m = /^(\S+) (\d+)$/.match rfcstatus
if m.nil?
rfcstatus = "exp" if rfcstatus == "experimental"
rfcstatus = "info" if rfcstatus == "informational"
warn %(asciidoctor: WARNING (#{current_location(node)}): disallowed value for intended-series in document header with no series number: #{rfcstatus}) unless rfcstatus =~ /^(info|exp|historic)$/
else
rfcstatus = m[1]
value = m[2]
warn %(asciidoctor: WARNING (#{current_location(node)}): disallowed value for intended-series in document header with series number: #{rfcstatus}) unless rfcstatus =~ /^(standard|full-standard|bcp)$/
end
seriesInfo_attributes = {
name: "",
status: rfcstatus,
value: value,
}
xml.seriesInfo **attr_code(seriesInfo_attributes)
end
end
|