kramdown-rfc2629 1.6.39 → 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: 5dd9850010affb48c52dc3a4588cb1b40865e70cf48df86462bcace0a3bad608
4
- data.tar.gz: 2cb3b944b632a2531df81229ebd66070322e9bcf5618aad25056b157645a2659
3
+ metadata.gz: 77429bca054e212b3c696036e1258ecb6d182d474d25e8a68fc2d6f1100ea735
4
+ data.tar.gz: c8f4306f3b9f8bd68992b3cf7cac334e265d910e32bb83b71fd639daccb03b69
5
5
  SHA512:
6
- metadata.gz: ec990f7803c98045b0c0996a9b01f378cbed9047853c6f7362883ea6fdf54566fa5409ca2ec7139e5b6e3fbeaca7949a09f19099d3fbb0573423eac460aefe69
7
- data.tar.gz: 80309e87ac34e71824b7adbcef296f77e0c5f5b448f7b6161d0541b9ff36ecc8c59d5307ff6f67ef1ae97398cfe5ec9886cccf23cecb3556a8f0d0723ce10a3b
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.39'
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.}
@@ -138,7 +138,7 @@ protocols more mature. It is up to the individual working groups
138
138
  to use this information as they see fit".
139
139
  RFC7942
140
140
  else
141
- warn "** Unknwon boilerplate key: #{key}"
141
+ warn "** Unknown boilerplate key: #{key}"
142
142
  "{::boilerplate #{key}}"
143
143
  end
144
144
  end
@@ -250,6 +250,8 @@ def spacify_re(s)
250
250
  s.gsub(' ', '[\u00A0\s]+')
251
251
  end
252
252
 
253
+ include ::Kramdown::Utils::Html
254
+
253
255
  def xml_from_sections(input)
254
256
 
255
257
  unless ENV["KRAMDOWN_NO_SOURCE"]
@@ -428,11 +430,14 @@ def xml_from_sections(input)
428
430
 
429
431
  bibref = anchor_to_bibref[k] || k
430
432
  bts, url = bibtagsys(bibref, k, stand_alone)
433
+ ann = v.delete("annotation") || v.delete("ann") if Hash === v
431
434
  if bts && (!v || v == {} || v.respond_to?(:to_str))
432
435
  if stand_alone
433
436
  a = %{{: anchor="#{k}"}}
437
+ a[-1...-1] = %{ ann="#{escape_html(ann, :attribute)}"} if ann
434
438
  sechash[sn.to_s] << %{\n#{NMDTAGS[0]}\n![:include:](#{bts})#{a}\n#{NMDTAGS[1]}\n}
435
439
  else
440
+ warn "*** please use standalone mode for adding annotations to references" if ann
436
441
  bts.gsub!('/', '_')
437
442
  (ps.rest["bibxml"] ||= []) << [bts, url]
438
443
  sechash[sn.to_s] << %{&#{bts};\n} # ???
@@ -445,6 +450,7 @@ def xml_from_sections(input)
445
450
  if bts && !v.delete("override")
446
451
  warn "*** warning: explicit settings completely override canned bibxml in reference #{k}"
447
452
  end
453
+ v["ann"] = ann if ann
448
454
  sechash[sn.to_s] << KramdownRFC::ref_to_xml(href, v)
449
455
  end
450
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.39
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-17 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).