kramdown-rfc2629 1.4.4 → 1.4.9
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 +4 -4
- data/bin/doilit +5 -1
- data/bin/kramdown-rfc-cache-subseries-bibxml +120 -0
- data/bin/kramdown-rfc2629 +45 -7
- data/data/encoding-fallbacks.txt +1 -0
- data/data/kramdown-rfc2629.erb +1 -1
- data/kramdown-rfc2629.gemspec +3 -2
- data/lib/kramdown-rfc/parameterset.rb +6 -7
- data/lib/kramdown-rfc2629.rb +88 -31
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4be8093af3b860dba2fe1389dd720da6f34206ff112e84dcca98dd35ad200a07
|
4
|
+
data.tar.gz: 2772970e704ad1bcea1930602e3b7f2e21cfe34a5bcdde3e1fdd0e2a71722bcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8feb2ef692ca46abe03f14dbfd34cce993856e03cb3eb2fa105db0c16766c931992facdcf6affbc0a164c6b48e3abe5110f2f76118c394c652d4c2bdff530769
|
7
|
+
data.tar.gz: 5fab2d82e41c88603abbe33224a763534d0920da3751529b01110b885dec060564a4431bd4617360427cc1ef6aaac4b5375888ec2387983b62daabad1fb6822e
|
data/bin/doilit
CHANGED
@@ -75,7 +75,11 @@ ARGV.each do |doi|
|
|
75
75
|
if (ct = cite["container-title"]) && ct != []
|
76
76
|
info = []
|
77
77
|
if v = cite["volume"]
|
78
|
-
|
78
|
+
vi = "vol. #{v}"
|
79
|
+
if (v = cite["journal-issue"]) && (issue = v["issue"])
|
80
|
+
vi << ", no. #{issue}"
|
81
|
+
end
|
82
|
+
info << vi
|
79
83
|
end
|
80
84
|
if p = cite["page"]
|
81
85
|
info << "pp. #{p}"
|
@@ -0,0 +1,120 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# prerequisite:
|
3
|
+
# gem install net-http-persistent
|
4
|
+
#
|
5
|
+
# generates referencegroup files for BCP and STD series (like bibxml9)
|
6
|
+
# unfortunately, needs to re-fetch rfc-index.xml
|
7
|
+
# uses pretty slow built-in XML parser, so it will take a while even on regen
|
8
|
+
#
|
9
|
+
# uses ENV["KRAMDOWN_REFCACHEDIR"] for where you want to have your bibxml9 data
|
10
|
+
#
|
11
|
+
|
12
|
+
require 'rexml/document'
|
13
|
+
require 'fileutils'
|
14
|
+
|
15
|
+
begin
|
16
|
+
require 'net/http/persistent'
|
17
|
+
rescue
|
18
|
+
warn "*** please install net-http-persistent:"
|
19
|
+
warn " gem install net-http-persistent"
|
20
|
+
warn "(prefix by sudo only if required)."
|
21
|
+
exit 72 # EX_OSFILE
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
TARGET_DIR = ENV["KRAMDOWN_REFCACHEDIR"] || (
|
26
|
+
path = File.expand_path("~/.cache/xml2rfc")
|
27
|
+
warn "*** set environment variable KRAMDOWN_REFCACHEDIR to #{path} to actually use the cache"
|
28
|
+
path
|
29
|
+
)
|
30
|
+
|
31
|
+
FileUtils.mkdir_p(TARGET_DIR)
|
32
|
+
FileUtils.chdir(TARGET_DIR)
|
33
|
+
|
34
|
+
$http = Net::HTTP::Persistent.new name: 'subseries'
|
35
|
+
|
36
|
+
KRAMDOWN_PERSISTENT_VERBOSE = true
|
37
|
+
|
38
|
+
def get_and_write_resource_persistently(url, fn, age_verbose=false)
|
39
|
+
t1 = Time.now
|
40
|
+
response = $http.request(URI(url))
|
41
|
+
if response.code != "200"
|
42
|
+
raise "*** Status code #{response.code} while fetching #{url}"
|
43
|
+
else
|
44
|
+
File.write(fn, response.body)
|
45
|
+
end
|
46
|
+
t2 = Time.now
|
47
|
+
warn "#{url} -> #{fn} (#{"%.3f" % (t2 - t1)} s)" if KRAMDOWN_PERSISTENT_VERBOSE
|
48
|
+
if age_verbose
|
49
|
+
if age = response.get_fields("age")
|
50
|
+
warn "(working from a web cache, index is #{age.first} seconds stale)"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
CLEAR_RET = "\e[K\r" # XXX all the world is ECMA-48 (ISO 6429), no?
|
56
|
+
|
57
|
+
def noisy(name)
|
58
|
+
print "#{name}...#{CLEAR_RET}"
|
59
|
+
end
|
60
|
+
def clear_noise
|
61
|
+
print CLEAR_RET
|
62
|
+
end
|
63
|
+
|
64
|
+
def normalize_name(n)
|
65
|
+
n.sub(/([A-Z])0+/) {$1}
|
66
|
+
end
|
67
|
+
|
68
|
+
def regress_name(n)
|
69
|
+
n.sub(/([A-Z])(\d+)/) {"#$1#{"%04d" % $2.to_i}"}
|
70
|
+
end
|
71
|
+
|
72
|
+
def regress_name_dot(n)
|
73
|
+
n.sub(/([A-Z])(\d+)/) {"#$1.#{"%04d" % $2.to_i}"}
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_ref(rfcname)
|
77
|
+
name = "reference.#{regress_name_dot(rfcname)}.xml"
|
78
|
+
begin
|
79
|
+
file = File.read(name) # no age check
|
80
|
+
rescue Errno::ENOENT
|
81
|
+
get_and_write_resource_persistently("https://www.rfc-editor.org/refs/bibxml/" << name, name)
|
82
|
+
file = File.read(name)
|
83
|
+
end
|
84
|
+
d = REXML::Document.new(file)
|
85
|
+
d.xml_decl.nowrite
|
86
|
+
"<!-- #{name} -->\n" << d.to_s.lstrip
|
87
|
+
end
|
88
|
+
|
89
|
+
def create_bib(series, subname, rfcnames)
|
90
|
+
p [series, subname, rfcnames]
|
91
|
+
subname_norm = normalize_name(subname)
|
92
|
+
refs = %{<?xml version='1.0' encoding='UTF-8'?>\n}
|
93
|
+
refs << %{<referencegroup anchor='#{subname_norm}' target='https://www.rfc-editor.org/info/#{subname_norm.downcase}'>\n}
|
94
|
+
refs << rfcnames.map {|x| get_ref(x)}.join
|
95
|
+
refs << "</referencegroup>\n"
|
96
|
+
File.write("reference.#{regress_name_dot(subname)}.xml", refs)
|
97
|
+
end
|
98
|
+
|
99
|
+
def handle_sub(series, entry)
|
100
|
+
ids = entry.get_elements("doc-id")
|
101
|
+
warn "** ids #{ids} #{entry}" unless ids.size == 1
|
102
|
+
subname = ids.first.text
|
103
|
+
isalso = entry.get_elements("is-also")
|
104
|
+
if isalso.size == 1
|
105
|
+
rfcs = isalso.first.get_elements("doc-id")
|
106
|
+
if rfcs.size > 0
|
107
|
+
rfcnames = rfcs.map {|r| r.text}
|
108
|
+
create_bib(series, subname, rfcnames)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
RFCINDEX_SOURCE = "https://www.rfc-editor.org/rfc/rfc-index.xml"
|
114
|
+
RFCINDEX_COPY = File.basename(RFCINDEX_SOURCE)
|
115
|
+
|
116
|
+
get_and_write_resource_persistently(RFCINDEX_SOURCE, RFCINDEX_COPY, true) unless ENV["KRAMDOWN_DONT_REFRESH_RFCINDEX"]
|
117
|
+
|
118
|
+
doc = REXML::Document.new(File.read(RFCINDEX_COPY))
|
119
|
+
REXML::XPath.each(doc.root, "/rfc-index/bcp-entry") { |e| handle_sub("BCP", e) }
|
120
|
+
REXML::XPath.each(doc.root, "/rfc-index/std-entry") { |e| handle_sub("STD", e) }
|
data/bin/kramdown-rfc2629
CHANGED
@@ -14,7 +14,7 @@ Encoding.default_external = "UTF-8" # wake up, smell the coffee
|
|
14
14
|
|
15
15
|
def boilerplate(key)
|
16
16
|
case key.downcase
|
17
|
-
when /\Abcp14(\+)?\z/i
|
17
|
+
when /\Abcp14(\+)?(-tagged)?\z/i
|
18
18
|
ret = <<RFC8174
|
19
19
|
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
|
20
20
|
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
|
@@ -28,6 +28,26 @@ These words may also appear in this document in
|
|
28
28
|
lower case as plain English words, absent their normative meanings.
|
29
29
|
PLUS
|
30
30
|
end
|
31
|
+
if $2
|
32
|
+
if $options.v3
|
33
|
+
ret << <<TAGGED
|
34
|
+
|
35
|
+
*[MUST]: <bcp14>
|
36
|
+
*[MUST NOT]: <bcp14>
|
37
|
+
*[REQUIRED]: <bcp14>
|
38
|
+
*[SHALL]: <bcp14>
|
39
|
+
*[SHALL NOT]: <bcp14>
|
40
|
+
*[SHOULD]: <bcp14>
|
41
|
+
*[SHOULD NOT]: <bcp14>
|
42
|
+
*[RECOMMENDED]: <bcp14>
|
43
|
+
*[NOT RECOMMENDED]: <bcp14>
|
44
|
+
*[MAY]: <bcp14>
|
45
|
+
*[OPTIONAL]: <bcp14>
|
46
|
+
TAGGED
|
47
|
+
else
|
48
|
+
warn "** need --v3 to tag bcp14"
|
49
|
+
end
|
50
|
+
end
|
31
51
|
ret
|
32
52
|
else
|
33
53
|
warn "** Unknwon boilerplate key: #{key}"
|
@@ -69,6 +89,14 @@ def yaml_load(input, *args)
|
|
69
89
|
end
|
70
90
|
end
|
71
91
|
|
92
|
+
XREF_SECTIONS_RE = ::Kramdown::Parser::RFC2629Kramdown::SECTIONS_RE
|
93
|
+
XSR_PREFIX = "#{XREF_SECTIONS_RE} of "
|
94
|
+
XSR_SUFFIX = ", (#{XREF_SECTIONS_RE})| \((#{XREF_SECTIONS_RE})\)"
|
95
|
+
|
96
|
+
def spacify_re(s)
|
97
|
+
s.gsub(' ', '[\u00A0\s]+')
|
98
|
+
end
|
99
|
+
|
72
100
|
def xml_from_sections(input)
|
73
101
|
|
74
102
|
unless ENV["KRAMDOWN_NO_SOURCE"]
|
@@ -138,11 +166,17 @@ def xml_from_sections(input)
|
|
138
166
|
# collect normative/informative tagging {{!RFC2119}} {{?RFC4711}}
|
139
167
|
sechash.each do |k, v|
|
140
168
|
next if k == "fluff"
|
141
|
-
v.gsub!(/{{(
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
169
|
+
v.gsub!(/{{(#{
|
170
|
+
spacify_re(XSR_PREFIX)
|
171
|
+
})?(?:([?!])(-)?|(-))([\w._\-]+)(?:=([\w.\/_\-]+))?(#{
|
172
|
+
spacify_re(XSR_SUFFIX)
|
173
|
+
})?}}/) do |match|
|
174
|
+
xsr_prefix = $1
|
175
|
+
norminform = $2
|
176
|
+
replacing = $3 || $4
|
177
|
+
word = $5
|
178
|
+
bibref = $6
|
179
|
+
xsr_suffix = $7
|
146
180
|
if replacing
|
147
181
|
if new = ref_replacements[word]
|
148
182
|
word = new
|
@@ -166,7 +200,7 @@ def xml_from_sections(input)
|
|
166
200
|
if norminform
|
167
201
|
norm_ref[word] ||= norminform == '!' # one normative ref is enough
|
168
202
|
end
|
169
|
-
"{{#{word}}}"
|
203
|
+
"{{#{xsr_prefix}#{word}#{xsr_suffix}}}"
|
170
204
|
end
|
171
205
|
end
|
172
206
|
|
@@ -249,6 +283,10 @@ def bibtagsys(bib, anchor=nil, stand_alone=true)
|
|
249
283
|
rfc4d = "%04d" % $1.to_i
|
250
284
|
[bib.upcase,
|
251
285
|
"#{XML_RESOURCE_ORG_PREFIX}/bibxml/reference.RFC.#{rfc4d}.xml"]
|
286
|
+
elsif $options.v3 && bib =~ /\A(bcp|std)(\d+)/i
|
287
|
+
n4d = "%04d" % $2.to_i
|
288
|
+
[bib.upcase,
|
289
|
+
"#{XML_RESOURCE_ORG_PREFIX}/bibxml-rfcsubseries-new/reference.#{$1.upcase}.#{n4d}.xml"]
|
252
290
|
elsif bib =~ /\A([-A-Z0-9]+)\./ &&
|
253
291
|
(xro = Kramdown::Converter::Rfc2629::XML_RESOURCE_ORG_MAP[$1])
|
254
292
|
dir, _ttl, rewrite_anchor = xro
|
data/data/encoding-fallbacks.txt
CHANGED
data/data/kramdown-rfc2629.erb
CHANGED
@@ -100,7 +100,7 @@
|
|
100
100
|
<name>Contributors</name>
|
101
101
|
<% else -%>
|
102
102
|
<section anchor="contributors" numbered="false" title="Contributors">
|
103
|
-
<% warn "***
|
103
|
+
<% warn "*** To use YAML contributors, use --v3 (kdrfc -3)" if consec -%>
|
104
104
|
<% end -%>
|
105
105
|
<%= sh -%>
|
106
106
|
<% if $options.v3 && consec
|
data/kramdown-rfc2629.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
spec = Gem::Specification.new do |s|
|
2
2
|
s.name = 'kramdown-rfc2629'
|
3
|
-
s.version = '1.4.
|
3
|
+
s.version = '1.4.9'
|
4
4
|
s.summary = "Kramdown extension for generating RFC 7749 XML."
|
5
5
|
s.description = %{An RFC7749 (XML2RFC) generating backend for Thomas Leitner's
|
6
6
|
"kramdown" markdown parser. Mostly useful for RFC writers.}
|
@@ -10,7 +10,8 @@ spec = Gem::Specification.new do |s|
|
|
10
10
|
s.files = Dir['lib/**/*.rb'] + %w(README.md LICENSE kramdown-rfc2629.gemspec bin/kdrfc bin/kramdown-rfc2629 bin/doilit bin/kramdown-rfc-extract-markdown data/kramdown-rfc2629.erb data/encoding-fallbacks.txt data/math.json)
|
11
11
|
s.require_path = 'lib'
|
12
12
|
s.executables = ['kramdown-rfc2629', 'doilit', 'kramdown-rfc-extract-markdown',
|
13
|
-
'kdrfc', 'kramdown-rfc-cache-i-d-bibxml'
|
13
|
+
'kdrfc', 'kramdown-rfc-cache-i-d-bibxml',
|
14
|
+
'kramdown-rfc-cache-subseries-bibxml']
|
14
15
|
s.required_ruby_version = '>= 2.3.0'
|
15
16
|
# s.requirements = 'wget'
|
16
17
|
# s.has_rdoc = true
|
@@ -34,13 +34,12 @@ module KramdownRFC
|
|
34
34
|
val ||= defcontent
|
35
35
|
Array(val).map do |val1|
|
36
36
|
v = val1.to_s.strip
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
37
|
+
contents =
|
38
|
+
if markdown
|
39
|
+
::Kramdown::Converter::Rfc2629::process_markdown(v)
|
40
|
+
else
|
41
|
+
escape_html(v)
|
42
|
+
end
|
44
43
|
%{<#{[an, *Array(attr).map(&:to_s)].join(" ").strip}>#{contents}</#{an}>}
|
45
44
|
end.join(" ")
|
46
45
|
end
|
data/lib/kramdown-rfc2629.rb
CHANGED
@@ -42,32 +42,50 @@ module Kramdown
|
|
42
42
|
@block_parsers.unshift(:block_pi)
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
45
|
+
XREF_BASE = /[\w.-]+/ # a token for a reference
|
46
|
+
XREF_TXT = /(?:[^\(]|\([^\)]*\))+/ # parenthesized text
|
47
|
+
XREF_RE = /#{XREF_BASE}(?: \(#{XREF_TXT}\))?/
|
48
|
+
XREF_RE_M = /\A(#{XREF_BASE})(?: \((#{XREF_TXT})\))?/ # matching version of XREF_RE
|
49
|
+
XREF_SINGLE = /(?:Section|Appendix) #{XREF_RE}/
|
50
|
+
XREF_MULTI = /(?:Sections|Appendices) (?:#{XREF_RE}, )*#{XREF_RE},? and #{XREF_RE}/
|
51
|
+
XREF_ANY = /(?:#{XREF_SINGLE}|#{XREF_MULTI})/
|
52
|
+
SECTIONS_RE = /(?:#{XREF_ANY} and )?#{XREF_ANY}/
|
53
|
+
|
54
|
+
def handle_bares(s, attr, format, href, last_join = nil)
|
55
|
+
if s.match(/\A(#{XREF_ANY}) and (#{XREF_ANY})\z/)
|
56
|
+
handle_bares($1, {}, nil, href, " and ")
|
57
|
+
handle_bares($2, {}, nil, href, " of ")
|
58
|
+
return
|
59
|
+
end
|
60
|
+
|
61
|
+
href = href.split(' ')[0] # Remove any trailing (...)
|
62
|
+
multi = last_join != nil
|
63
|
+
(sn, s) = s.split(' ', 2)
|
64
|
+
loop do
|
65
|
+
m = s.match(/\A#{XREF_RE_M}(, (?:and )?| and )?/)
|
66
|
+
break if not m
|
67
|
+
|
68
|
+
if not multi and not m[2] and not m[3]
|
69
|
+
# Modify |attr| if there is a single reference. This can only be
|
70
|
+
# used if there is only one section reference and the section part
|
71
|
+
# has no title.
|
72
|
+
attr['section'] = m[1]
|
73
|
+
attr['sectionFormat'] = format
|
74
|
+
attr['text'] = m[2]
|
75
|
+
return
|
66
76
|
end
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
77
|
+
|
78
|
+
if sn
|
79
|
+
@tree.children << Element.new(:text, "#{sn} ", {})
|
80
|
+
sn = nil
|
81
|
+
end
|
82
|
+
|
83
|
+
multi = true
|
84
|
+
s[m[0]] = ''
|
85
|
+
|
86
|
+
attr1 = { 'target' => href, 'section' => m[1], 'sectionFormat' => 'bare', 'text' => m[2] }
|
87
|
+
@tree.children << Element.new(:xref, nil, attr1)
|
88
|
+
@tree.children << Element.new(:text, m[3] || last_join || " of ", {})
|
71
89
|
end
|
72
90
|
end
|
73
91
|
|
@@ -102,12 +120,22 @@ module Kramdown
|
|
102
120
|
when /\A(.*) \((#{SECTIONS_RE})\)\z/
|
103
121
|
href = $1
|
104
122
|
handle_bares($2, attr, "parens", href)
|
105
|
-
when /\A([\w.]+)<(
|
123
|
+
when /\A([\w.]+)<(.+)\z/
|
106
124
|
href = $2
|
107
125
|
attr['section'] = $1
|
108
126
|
attr['sectionFormat'] = 'bare'
|
127
|
+
when /\A<<(.+)\z/
|
128
|
+
href = $1
|
129
|
+
attr['format'] = 'title'
|
130
|
+
when /\A<(.+)\z/
|
131
|
+
href = $1
|
132
|
+
attr['format'] = 'counter'
|
109
133
|
end
|
110
134
|
end
|
135
|
+
if href.match(XREF_RE_M)
|
136
|
+
href = $1
|
137
|
+
attr['text'] = $2
|
138
|
+
end
|
111
139
|
href = href.gsub(/\A[0-9]/) { "_#{$&}" } # can't start an IDREF with a number
|
112
140
|
attr['target'] = href
|
113
141
|
el = Element.new(:xref, nil, attr)
|
@@ -282,6 +310,12 @@ module Kramdown
|
|
282
310
|
generate_id(value).gsub(/-+/, '-')
|
283
311
|
end
|
284
312
|
|
313
|
+
def self.process_markdown(v) # Uuh. Heavy coupling.
|
314
|
+
doc = ::Kramdown::Document.new(v, $global_markdown_options)
|
315
|
+
$stderr.puts doc.warnings.to_yaml unless doc.warnings.empty?
|
316
|
+
doc.to_rfc2629[3..-6] # skip <t>...</t>\n
|
317
|
+
end
|
318
|
+
|
285
319
|
SVG_COLORS = Hash.new {|h, k| k}
|
286
320
|
<<COLORS.each_line {|l| k, v = l.chomp.split; SVG_COLORS[k] = v}
|
287
321
|
black #000000
|
@@ -723,6 +757,7 @@ COLORS
|
|
723
757
|
|
724
758
|
def convert_xref(el, indent, opts)
|
725
759
|
gi = el.attr.delete('gi')
|
760
|
+
text = el.attr.delete('text')
|
726
761
|
target = el.attr['target']
|
727
762
|
if target[0] == "&"
|
728
763
|
"#{target};"
|
@@ -732,7 +767,12 @@ COLORS
|
|
732
767
|
else
|
733
768
|
gi ||= "xref"
|
734
769
|
end
|
735
|
-
|
770
|
+
if text
|
771
|
+
tail = ">#{Rfc2629::process_markdown(text)}</#{gi}>"
|
772
|
+
else
|
773
|
+
tail = "/>"
|
774
|
+
end
|
775
|
+
"<#{gi}#{el_html_attributes(el)}#{tail}"
|
736
776
|
end
|
737
777
|
end
|
738
778
|
|
@@ -827,13 +867,27 @@ COLORS
|
|
827
867
|
end
|
828
868
|
end
|
829
869
|
|
870
|
+
def self.bcp_std_ref(t, n)
|
871
|
+
warn "*** #{t} anchors not supported in v2 format" unless $options.v3
|
872
|
+
[name = "reference.#{t}.#{"%04d" % n.to_i}.xml",
|
873
|
+
"#{XML_RESOURCE_ORG_PREFIX}/bibxml-rfcsubseries-new/#{name}"] # FOR NOW
|
874
|
+
end
|
875
|
+
|
830
876
|
# [subdirectory name, cache ttl in seconds, does it provide for ?anchor=]
|
831
877
|
XML_RESOURCE_ORG_MAP = {
|
832
878
|
"RFC" => ["bibxml", 86400*7, false,
|
833
|
-
->(fn, n){ "
|
879
|
+
->(fn, n){ [name = "reference.RFC.#{"%04d" % n.to_i}.xml",
|
880
|
+
"https://www.rfc-editor.org/refs/bibxml/#{name}"] }
|
834
881
|
],
|
835
882
|
"I-D" => ["bibxml3", false, false,
|
836
|
-
->(fn, n){
|
883
|
+
->(fn, n){ [fn,
|
884
|
+
"https://datatracker.ietf.org/doc/bibxml3/draft-#{n.sub(/\Adraft-/, '')}/xml"] }
|
885
|
+
],
|
886
|
+
"BCP" => ["bibxml-rfcsubseries", 86400*7, false,
|
887
|
+
->(fn, n){ Rfc2629::bcp_std_ref("BCP", n) }
|
888
|
+
],
|
889
|
+
"STD" => ["bibxml-rfcsubseries", 86400*7, false,
|
890
|
+
->(fn, n){ Rfc2629::bcp_std_ref("STD", n) }
|
837
891
|
],
|
838
892
|
"W3C" => "bibxml4",
|
839
893
|
"3GPP" => "bibxml5",
|
@@ -884,7 +938,7 @@ COLORS
|
|
884
938
|
ttl ||= KRAMDOWN_REFCACHETTL # everything but RFCs might change a lot
|
885
939
|
puts "*** Huh: #{fn}" unless sub
|
886
940
|
if altproc && !KRAMDOWN_USE_TOOLS_SERVER
|
887
|
-
url = altproc.call(fn, n)
|
941
|
+
fn, url = altproc.call(fn, n)
|
888
942
|
else
|
889
943
|
url = "#{XML_RESOURCE_ORG_PREFIX}/#{sub}/#{fn}"
|
890
944
|
end
|
@@ -907,7 +961,7 @@ COLORS
|
|
907
961
|
}
|
908
962
|
else
|
909
963
|
REXML::XPath.each(d.root, "/reference/format") { |x|
|
910
|
-
x.attributes["target"].sub!(%r{https?://www.ietf.org/internet-drafts/},
|
964
|
+
x.attributes["target"].sub!(%r{https?://www.ietf.org/internet-drafts/},
|
911
965
|
%{https://www.ietf.org/archive/id/}) if t == "I-D"
|
912
966
|
}
|
913
967
|
end
|
@@ -1073,6 +1127,9 @@ COLORS
|
|
1073
1127
|
title = nil if title.empty?
|
1074
1128
|
value = el.value
|
1075
1129
|
if item = title
|
1130
|
+
if item == "<bcp14>" && $options.v3
|
1131
|
+
return "<bcp14>#{el.value}</bcp14>"
|
1132
|
+
end
|
1076
1133
|
m = title.scan(Parser::RFC2629Kramdown::IREF_START)
|
1077
1134
|
if m.empty?
|
1078
1135
|
subitem = value
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kramdown-rfc2629
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04
|
11
|
+
date: 2021-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|
@@ -62,6 +62,7 @@ executables:
|
|
62
62
|
- kramdown-rfc-extract-markdown
|
63
63
|
- kdrfc
|
64
64
|
- kramdown-rfc-cache-i-d-bibxml
|
65
|
+
- kramdown-rfc-cache-subseries-bibxml
|
65
66
|
extensions: []
|
66
67
|
extra_rdoc_files: []
|
67
68
|
files:
|
@@ -70,6 +71,7 @@ files:
|
|
70
71
|
- bin/doilit
|
71
72
|
- bin/kdrfc
|
72
73
|
- bin/kramdown-rfc-cache-i-d-bibxml
|
74
|
+
- bin/kramdown-rfc-cache-subseries-bibxml
|
73
75
|
- bin/kramdown-rfc-extract-markdown
|
74
76
|
- bin/kramdown-rfc2629
|
75
77
|
- data/encoding-fallbacks.txt
|