kramdown-rfc2629 1.5.15 → 1.5.16

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: 1a7de9b6c78edf74415c185732e4b41a2d5685b07968bd187ce0948ea6dfd607
4
- data.tar.gz: 52abd5a775d5c9922531b199fc957fbfe645621b4db3b59a624b0940ec328bf9
3
+ metadata.gz: def25c3e3ddc2683800f2521956c7b7546da22ff963d08ea373bdb3626f5be6f
4
+ data.tar.gz: 453b9c763e43fa1930fe6f9239efb4951d73e479c4a82df1578443c872cec588
5
5
  SHA512:
6
- metadata.gz: 6a10a5fa3678b60ac5e1fa56ca42ef38529ff577e1a206c87784d9afb53d73af853ba16fbf0ec233152c55614b0ee9a22b40e332c0fd2b14bf7371333359baf7
7
- data.tar.gz: 4dd3ef2b8698068f39b3e2c032f3bd76d281ac8fadb46820867b266339bee9aa86787eb0a60b72d853f03b33f0190256c4125fdf8950d8a877106dbdb855e6e3
6
+ metadata.gz: c7b09f669ef3c392e932264a1818db17679956178095a426d00ec0858c83dd5305752f2c9dfd042117f7f2786b085b750aa397f5afe0cf114a0811ca316fcbee
7
+ data.tar.gz: a14a50df013430d0e73b1d1e03a954cf6b54feef3cdaaca402546b93b086eb954bb22f85484fc5eda8da2859e6e0cd8dcc2a073d1509825e99dcb8c9754f03b3
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.5.15'
3
+ s.version = '1.5.16'
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.}
@@ -34,6 +34,18 @@ module Kramdown
34
34
 
35
35
  class RFC2629Kramdown < Kramdown
36
36
 
37
+ def replace_abbreviations(el, regexps = nil)
38
+ unless regexps # DUPLICATED AND MODIFIED CODE FROM UPSTREAM, CHECK ON UPSTREAM UPGRADE
39
+ sorted_abbrevs = @root.options[:abbrev_defs].keys.sort {|a, b| b.length <=> a.length }
40
+ regexps = [Regexp.union(*sorted_abbrevs.map {|k|
41
+ /#{Regexp.escape(k).gsub(/\\\s/, "[\\s\\p{Z}]+").force_encoding(Encoding::UTF_8)}/})]
42
+ # warn regexps.inspect
43
+ regexps << /(?=(?:\W|^)#{regexps.first}(?!\w))/ # regexp should only match on word boundaries
44
+ end
45
+ super(el, regexps)
46
+ end
47
+
48
+
37
49
  def initialize(*doc)
38
50
  super
39
51
  @span_parsers.unshift(:xref)
@@ -1264,9 +1276,14 @@ COLORS
1264
1276
  return el.value
1265
1277
  end
1266
1278
 
1267
- title = @root.options[:abbrev_defs][el.value]
1268
- title = nil if title.empty?
1269
1279
  value = el.value
1280
+ ix = value.gsub(/[\s\p{Z}]+/, " ")
1281
+ title = @root.options[:abbrev_defs][ix]
1282
+ if title.nil?
1283
+ warn "*** abbrev mismatch: value = #{value.inspect} ix = #{ix.inspect}"
1284
+ else
1285
+ title = nil if title.empty?
1286
+ end
1270
1287
 
1271
1288
  if title == "<bcp14>" && $options.v3
1272
1289
  return "<bcp14>#{value}</bcp14>"
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.5.15
4
+ version: 1.5.16
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-10-29 00:00:00.000000000 Z
11
+ date: 2021-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown