html-pipeline-highlight 0.1.0 → 0.2.0

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: 1686b4e2ea65ee6d254fe5fea91c9db9e5026db9ee23e07b078187cf962fb56c
4
- data.tar.gz: eea09fa61e8f1d2afac2285b97148c630b430e58be1cc9756d82436f1afa584f
3
+ metadata.gz: 27b92c584e4dd32fb66fa437b11af62d2de5ec94190002de4fe5270fd0e9a200
4
+ data.tar.gz: 0eadbd7776460f32a28bbaf55437ed8bce142b539e6ed1fdc7106b43a97c4d97
5
5
  SHA512:
6
- metadata.gz: c17dddb20d6138a81caaae5a8094a67c633e30b0f14dddd9cb18aa92480d014629ba45ecf5a934c887ba191637543b87cd1bc8d97a9b04f608e694e922e6ffa7
7
- data.tar.gz: ed2d87488a90db0a52112d3bbfb2bf3b0b097d2e19cd84462b9c53fe3f59b8f952f8a6da2d4a53d2069e89b03d05526894d2774024a49ddd8c8863d50dd7e53d
6
+ metadata.gz: bc2b71ea2c9ce5b5f64f696075331430400eadce97ab69c43a5f8f4861b45ff576b35130813e394d0ba664d908f85b2db57fb24cbb95079585e40ab74caeca83
7
+ data.tar.gz: cf43ab1b0deb70334249da04fa504dc39ff16814bed614b0cd17cc10028671ac31350b441bd5fd6fd58455a9756d2eaa18c3e18bd9aac146d289d6ff1b3e1094
@@ -21,7 +21,11 @@ module HTML
21
21
 
22
22
  def apply_filter(content)
23
23
  content.gsub(@context[:highlight_pattern]) do |text|
24
- %(<span class="#{class_name}">#{ERB::Util.html_escape(text)}</span>)
24
+ if converter
25
+ converter.call(Regexp.last_match)
26
+ else
27
+ %(<span class="#{class_name}">#{ERB::Util.html_escape(text)}</span>)
28
+ end
25
29
  end
26
30
  end
27
31
 
@@ -34,6 +38,10 @@ module HTML
34
38
  def class_name
35
39
  @context[:highlight_class_name] || DEFAULT_CLASS_NAME
36
40
  end
41
+
42
+ def converter
43
+ @context[:highlight_converter]
44
+ end
37
45
  end
38
46
  end
39
47
  end
@@ -1,7 +1,7 @@
1
1
  module HTML
2
2
  class Pipeline
3
3
  module Highlight
4
- VERSION = "0.1.0"
4
+ VERSION = '0.2.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-pipeline-highlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki77
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-25 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-pipeline