string_master 0.3.12 → 0.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbb2c262852624eb1084671025dcf196f3ddf143
4
- data.tar.gz: 46b91478574a81dc5ec53ef51a4a33334187cd82
3
+ metadata.gz: 0ddc96955a4fbb5d2f038d2169fcd6527ebc9ade
4
+ data.tar.gz: 268f5e7db463abf408eb47c555fc74c32a04839b
5
5
  SHA512:
6
- metadata.gz: 797839b723b19544d281b1969a95535d076dc86d78d3abded0fc3355387820fe3a2e33233ce11dded67b9070d4474c0bd7b3c5d2eb7904ac322f69482516e9ef
7
- data.tar.gz: 1b540de62175c407b36f1c197793f47f2e5610ef76e4f7fe79143f243869d8ec8e093a34afbc5df9d493158034750c1da2f0cf1a4f97abb3d2fcfc923d318423
6
+ metadata.gz: 736856a5fd9f19796f0ab76d14d8528b45a20340b5e0838daaf15e4819f4129aa379d432a8004d7081a2209a1124b73b56db651f8fa566da5f710e88502c5f66
7
+ data.tar.gz: 6ccfda23f78dc34d737132b4f64b1709c5a6e2cc44f9d1dc40bf5ac49896a04f146f2fcdefca28efc389a31695b30fe95cb5d6cf15a2d80e5f496e16cee4955b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.12
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
- @modified_string.gsub!(/<\/?([a-zA-Z0-9]*?)(\s[^>]*?)?>/) do |tag|
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> &lt;b&gt;world&lt;/b&gt;'
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> &lt;b&gt;world&lt;/b&gt;'
19
+
20
+ parser = StringMaster.new('xsstest<input/onfocus=prompt(document.cookie) autofocus>')
21
+ parser.html_escape.to_s.should == 'xsstest&lt;input/onfocus=prompt(document.cookie) autofocus&gt;'
22
+
23
+ parser = StringMaster.new('xsstest<input/onfocus=prompt(document.cookie)autofocus>')
24
+ parser.html_escape.to_s.should == 'xsstest&lt;input/onfocus=prompt(document.cookie)autofocus&gt;'
19
25
  end
20
26
 
21
27
  it "makes images of urls that end with .jpg and other image extensions" do
@@ -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.11 ruby lib
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.12"
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 = "2015-08-18"
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.4.5"
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>, [">= 0"])
50
- s.add_development_dependency(%q<jeweler>, [">= 0"])
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>, [">= 0"])
55
- s.add_dependency(%q<jeweler>, [">= 0"])
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>, [">= 0"])
61
- s.add_dependency(%q<jeweler>, [">= 0"])
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.12
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-03-05 00:00:00.000000000 Z
11
+ date: 2017-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack