kramdown-rfc2629 1.4.13 → 1.4.14.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/kramdown-rfc2629 +68 -54
- data/kramdown-rfc2629.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eae0eb8f4dd2fc504dae8740508bde5266b9e914780999977d1633d16537a1aa
|
4
|
+
data.tar.gz: f373cfb67d09360f2d79480acca773d3f8af0454e643600406e845a4ffb8072f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88e3ed1e8713e1cf2ba6ceb4dd3aff3b83ab3397339edc83a9230fab5a2ac716a133be9acfd22a0a9bde793e8fecb709976f04285bfd0ebb09dec3c005fd3a1a
|
7
|
+
data.tar.gz: 8fe774e5ee8ab20885472f2a30fe5c65aab4ea56d80f7e4e334af25a4997a927fca85afd289b78d9088273822385b5ab96f15b0536657b4775516acb62fb049e
|
data/bin/kramdown-rfc2629
CHANGED
@@ -98,7 +98,61 @@ def yaml_load(input, *args)
|
|
98
98
|
end
|
99
99
|
else
|
100
100
|
YAML.load(input)
|
101
|
-
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def process_kramdown_options(coding_override = nil,
|
105
|
+
smart_quotes = nil, typographic_symbols = nil,
|
106
|
+
header_kramdown_options = nil)
|
107
|
+
|
108
|
+
ascii_target = coding_override && coding_override =~ /ascii/
|
109
|
+
suppress_typography = ascii_target || $options.v3
|
110
|
+
entity_output = ascii_target ? :numeric : :as_char;
|
111
|
+
|
112
|
+
options = {input: 'RFC2629Kramdown', entity_output: entity_output, link_defs: {}}
|
113
|
+
|
114
|
+
if smart_quotes.nil? && suppress_typography
|
115
|
+
smart_quotes = false
|
116
|
+
end
|
117
|
+
if smart_quotes == false
|
118
|
+
smart_quotes = ["'".ord, "'".ord, '"'.ord, '"'.ord]
|
119
|
+
end
|
120
|
+
case smart_quotes
|
121
|
+
when Array
|
122
|
+
options[:smart_quotes] = smart_quotes
|
123
|
+
when nil, true
|
124
|
+
# nothin
|
125
|
+
else
|
126
|
+
warn "*** Can't deal with smart_quotes value #{smart_quotes.inspect}"
|
127
|
+
end
|
128
|
+
|
129
|
+
if typographic_symbols.nil? && suppress_typography
|
130
|
+
typographic_symbols = false
|
131
|
+
end
|
132
|
+
if typographic_symbols == false
|
133
|
+
typographic_symbols = Hash[::Kramdown::Parser::Kramdown::TYPOGRAPHIC_SYMS.map { |k, v|
|
134
|
+
if Symbol === v
|
135
|
+
[v.intern, k]
|
136
|
+
end
|
137
|
+
}.compact]
|
138
|
+
end
|
139
|
+
# warn [:TYPOGRAPHIC_SYMBOLS, typographic_symbols].to_yaml
|
140
|
+
case typographic_symbols
|
141
|
+
when Hash
|
142
|
+
options[:typographic_symbols] = typographic_symbols
|
143
|
+
when nil, true
|
144
|
+
# nothin
|
145
|
+
else
|
146
|
+
warn "*** Can't deal with typographic_symbols value #{typographic_symbols.inspect}"
|
147
|
+
end
|
148
|
+
|
149
|
+
if header_kramdown_options
|
150
|
+
options.merge! header_kramdown_options
|
151
|
+
end
|
152
|
+
|
153
|
+
$global_markdown_options = options # For nested calls in bibref annotation processing and xref text
|
154
|
+
|
155
|
+
options
|
102
156
|
end
|
103
157
|
|
104
158
|
XREF_SECTIONS_RE = ::Kramdown::Parser::RFC2629Kramdown::SECTIONS_RE
|
@@ -127,10 +181,15 @@ def xml_from_sections(input)
|
|
127
181
|
# We put back the "---" plus gratuitous blank lines to hack the line number in errors
|
128
182
|
yaml_in = input[/---\s*/] << sections.shift[2]
|
129
183
|
ps = KramdownRFC::ParameterSet.new(yaml_load(yaml_in, [Date], [], true))
|
184
|
+
|
130
185
|
coding_override = ps.has(:coding)
|
131
186
|
smart_quotes = ps[:smart_quotes]
|
132
187
|
typographic_symbols = ps[:typographic_symbols]
|
133
|
-
|
188
|
+
header_kramdown_options = ps[:kramdown_options]
|
189
|
+
|
190
|
+
kramdown_options = process_kramdown_options(coding_override,
|
191
|
+
smart_quotes, typographic_symbols,
|
192
|
+
header_kramdown_options)
|
134
193
|
|
135
194
|
# all the other sections are put in a Hash, possibly concatenated from parts there
|
136
195
|
sechash = Hash.new{ |h,k| h[k] = ""}
|
@@ -243,13 +302,12 @@ def xml_from_sections(input)
|
|
243
302
|
end
|
244
303
|
|
245
304
|
stand_alone = ps[:stand_alone]
|
246
|
-
link_defs = {}
|
247
305
|
|
248
306
|
[:normative, :informative].each do |sn|
|
249
307
|
if refs = ps[sn]
|
250
308
|
refs.each do |k, v|
|
251
309
|
href = k.gsub(/\A[0-9]/) { "_#{$&}" } # can't start an IDREF with a number
|
252
|
-
link_defs[k] = ["##{href}", nil]
|
310
|
+
kramdown_options[:link_defs][k] = ["##{href}", nil] # allow [RFC2119] in addition to {{RFC2119}}
|
253
311
|
|
254
312
|
bibref = anchor_to_bibref[k] || k
|
255
313
|
bts, url = bibtagsys(bibref, k, stand_alone)
|
@@ -270,8 +328,6 @@ def xml_from_sections(input)
|
|
270
328
|
if bts && !v.delete("override")
|
271
329
|
warn "*** warning: explicit settings completely override canned bibxml in reference #{k}"
|
272
330
|
end
|
273
|
-
options = {input: 'RFC2629Kramdown', entity_output: coding_override, link_defs: link_defs}
|
274
|
-
$global_markdown_options = options # For recursive calls in bibref annotation processing.
|
275
331
|
sechash[sn.to_s] << KramdownRFC::ref_to_xml(k, v)
|
276
332
|
end
|
277
333
|
end
|
@@ -289,7 +345,7 @@ def xml_from_sections(input)
|
|
289
345
|
warn "*** sections left #{sechash.keys.inspect}!"
|
290
346
|
end
|
291
347
|
|
292
|
-
[input,
|
348
|
+
[input, kramdown_options, coding_override]
|
293
349
|
end
|
294
350
|
|
295
351
|
XML_RESOURCE_ORG_PREFIX = Kramdown::Converter::Rfc2629::XML_RESOURCE_ORG_PREFIX
|
@@ -371,7 +427,6 @@ if $options.verbose && $options.v3
|
|
371
427
|
warn "*** not much RFCXMLv3 stuff implemented yet"
|
372
428
|
end
|
373
429
|
|
374
|
-
coding_override = :as_char
|
375
430
|
input = ARGF.read
|
376
431
|
if input[0] == "\uFEFF"
|
377
432
|
warn "*** There is a leading byte order mark. Ignored."
|
@@ -392,59 +447,18 @@ if input =~ /[\t]/
|
|
392
447
|
input = expand_tabs(input)
|
393
448
|
end
|
394
449
|
|
395
|
-
link_defs = {}
|
396
450
|
if input =~ /\A---/ # this is a sectionized file
|
397
451
|
do_the_tls_dance unless ENV["KRAMDOWN_DONT_VERIFY_HTTPS"]
|
398
|
-
input,
|
452
|
+
input, options, coding_override = xml_from_sections(input)
|
453
|
+
else
|
454
|
+
options = process_kramdown_options # all default
|
399
455
|
end
|
400
456
|
if input =~ /\A<\?xml/ # if this is a whole XML file, protect it
|
401
457
|
input = "{::nomarkdown}\n#{input}\n{:/nomarkdown}\n"
|
402
458
|
end
|
403
|
-
options = {input: 'RFC2629Kramdown', entity_output: coding_override, link_defs: link_defs}
|
404
|
-
if smart_quotes.nil?
|
405
|
-
if (target_coding && target_coding =~ /ascii/) || $options.v3
|
406
|
-
smart_quotes = false
|
407
|
-
end
|
408
|
-
end
|
409
|
-
if smart_quotes == false
|
410
|
-
smart_quotes = ["'".ord, "'".ord, '"'.ord, '"'.ord]
|
411
|
-
end
|
412
|
-
case smart_quotes
|
413
|
-
when Array
|
414
|
-
options[:smart_quotes] = smart_quotes
|
415
|
-
when nil, true
|
416
|
-
# nothin
|
417
|
-
else
|
418
|
-
warn "*** Can't deal with smart_quotes value #{smart_quotes.inspect}"
|
419
|
-
end
|
420
|
-
if typographic_symbols.nil?
|
421
|
-
if (target_coding && target_coding =~ /ascii/) || $options.v3
|
422
|
-
typographic_symbols = false
|
423
|
-
end
|
424
|
-
end
|
425
|
-
if typographic_symbols == false
|
426
|
-
typographic_symbols = Hash[::Kramdown::Parser::Kramdown::TYPOGRAPHIC_SYMS.map { |k, v|
|
427
|
-
if Symbol === v
|
428
|
-
[v.intern, k]
|
429
|
-
end
|
430
|
-
}.compact]
|
431
|
-
end
|
432
|
-
# warn [:TYPOGRAPHIC_SYMBOLS, typographic_symbols].to_yaml
|
433
|
-
case typographic_symbols
|
434
|
-
when Hash
|
435
|
-
options[:typographic_symbols] = typographic_symbols
|
436
|
-
when nil, true
|
437
|
-
# nothin
|
438
|
-
else
|
439
|
-
warn "*** Can't deal with typographic_symbols value #{typographic_symbols.inspect}"
|
440
|
-
end
|
441
|
-
|
442
|
-
if kramdown_options
|
443
|
-
options.merge! kramdown_options
|
444
|
-
end
|
445
459
|
|
446
|
-
if
|
447
|
-
input = input.encode(Encoding.find(
|
460
|
+
if coding_override
|
461
|
+
input = input.encode(Encoding.find(coding_override), fallback: FALLBACK)
|
448
462
|
end
|
449
463
|
|
450
464
|
# warn "options: #{options.inspect}"
|
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.14.pre'
|
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.}
|
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.14.pre
|
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-05-
|
11
|
+
date: 2021-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|
@@ -98,9 +98,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: 2.3.0
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 1.3.1
|
104
104
|
requirements: []
|
105
105
|
rubygems_version: 3.2.15
|
106
106
|
signing_key:
|