kramdown-rfc2629 1.6.39 → 1.6.41

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dd9850010affb48c52dc3a4588cb1b40865e70cf48df86462bcace0a3bad608
4
- data.tar.gz: 2cb3b944b632a2531df81229ebd66070322e9bcf5618aad25056b157645a2659
3
+ metadata.gz: 2286f771b6e0e4c0076943423368a230cd99236217f66ffc885a9b8189b118e7
4
+ data.tar.gz: 2769ebdb763e2487e91e5a9035d36c236f85fc87bfe6a41eafa094bd82271e4e
5
5
  SHA512:
6
- metadata.gz: ec990f7803c98045b0c0996a9b01f378cbed9047853c6f7362883ea6fdf54566fa5409ca2ec7139e5b6e3fbeaca7949a09f19099d3fbb0573423eac460aefe69
7
- data.tar.gz: 80309e87ac34e71824b7adbcef296f77e0c5f5b448f7b6161d0541b9ff36ecc8c59d5307ff6f67ef1ae97398cfe5ec9886cccf23cecb3556a8f0d0723ce10a3b
6
+ metadata.gz: 331795b0a1ba4eb39cff381790c2b53932f748074232d0b2c212e8b88f643bf95a24df9ccf4b8e6297fdc50ac0a86835b2083690304773563ab7afbc88e8e3f8
7
+ data.tar.gz: 1b396ec4758aec2c343dfeaa5f4102f3f9551877160e6ccedc1d1b997e0db850732dfa0ba4ae09346c5ddf47fca273f80eeb7c2cffe387f1236a6388621d8f45
@@ -183,7 +183,7 @@
183
183
  <% end -%>
184
184
 
185
185
  <% if sh = sechash.delete("normative") -%>
186
- <references title='Normative References'>
186
+ <references title='Normative References' anchor="sec-normative-references">
187
187
 
188
188
  <%= sh %>
189
189
 
@@ -191,7 +191,7 @@
191
191
  <% end -%>
192
192
 
193
193
  <% if sh = sechash.delete("informative") -%>
194
- <references title='Informative References'>
194
+ <references title='Informative References' anchor="sec-informative-references">
195
195
 
196
196
  <%= sh %>
197
197
 
@@ -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.41'
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.41
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-21 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).