text_helpers 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of text_helpers might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97f5f8d490471d60b7cc9286f2fb49460862917a1ed6b6d36c984fb8f5a22ac3
4
- data.tar.gz: a2fadb5cea94f89c87cf31ef1a7dbb8779739c6aab67d2b9f143968498cc25e7
3
+ metadata.gz: d4e0a6d2b19adb159000ea905c72b4023942ae268e36ac0eb9b39baf551e7460
4
+ data.tar.gz: ba520c7137fe2355dab9c1e29cbf215c2a19baccef7b246b850f188f909e81e5
5
5
  SHA512:
6
- metadata.gz: 73f98e2a518aeafb35653d9d713a3b983d456d2e947bc98fcc1c519d9b8b7034f741eb2985475336e5b9fe6786ebc8502e2fe9994001a259c19c1c0800b769d2
7
- data.tar.gz: 37a0c2ba7e0510dd38d720abafb43ba6342f1af8b578422b520d82956aa9a46df22b87a6774b615f1665a21b11618f185229face8e8c9b44513c44081cd1f2f0
6
+ metadata.gz: c1fb87f89fbc7e42cfeab3fa224573097626b6dafd3c252076f7b13df1de5c7a8e8046b95207ba8d69dc9d50aa4290b2bd859166ef2cf17441bddad961ad8f10
7
+ data.tar.gz: 599e77b95ca58b291bf1d0348b65cfb4e7f2ff831e2a2850a2fd883df1e4fb9e6d569aecd1a209fb6cedf1df1e7aa9136be5ec3db55a6bc61b3ab2b3197d9eb5
@@ -0,0 +1,88 @@
1
+ # Change Log
2
+
3
+ ## [1.1.0] - 2020-12-02
4
+
5
+ ### New Features
6
+
7
+ - Add `rel=noopener` to external links (thanks to @n00dle)
8
+
9
+ ## [1.0.1] - 2020-12-02
10
+
11
+ ### Changes
12
+
13
+ - Support cascading backends by default
14
+
15
+ ## [1.0.0] - 2020-03-27
16
+
17
+ ### Changes
18
+
19
+ - **(Breaking)** Drop explicit support for Ruby versions below 2.6
20
+
21
+ ### Bug Fixes
22
+
23
+ - Properly support translations using I18n::Pluralization backend (thanks to @jhanggi)
24
+
25
+ ## [0.7.2] - 2019-07-06
26
+
27
+ ### Bug Fixes
28
+
29
+ - Improve orphaned text matcher targeting
30
+
31
+ ## [0.7.1] - 2019-07-05
32
+
33
+ ### Bug Fixes
34
+
35
+ - Prevent unnecessary non-breaking spaces in generated HTML
36
+
37
+ ### Changes
38
+
39
+ - Improve `NotImplementedError` messaging (thanks to @stephen-puiszis)
40
+ - Update README with spec setup instructions (thanks to @jhanggi)
41
+
42
+ ## [0.7.0] - 2016-05-06
43
+
44
+ ### New features
45
+
46
+ - Automatically load entire locale directory via Railtie
47
+
48
+ ## [0.6.1] - 2015-10-01
49
+
50
+ ### Changes
51
+
52
+ - Bump version requirement for Redcarpet gem to address memory leaks
53
+
54
+ ## [0.6.0] - 2015-06-15
55
+
56
+ ### New Features
57
+
58
+ - Apply `target=_blank` attribute to anchor tags pointed at external URLs
59
+
60
+ ## [0.5.3] - 2015-02-25
61
+
62
+ ### Changes
63
+
64
+ - Update spec helpers for compatibility with RSpec 3 (thanks to @gabrielg)
65
+
66
+ ## [0.5.2] - 2015-02-03
67
+
68
+ ### Changes
69
+
70
+ - Support cascading backends for interpolated keys (thanks to @gabrielg)
71
+
72
+ ## [0.5.1] - 2015-01-23
73
+
74
+ ### New Features
75
+
76
+ - Add RSpec helpers (thanks to @gabrielg)
77
+
78
+ [1.1.0]: https://github.com/ahorner/text-helpers/compare/v1.0.1...v1.1.0
79
+ [1.0.1]: https://github.com/ahorner/text-helpers/compare/v1.0.0...v1.0.1
80
+ [1.0.0]: https://github.com/ahorner/text-helpers/compare/v0.7.2...v1.0.0
81
+ [0.7.2]: https://github.com/ahorner/text-helpers/compare/v0.7.1...v0.7.2
82
+ [0.7.1]: https://github.com/ahorner/text-helpers/compare/v0.7.0...v0.7.1
83
+ [0.7.0]: https://github.com/ahorner/text-helpers/compare/v0.6.1...v0.7.0
84
+ [0.6.1]: https://github.com/ahorner/text-helpers/compare/v0.6.0...v0.6.1
85
+ [0.6.0]: https://github.com/ahorner/text-helpers/compare/v0.5.3...v0.6.0
86
+ [0.5.3]: https://github.com/ahorner/text-helpers/compare/v0.5.2...v0.5.3
87
+ [0.5.2]: https://github.com/ahorner/text-helpers/compare/v0.5.1...v0.5.2
88
+ [0.5.1]: https://github.com/ahorner/text-helpers/compare/v0.5.0...v0.5.1
@@ -12,7 +12,7 @@ module TextHelpers
12
12
  attributes = [
13
13
  ("href=\"#{link}\"" if link),
14
14
  ("title=\"#{title}\"" if title),
15
- ("target=\"_blank\"" if link =~ PROTOCOL_MATCHER),
15
+ ("target=\"_blank\" rel=\"noopener\"" if link.match?(PROTOCOL_MATCHER)),
16
16
  ]
17
17
 
18
18
  "<a #{attributes.compact.join(" ")}>#{content}</a>"
@@ -44,7 +44,7 @@ module TextHelpers
44
44
  interpolation_options = { cascade: true }.merge(options)
45
45
 
46
46
  # Interpolate any keypaths (e.g., `!some.lookup.path/key!`) found in the text.
47
- while text =~ KEYPATH_MATCHER do
47
+ while text.match?(KEYPATH_MATCHER) do
48
48
  text = text.gsub(KEYPATH_MATCHER) { |match| I18n.t($1, **interpolation_options) }
49
49
  end
50
50
 
@@ -1,3 +1,3 @@
1
1
  module TextHelpers
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -119,12 +119,12 @@ describe TextHelpers::Translation do
119
119
  assert_equal "<em>#{@scoped_text}</em>\n", @helper.html(:test_key, inline: true, orphans: true)
120
120
  end
121
121
 
122
- it "renders internal links without a target" do
122
+ it "renders internal links without a target or rel" do
123
123
  assert_equal "<a href=\"/internal/path\">Internal&nbsp;link</a>\n", @helper.html(:internal_link, inline: true)
124
124
  end
125
125
 
126
- it "renders external links with target='_blank'" do
127
- assert_equal "<a href=\"http://external.com\" target=\"_blank\">External&nbsp;link</a>\n", @helper.html(:external_link, inline: true)
126
+ it "renders external links with target='_blank' and rel='noopener'" do
127
+ assert_equal "<a href=\"http://external.com\" target=\"_blank\" rel=\"noopener\">External&nbsp;link</a>\n", @helper.html(:external_link, inline: true)
128
128
  end
129
129
 
130
130
  it "interpolates values wrapped in !!" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: text_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Horner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-03 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -89,6 +89,7 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
91
  - ".travis.yml"
92
+ - CHANGELOG.md
92
93
  - Gemfile
93
94
  - LICENSE
94
95
  - README.md