html-pipeline-hashtag 0.1.1 → 0.1.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edc38f017b9bbdfe97c9dcdb8e025e9566420034
|
4
|
+
data.tar.gz: cad8b5bed4a208d3898eee39c8f75ecc02f7ab8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dbbba8398d308e3f4da6fca53af831f0f38a5aab36c974a351026d63b90208734e330d0654832a4376152287c7a1eb501fbffea2394286cb7334ffbfaf2f210
|
7
|
+
data.tar.gz: eb8261a6434076a7d2fb77490330b60236340e522193f669cf7c38e5f2847e0f3ac8a19c2a4de6630ac0bda0d03327076c054c6b2054e6043cf3c097a31bdf1b
|
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency 'html-pipeline', '>= 2.
|
21
|
+
spec.add_dependency 'html-pipeline', '>= 2.9.1'
|
22
22
|
|
23
23
|
spec.add_development_dependency "rspec", '~> 3.2.0'
|
24
|
-
spec.add_development_dependency "
|
24
|
+
spec.add_development_dependency "commonmarker", "~> 0.18.2"
|
25
25
|
end
|
@@ -12,6 +12,7 @@ module HTML
|
|
12
12
|
# Example: http://localhost/search?q=%{tag}
|
13
13
|
# :hashtag_pattern - Used to provide a custom regular expression to
|
14
14
|
# indentify hashtags
|
15
|
+
# :tag_link_attr - HTML attributes for the link that will be generated
|
15
16
|
#
|
16
17
|
class HashtagFilter < Filter
|
17
18
|
def self.hashtags_in(text, hashtag_pattern = HashtagPattern)
|
@@ -49,6 +50,14 @@ module HTML
|
|
49
50
|
'/tags/%{tag}'
|
50
51
|
end
|
51
52
|
|
53
|
+
def tag_link_attr
|
54
|
+
context[:tag_link_attr] || default_tag_link_attr
|
55
|
+
end
|
56
|
+
|
57
|
+
def default_tag_link_attr
|
58
|
+
"target='_blank' class='hashtag'"
|
59
|
+
end
|
60
|
+
|
52
61
|
def hashtag_pattern
|
53
62
|
context[:hashtag_pattern] || HashtagPattern
|
54
63
|
end
|
@@ -63,11 +72,11 @@ module HTML
|
|
63
72
|
|
64
73
|
def link_to_hashtag(tag)
|
65
74
|
url = tag_url % { tag: tag }
|
66
|
-
link_pattern % { url: url, tag: tag }
|
75
|
+
link_pattern % { url: url, tag: tag, tag_link_attr: tag_link_attr }
|
67
76
|
end
|
68
77
|
|
69
78
|
def link_pattern
|
70
|
-
"<a href='%{url}'
|
79
|
+
"<a href='%{url}' %{tag_link_attr}>#%{tag}</a>"
|
71
80
|
end
|
72
81
|
end
|
73
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html-pipeline-hashtag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- German Antsiferov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html-pipeline
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.9.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.9.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: commonmarker
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.18.2
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.18.2
|
55
55
|
description: HTML Pipeline filter that replaces hashtags with links.
|
56
56
|
email:
|
57
57
|
- dxdy@bk.ru
|