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: e74c610889ccb70159594f238a07ebc9f24ae431
4
- data.tar.gz: 9dee370a18ba21d77b6b41795beea12a322b517c
3
+ metadata.gz: edc38f017b9bbdfe97c9dcdb8e025e9566420034
4
+ data.tar.gz: cad8b5bed4a208d3898eee39c8f75ecc02f7ab8c
5
5
  SHA512:
6
- metadata.gz: de84d66b222b25f36b47c53308541b50c7f603c1b8b8d18b7887301efcf2bef3014aed13da7d3872808067b0f0f22d0467dc8eaaad6cd622449ce90b151c09e6
7
- data.tar.gz: 42ea91cd77c7e438ee3425d75a49d7a40edc8efda933d12aead3957fa3649644a9a3c3af282640eb3a3d0e7eecf7a0b7cedf470cc7994276a0a07de12719f747
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.2.1'
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 "github-markdown", "~> 0.5"
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}' target='_blank' class='hashtag'>#%{tag}</a>"
79
+ "<a href='%{url}' %{tag_link_attr}>#%{tag}</a>"
71
80
  end
72
81
  end
73
82
  end
@@ -1,7 +1,7 @@
1
1
  module Html
2
2
  module Pipeline
3
3
  module Hashtag
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
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-hashtag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.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: 2015-10-29 00:00:00.000000000 Z
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.2.1
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.2.1
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: github-markdown
42
+ name: commonmarker
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.5'
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: '0.5'
54
+ version: 0.18.2
55
55
  description: HTML Pipeline filter that replaces hashtags with links.
56
56
  email:
57
57
  - dxdy@bk.ru