string_master 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/string_master/string_master.rb +5 -3
- data/spec/lib/string_master/string_master_spec.rb +3 -1
- data/string_master.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9014d6e022669d3f53cd4390ace1e70c6583087b
|
4
|
+
data.tar.gz: 445a71c28808806e006dee990fead2da4411dd12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a7dd75b86a3c35b2fbd90897fdcdb8a064a6f1650402dc4461548e893fe0761b084bd4ca34f8f35134b5927040cf30ae116eec6455888d58b49944b94bfeee4
|
7
|
+
data.tar.gz: f8b2bd2821bb6d6e07c4fda1fbe0b49f841424a463574efa4d4d068212756d6708667096be65222ded25626d6ed961555b3a11944895356fa6350920e58d0c95
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.9
|
@@ -33,10 +33,12 @@ class StringMaster
|
|
33
33
|
def html_escape(options={})
|
34
34
|
except = options[:except] || %w()
|
35
35
|
close_tags
|
36
|
-
@modified_string.gsub!(/<\/?([a-zA-Z0-9]*?)(\s[^>]
|
36
|
+
@modified_string.gsub!(/<\/?([a-zA-Z0-9]*?)(\s[^>]*?)?>/) do |tag|
|
37
37
|
if except.include?($1)
|
38
|
-
#
|
39
|
-
|
38
|
+
# sanitize attributes
|
39
|
+
tag.gsub(/(\s.+?)=('|").*?\2(?=.*?>)/) do |a|
|
40
|
+
["href", "src", "lang"].include?($1) ? a : ""
|
41
|
+
end
|
40
42
|
else
|
41
43
|
h(tag)
|
42
44
|
end
|
@@ -9,7 +9,9 @@ describe StringMaster do
|
|
9
9
|
|
10
10
|
it "escapes html except for some of the allowed tags" do
|
11
11
|
parser = StringMaster.new('<img src="#" style="border: solid 1px green;"><b>Hello</b>')
|
12
|
-
parser.html_escape(:except => %w(img)).string.should == '<img
|
12
|
+
parser.html_escape(:except => %w(img)).string.should == '<img><b>Hello</b>'
|
13
|
+
parser = StringMaster.new('<i>hello</i> <b>world</b>')
|
14
|
+
parser.html_escape(:except => %w(b)).to_s.should == '<i>hello</i> <b>world</b>'
|
13
15
|
end
|
14
16
|
|
15
17
|
it "makes images of urls that end with .jpg and other image extensions" do
|
data/string_master.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: string_master 0.3.
|
5
|
+
# stub: string_master 0.3.9 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "string_master"
|
9
|
-
s.version = "0.3.
|
9
|
+
s.version = "0.3.9"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Roman Snitko"]
|
14
|
-
s.date = "2015-
|
14
|
+
s.date = "2015-08-13"
|
15
15
|
s.description = "Because every time I create a new webapp, I think about how I should process user-generated content. Should convert urls to links and images? Should I allow certain tags? Should I convert all new lines to *br* tags? Well, now all that is as simple as calling a single method."
|
16
16
|
s.email = "roman.snitko@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: string_master
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Snitko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|