typeout 1.4.3 → 1.4.4

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.
Files changed (2) hide show
  1. data/lib/typeout.rb +10 -4
  2. metadata +4 -4
data/lib/typeout.rb CHANGED
@@ -5,11 +5,13 @@ class Typeout < String
5
5
 
6
6
  include ERB::Util
7
7
 
8
- def self.convert(text)
9
- self.new(text.to_s).to_html
8
+ def self.convert(text, sanitize = true)
9
+ self.new(text.to_s).to_html(sanitize)
10
10
  end
11
11
 
12
- def to_html
12
+ def to_html(sanitize = true)
13
+ @sanitize = sanitize
14
+
13
15
  text = self.dup
14
16
 
15
17
  text = clean_whitespace text
@@ -37,7 +39,11 @@ class Typeout < String
37
39
  end
38
40
 
39
41
  def sanitize_html(text)
40
- Sanitize.clean(text, Sanitize::Config::RELAXED)
42
+ if @sanitize
43
+ Sanitize.clean(text, Sanitize::Config::RELAXED)
44
+ else
45
+ text
46
+ end
41
47
  end
42
48
 
43
49
  def clean_whitespace(text)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typeout
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 3
10
- version: 1.4.3
9
+ - 4
10
+ version: 1.4.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Connor McKay
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-18 00:00:00 -06:00
18
+ date: 2011-01-29 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency