string_master 0.3.12 → 0.3.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/string_master/string_master.rb +5 -1
- data/spec/lib/string_master/string_master_spec.rb +6 -0
- data/string_master.gemspec +10 -10
- 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: 0ddc96955a4fbb5d2f038d2169fcd6527ebc9ade
|
4
|
+
data.tar.gz: 268f5e7db463abf408eb47c555fc74c32a04839b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 736856a5fd9f19796f0ab76d14d8528b45a20340b5e0838daaf15e4819f4129aa379d432a8004d7081a2209a1124b73b56db651f8fa566da5f710e88502c5f66
|
7
|
+
data.tar.gz: 6ccfda23f78dc34d737132b4f64b1709c5a6e2cc44f9d1dc40bf5ac49896a04f146f2fcdefca28efc389a31695b30fe95cb5d6cf15a2d80e5f496e16cee4955b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.13
|
@@ -33,13 +33,17 @@ class StringMaster
|
|
33
33
|
def html_escape(options={})
|
34
34
|
except = options[:except] || %w()
|
35
35
|
close_tags
|
36
|
-
|
36
|
+
puts "---------"
|
37
|
+
p @modified_string
|
38
|
+
@modified_string.gsub!(/<\/?([^<]*?)(\s[^>]*?)?>/) do |tag|
|
37
39
|
if except.include?($1)
|
40
|
+
puts "#{$1} exception! - matches one of #{except}"
|
38
41
|
# sanitize attributes
|
39
42
|
tag.gsub(/\s(.+?)=('|").*?\2(?=.*?>)/) do |a|
|
40
43
|
["href", "src", "lang"].include?($1) ? a : ""
|
41
44
|
end
|
42
45
|
else
|
46
|
+
puts "#{$1} - sanitizing!"
|
43
47
|
h(tag)
|
44
48
|
end
|
45
49
|
end
|
@@ -16,6 +16,12 @@ describe StringMaster do
|
|
16
16
|
parser.html_escape(:except => %w(a)).to_s.should == '<a href="http://google.com">hello</a> <b>world</b>'
|
17
17
|
parser = StringMaster.new('<a href="https://google.com">hello</a> <b>world</b>')
|
18
18
|
parser.html_escape(:except => %w(a)).to_s.should == '<a href="https://google.com">hello</a> <b>world</b>'
|
19
|
+
|
20
|
+
parser = StringMaster.new('xsstest<input/onfocus=prompt(document.cookie) autofocus>')
|
21
|
+
parser.html_escape.to_s.should == 'xsstest<input/onfocus=prompt(document.cookie) autofocus>'
|
22
|
+
|
23
|
+
parser = StringMaster.new('xsstest<input/onfocus=prompt(document.cookie)autofocus>')
|
24
|
+
parser.html_escape.to_s.should == 'xsstest<input/onfocus=prompt(document.cookie)autofocus>'
|
19
25
|
end
|
20
26
|
|
21
27
|
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.13 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.13"
|
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 = "
|
14
|
+
s.date = "2017-04-20"
|
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 = [
|
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
]
|
39
39
|
s.homepage = "http://github.com/snitko/string_master"
|
40
40
|
s.licenses = ["MIT"]
|
41
|
-
s.rubygems_version = "2.
|
41
|
+
s.rubygems_version = "2.5.1"
|
42
42
|
s.summary = "Most common string manipulations for a webapp"
|
43
43
|
|
44
44
|
if s.respond_to? :specification_version then
|
@@ -46,19 +46,19 @@ Gem::Specification.new do |s|
|
|
46
46
|
|
47
47
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
48
|
s.add_runtime_dependency(%q<actionpack>, [">= 0"])
|
49
|
-
s.add_development_dependency(%q<bundler>, ["
|
50
|
-
s.add_development_dependency(%q<jeweler>, ["
|
49
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
50
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.3.4"])
|
51
51
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
52
52
|
else
|
53
53
|
s.add_dependency(%q<actionpack>, [">= 0"])
|
54
|
-
s.add_dependency(%q<bundler>, ["
|
55
|
-
s.add_dependency(%q<jeweler>, ["
|
54
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
55
|
+
s.add_dependency(%q<jeweler>, ["~> 2.3.4"])
|
56
56
|
s.add_dependency(%q<rspec>, [">= 0"])
|
57
57
|
end
|
58
58
|
else
|
59
59
|
s.add_dependency(%q<actionpack>, [">= 0"])
|
60
|
-
s.add_dependency(%q<bundler>, ["
|
61
|
-
s.add_dependency(%q<jeweler>, ["
|
60
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
61
|
+
s.add_dependency(%q<jeweler>, ["~> 2.3.4"])
|
62
62
|
s.add_dependency(%q<rspec>, [">= 0"])
|
63
63
|
end
|
64
64
|
end
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Snitko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|