rel_nofollow 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 +4 -4
- data/README.md +4 -8
- data/lib/rel_nofollow/string.rb +5 -3
- data/lib/rel_nofollow/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6bdae77508634155873cbb09dbb0c59d6ba2764
|
4
|
+
data.tar.gz: 9a35b96e86f0aa6d736f14bbd1d487ba0521c942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5dc1a99f1030031ac22bd28be5264b8c2e33193aeac47064ff8a7cb688222c4470a7d1b342c4fb12f7399c5c855f0d8d70d56e9a176fee589b907ec4d253555
|
7
|
+
data.tar.gz: a7cf5421fa6305ac12e54486d47b8963401bc914f6856cb3bd1ddf084f5d11da93828fddd7add4b0c9d077021a3370f6dc3ccf4941504837abb8feea24ae3c09
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# RelNofollow
|
2
2
|
|
3
|
-
|
3
|
+
Add rel="nofollow" to all link in a string
|
4
4
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
|
@@ -22,17 +21,14 @@ Or install it yourself as:
|
|
22
21
|
|
23
22
|
## Usage
|
24
23
|
|
25
|
-
|
24
|
+
simply call
|
26
25
|
|
27
|
-
|
26
|
+
string.add_nofollow
|
28
27
|
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
28
|
|
33
29
|
## Contributing
|
34
30
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lmajowka/rel_nofollow. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
36
32
|
|
37
33
|
|
38
34
|
## License
|
data/lib/rel_nofollow/string.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
class String
|
2
2
|
def add_nofollow
|
3
|
-
self.
|
4
|
-
|
5
|
-
|
3
|
+
self.gsub(/<a [^>]+>/) do |link|
|
4
|
+
unless aref.include?('rel="nofollow"')
|
5
|
+
link = link[0..-2] + ' rel="nofollow">'
|
6
|
+
end
|
7
|
+
link
|
6
8
|
end
|
7
9
|
end
|
8
10
|
end
|
data/lib/rel_nofollow/version.rb
CHANGED