kramdown-rfc2629 1.6.38 → 1.6.40

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b4707d20a26b963bdbf7423a2cc460769d6336d2ff01b47a3f74ec34f9a09fc
4
- data.tar.gz: 3371f7774a039bf5effefb353baf1ffb7e1ccac76369db43f0f77c9b6e4284be
3
+ metadata.gz: 77429bca054e212b3c696036e1258ecb6d182d474d25e8a68fc2d6f1100ea735
4
+ data.tar.gz: c8f4306f3b9f8bd68992b3cf7cac334e265d910e32bb83b71fd639daccb03b69
5
5
  SHA512:
6
- metadata.gz: ab844b01fc405878b32920b37ee05bc9354c6a5d3d9a2adf2eeeeca1862e89ebec0b94d7638afb893de745c3142d69ad4aecfa534f814dc7288b4208cb226fce
7
- data.tar.gz: 60f42e7ded57af960bf618078eaa6d3f16591fc8099b897b1d5d7108bcf38b4e50c4123d198d1409197488f6ef7ab5678788c40bf42c097ccb859b6a09ebbe05
6
+ metadata.gz: 86f9a106f2bcb45257096fa91f261a19c2c427717683ca62a254d9a5c5db176b80040a8ddaadaea5b7d12567fd851be3f296b9fd358cf182ddcfcde290b49f1c
7
+ data.tar.gz: 32844ddd9b5f10a72541f3247a93f86cecdf019f456777522d62d38a8933ac249a6bef1b4618e32884043fa68edc14dad59a2bcbe5ce7cac659461316cf295e3
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.6.38'
3
+ s.version = '1.6.40'
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.}
@@ -68,9 +68,9 @@ end
68
68
 
69
69
 
70
70
  def boilerplate(key)
71
+ ret = ''
71
72
  case key.downcase
72
73
  when /\Abcp14(info)?(\+)?(-tagged)?\z/i
73
- ret = ''
74
74
  if $1
75
75
  ret << <<RFC8174ise
76
76
  Although this document is not an IETF Standards Track publication, it
@@ -109,8 +109,36 @@ PLUS
109
109
  TAGGED
110
110
  end
111
111
  ret
112
+ when /\Arfc\s*7942(info)?\z/i
113
+ if $1
114
+ ret << <<INFO
115
+ (Boilerplate as per {{Section 2.1 of RFC7942}}:)
116
+
117
+ INFO
118
+ end
119
+ ret << <<RFC7942
120
+ This section records the status of known implementations of the
121
+ protocol defined by this specification at the time of posting of
122
+ this Internet-Draft, and is based on a proposal described in
123
+ {{?RFC7942}}. The description of implementations in this section is
124
+ intended to assist the IETF in its decision processes in
125
+ progressing drafts to RFCs. Please note that the listing of any
126
+ individual implementation here does not imply endorsement by the
127
+ IETF. Furthermore, no effort has been spent to verify the
128
+ information presented here that was supplied by IETF contributors.
129
+ This is not intended as, and must not be construed to be, a
130
+ catalog of available implementations or their features. Readers
131
+ are advised to note that other implementations may exist.
132
+
133
+ According to {{?RFC7942}}, "this will allow reviewers and working
134
+ groups to assign due consideration to documents that have the
135
+ benefit of running code, which may serve as evidence of valuable
136
+ experimentation and feedback that have made the implemented
137
+ protocols more mature. It is up to the individual working groups
138
+ to use this information as they see fit".
139
+ RFC7942
112
140
  else
113
- warn "** Unknwon boilerplate key: #{key}"
141
+ warn "** Unknown boilerplate key: #{key}"
114
142
  "{::boilerplate #{key}}"
115
143
  end
116
144
  end
@@ -222,6 +250,8 @@ def spacify_re(s)
222
250
  s.gsub(' ', '[\u00A0\s]+')
223
251
  end
224
252
 
253
+ include ::Kramdown::Utils::Html
254
+
225
255
  def xml_from_sections(input)
226
256
 
227
257
  unless ENV["KRAMDOWN_NO_SOURCE"]
@@ -400,11 +430,14 @@ def xml_from_sections(input)
400
430
 
401
431
  bibref = anchor_to_bibref[k] || k
402
432
  bts, url = bibtagsys(bibref, k, stand_alone)
433
+ ann = v.delete("annotation") || v.delete("ann") if Hash === v
403
434
  if bts && (!v || v == {} || v.respond_to?(:to_str))
404
435
  if stand_alone
405
436
  a = %{{: anchor="#{k}"}}
437
+ a[-1...-1] = %{ ann="#{escape_html(ann, :attribute)}"} if ann
406
438
  sechash[sn.to_s] << %{\n#{NMDTAGS[0]}\n![:include:](#{bts})#{a}\n#{NMDTAGS[1]}\n}
407
439
  else
440
+ warn "*** please use standalone mode for adding annotations to references" if ann
408
441
  bts.gsub!('/', '_')
409
442
  (ps.rest["bibxml"] ||= []) << [bts, url]
410
443
  sechash[sn.to_s] << %{&#{bts};\n} # ???
@@ -417,6 +450,7 @@ def xml_from_sections(input)
417
450
  if bts && !v.delete("override")
418
451
  warn "*** warning: explicit settings completely override canned bibxml in reference #{k}"
419
452
  end
453
+ v["ann"] = ann if ann
420
454
  sechash[sn.to_s] << KramdownRFC::ref_to_xml(href, v)
421
455
  end
422
456
  end
@@ -370,10 +370,19 @@ module Kramdown
370
370
  generate_id(value).gsub(/-+/, '-')
371
371
  end
372
372
 
373
- def self.process_markdown(v) # Uuh. Heavy coupling.
373
+ def self.process_markdown1(v) # Uuh. Heavy coupling.
374
374
  doc = ::Kramdown::Document.new(v, $global_markdown_options)
375
375
  $stderr.puts doc.warnings.to_yaml unless doc.warnings.empty?
376
- doc.to_rfc2629[3..-6] # skip <t>...</t>\n
376
+ doc.to_rfc2629
377
+ end
378
+
379
+ def self.process_markdown(v)
380
+ process_markdown1(v)[3..-6] # skip <t>...</t>\n
381
+ end
382
+
383
+ def self.process_markdown_to_rexml(v)
384
+ s = process_markdown1(v)
385
+ REXML::Document.new(s)
377
386
  end
378
387
 
379
388
  SVG_COLORS = Hash.new {|h, k| k}
@@ -1234,6 +1243,7 @@ COLORS
1234
1243
  end
1235
1244
  end
1236
1245
  if alt == ":include:" # Really bad misuse of tag...
1246
+ ann = el.attr.delete('ann')
1237
1247
  anchor = el.attr.delete('anchor') || (
1238
1248
  # not yet
1239
1249
  warn "*** missing anchor for '#{src}'"
@@ -1282,6 +1292,11 @@ COLORS
1282
1292
  elsif t == "IANA"
1283
1293
  d.root.attributes["target"].sub!(%r{\Ahttp://www.iana.org/assignments/}, 'https://www.iana.org/assignments/')
1284
1294
  end
1295
+ if ann
1296
+ el = ::Kramdown::Converter::Rfc2629::process_markdown_to_rexml(ann).root
1297
+ el.name = "annotation"
1298
+ d.root.add_element(el)
1299
+ end
1285
1300
  to_insert = d.to_s
1286
1301
  rescue Exception => e
1287
1302
  warn "** Can't manipulate reference XML: #{e}"
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.6.38
4
+ version: 1.6.40
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-07-13 00:00:00.000000000 Z
11
+ date: 2023-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  requirements: []
209
- rubygems_version: 3.4.6
209
+ rubygems_version: 3.4.10
210
210
  signing_key:
211
211
  specification_version: 4
212
212
  summary: Kramdown extension for generating RFCXML (RFC 799x).