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 +4 -4
- data/lib/html/pipeline/highlight/filter.rb +9 -1
- data/lib/html/pipeline/highlight/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27b92c584e4dd32fb66fa437b11af62d2de5ec94190002de4fe5270fd0e9a200
|
4
|
+
data.tar.gz: 0eadbd7776460f32a28bbaf55437ed8bce142b539e6ed1fdc7106b43a97c4d97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
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.
|
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:
|
11
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html-pipeline
|