string_master 0.3.4 → 0.3.5

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.5
@@ -104,13 +104,15 @@ class StringMaster
104
104
  def wrap_lines(tag, regexp)
105
105
  code_open = false; result = ""
106
106
  @modified_string.each_line do |line|
107
- if line =~ /\A\s{4}/
107
+ if line =~ regexp
108
108
  result += "<#{tag}>" unless code_open
109
109
  code_open = true
110
110
  result += line.sub(regexp, '')
111
111
  else
112
- result.chomp!
113
- result += "</#{tag}>\n" if code_open
112
+ if code_open
113
+ result.chomp!
114
+ result += "</#{tag}>\n"
115
+ end
114
116
  code_open = false
115
117
  result += line
116
118
  end
@@ -91,4 +91,9 @@ WRAPPED_CODE
91
91
  "<img src=\"http://images.com/image.jpg\" alt=\"\" /> <b>Hello <a href=\"http://url.com\" target=\"_blank\">http://url.com</a> </b>"
92
92
  end
93
93
 
94
+ it "replaces newline characters with <br/> tags" do
95
+ parser = StringMaster.new("This is quite a\n long text")
96
+ parser.wrap_code.newlines_to_br.to_s.should == "This is quite a<br/> long text"
97
+ end
98
+
94
99
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "string_master"
8
- s.version = "0.3.4"
8
+ s.version = "0.3.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Roman Snitko"]
12
- s.date = "2012-05-30"
12
+ s.date = "2012-05-31"
13
13
  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."
14
14
  s.email = "roman.snitko@gmail.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string_master
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-30 00:00:00.000000000 Z
12
+ date: 2012-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -133,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  segments:
135
135
  - 0
136
- hash: 450096338606050278
136
+ hash: -380418558032014970
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements: