kramdown-rfc2629 1.7.1 → 1.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/kramdown-rfc-extract-sourcecode +9 -1
- data/kramdown-rfc2629.gemspec +1 -1
- data/lib/kramdown-rfc/command.rb +9 -8
- data/lib/kramdown-rfc2629.rb +24 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb7b62deaf23ec115b6b5b470e27bc099169d24ec1b09cd78e39a53f710d0319
|
4
|
+
data.tar.gz: 28ceab4f96a1c33dee2ab4c53ae4423069bb5f9d6f61e55a69ec8a1991b8109e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e95b5dcecb044404550dc3f481581d7cd044e4738b805cd8156c217910cf22a5e69f50b0c5bfc907d2f10c58c568d8eb8856924e4a0ca84429861a1ea0429ef
|
7
|
+
data.tar.gz: e0298c6433e0063aad63e04336f4f4f722ff878d053a565efc2502b3de35a286388952c68ca72805b32f1322b9f71c541fae8f0a80ce22a5532817ac1327f816
|
data/README.md
CHANGED
@@ -150,7 +150,7 @@ or
|
|
150
150
|
email: pthubert@cisco.com
|
151
151
|
|
152
152
|
(the hash keys are the XML GIs from RFC 7749, with a flattened
|
153
|
-
structure. As RFC 7749
|
153
|
+
structure. As RFC 7749 requires giving both the full name and
|
154
154
|
surname/initials, we use `ins` as an abbreviation for
|
155
155
|
"initials/surname". Yes, the toolchain is Unicode-capable, even if
|
156
156
|
the final RFC output is still in ASCII.)
|
@@ -67,7 +67,15 @@ REXML::XPath.each(d.root, "//sourcecode|//artwork") do |x|
|
|
67
67
|
else
|
68
68
|
taken[ty][name] = ''
|
69
69
|
end
|
70
|
-
|
70
|
+
extracted = false
|
71
|
+
REXML::XPath.each(x, "svg") do |svg|
|
72
|
+
# According to v3.rnc, there should be only one...
|
73
|
+
taken[ty][name] << svg.to_s
|
74
|
+
extracted = true
|
75
|
+
end
|
76
|
+
unless extracted
|
77
|
+
taken[ty][name] << handle_artwork_sourcecode(x.all_text, unfold)
|
78
|
+
end
|
71
79
|
end
|
72
80
|
end
|
73
81
|
|
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.7.
|
3
|
+
s.version = '1.7.3'
|
4
4
|
s.summary = "Kramdown extension for generating RFCXML (RFC 799x)."
|
5
5
|
s.description = %{An RFCXML (RFC 799x) generating backend for Thomas Leitner's
|
6
6
|
"kramdown" markdown parser. Mostly useful for RFC writers.}
|
data/lib/kramdown-rfc/command.rb
CHANGED
@@ -360,18 +360,19 @@ def xml_from_sections(input)
|
|
360
360
|
next if k == "fluff"
|
361
361
|
v.gsub!(/{{(#{
|
362
362
|
spacify_re(XSR_PREFIX)
|
363
|
-
})?(?:([?!])(-)?|(-))([\w._\-]+)(?:=([\w.\/_\-]+))?(#{
|
363
|
+
})?([\w.\/_\-]+@)?(?:([?!])(-)?|(-))([\w._\-]+)(?:=([\w.\/_\-]+))?(#{
|
364
364
|
XREF_TXT_SUFFIX
|
365
365
|
})?(#{
|
366
366
|
spacify_re(XSR_SUFFIX)
|
367
367
|
})?}}/) do |match|
|
368
368
|
xsr_prefix = $1
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
369
|
+
subref = $2
|
370
|
+
norminform = $3
|
371
|
+
replacing = $4 || $5
|
372
|
+
word = $6
|
373
|
+
bibref = $7
|
374
|
+
xrt_suffix = $8
|
375
|
+
xsr_suffix = $9
|
375
376
|
if replacing
|
376
377
|
if new = ref_replacements[word]
|
377
378
|
word = new
|
@@ -395,7 +396,7 @@ def xml_from_sections(input)
|
|
395
396
|
if norminform
|
396
397
|
norm_ref[word] ||= norminform == '!' # one normative ref is enough
|
397
398
|
end
|
398
|
-
"{{#{xsr_prefix}#{word}#{xrt_suffix}#{xsr_suffix}}}"
|
399
|
+
"{{#{xsr_prefix}#{subref}#{word}#{xrt_suffix}#{xsr_suffix}}}"
|
399
400
|
end
|
400
401
|
end
|
401
402
|
|
data/lib/kramdown-rfc2629.rb
CHANGED
@@ -78,6 +78,11 @@ module Kramdown
|
|
78
78
|
href.gsub(/\A(?:[0-9]|section-|u-|figure-|table-|iref-)/) { "_#{$&}" }
|
79
79
|
end
|
80
80
|
|
81
|
+
def rfc_mention(target1) # only works for RFCnnnn
|
82
|
+
target1 =~ /\A([A-Z]*)(.*)\z/
|
83
|
+
"#$1 #$2 "
|
84
|
+
end
|
85
|
+
|
81
86
|
def handle_bares(s, attr, format, href, last_join = nil)
|
82
87
|
if s.match(/\A(#{XREF_ANY}) and (#{XREF_ANY})\z/)
|
83
88
|
handle_bares($1, {}, nil, href, " and ")
|
@@ -86,13 +91,14 @@ module Kramdown
|
|
86
91
|
end
|
87
92
|
|
88
93
|
href = href.split(' ')[0] # Remove any trailing (...)
|
94
|
+
target1, target2 = href.split("@", 2)
|
89
95
|
multi = last_join != nil
|
90
96
|
(sn, s) = s.split(' ', 2)
|
91
97
|
loop do
|
92
98
|
m = s.match(/\A#{XREF_RE_M}(, (?:and )?| and )?/)
|
93
99
|
break if not m
|
94
100
|
|
95
|
-
if not multi and not m[2] and not m[3]
|
101
|
+
if not multi and not m[2] and not m[3] and not target2
|
96
102
|
# Modify |attr| if there is a single reference. This can only be
|
97
103
|
# used if there is only one section reference and the section part
|
98
104
|
# has no title.
|
@@ -110,9 +116,13 @@ module Kramdown
|
|
110
116
|
multi = true
|
111
117
|
s[m[0]] = ''
|
112
118
|
|
113
|
-
attr1 = { 'target' =>
|
119
|
+
attr1 = { 'target' => target1, 'section' => m[1], 'sectionFormat' => 'bare', 'text' => m[2] }
|
114
120
|
@tree.children << Element.new(:xref, nil, attr1)
|
115
|
-
|
121
|
+
andof = m[3] || last_join || " of "
|
122
|
+
if andof == " of " && target2
|
123
|
+
andof += rfc_mention(target1)
|
124
|
+
end
|
125
|
+
@tree.children << Element.new(:text, andof, {})
|
116
126
|
end
|
117
127
|
end
|
118
128
|
|
@@ -135,18 +145,22 @@ module Kramdown
|
|
135
145
|
else
|
136
146
|
href = @src[3]
|
137
147
|
attr = {}
|
148
|
+
handled_subref = false
|
138
149
|
if $options.v3
|
139
150
|
# match Section ... of ...; set section, sectionFormat
|
140
151
|
case href.gsub(/[\u00A0\s]+/, ' ') # may need nbsp and/or newlines
|
141
152
|
when /\A(#{SECTIONS_RE}) of (.*)\z/
|
142
153
|
href = $2
|
143
154
|
handle_bares($1, attr, "of", href)
|
155
|
+
handled_subref = true
|
144
156
|
when /\A(.*), (#{SECTIONS_RE})\z/
|
145
157
|
href = $1
|
146
158
|
handle_bares($2, attr, "comma", href)
|
159
|
+
handled_subref = true
|
147
160
|
when /\A(.*) \((#{SECTIONS_RE})\)\z/
|
148
161
|
href = $1
|
149
162
|
handle_bares($2, attr, "parens", href)
|
163
|
+
handled_subref = true
|
150
164
|
when /#{XREF_RE_M}<(.+)\z/
|
151
165
|
href = $3
|
152
166
|
if $2
|
@@ -168,6 +182,13 @@ module Kramdown
|
|
168
182
|
href = $1
|
169
183
|
attr['text'] = $2
|
170
184
|
end
|
185
|
+
target1, target2 = href.split("@", 2) # should do this only for sectionref...
|
186
|
+
if target2
|
187
|
+
href = target2
|
188
|
+
unless handled_subref
|
189
|
+
@tree.children << Element.new(:text, rfc_mention(target1), {})
|
190
|
+
end
|
191
|
+
end
|
171
192
|
href = self.class.idref_cleanup(href)
|
172
193
|
attr['target'] = href
|
173
194
|
el = Element.new(:xref, nil, attr)
|
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.7.
|
4
|
+
version: 1.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|