bbcoder 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bbcoder (0.1.0)
4
+ bbcoder (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/lib/bbcoder/tag.rb CHANGED
@@ -15,8 +15,8 @@ class BBCoder
15
15
  "<#{options[:as]}>#{content}</#{options[:as]}>"
16
16
  else
17
17
  options[:block].binding.eval <<-EOS
18
- @meta = %Q{#{meta}}
19
- @content = %Q{#{content}}
18
+ @meta = %Q{#{Regexp.escape(meta.to_s)}}
19
+ @content = %Q{#{Regexp.escape(content.to_s)}}
20
20
  EOS
21
21
  options[:block].call
22
22
  end
@@ -1,3 +1,3 @@
1
1
  class BBCoder
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/spec/bbcoder_spec.rb CHANGED
@@ -2,6 +2,34 @@ require 'spec_helper'
2
2
 
3
3
  describe BBCoder do
4
4
 
5
+ context "with dirty input" do
6
+ it "should parse content with \" in it" do
7
+ '[p]Text phrase: "going away"[/p]'.bbcode_to_html.should == '<p>Text phrase: "going away"</p>'
8
+ end
9
+
10
+ it "should parse content with { in it" do
11
+ '[p]OMG :-{[/p]'.bbcode_to_html.should == '<p>OMG :-{</p>'
12
+ end
13
+
14
+ it "should parse content with } in it" do
15
+ '[p]OMG :-}[/p]'.bbcode_to_html.should == '<p>OMG :-}</p>'
16
+ end
17
+
18
+ it "should parse content with } in it round 2" do
19
+ string = "[quote=weedman]YES I STICKY IT ALL oF YOU WHO DON'T LIKE it SEND YOUR HATE HERE\n\nhttp://www.gamesyn.com/plugin.php?plugin=PrivateMessages&file=message_send.php&id=20&tid=1583\n\n:} have a good day[/quote]"
20
+
21
+ result = <<-EOS
22
+ <fieldset>
23
+ <legend>weedman says</legend>
24
+ <blockquote>
25
+ YES I STICKY IT ALL oF YOU WHO DON\'T LIKE it SEND YOUR HATE HERE\n\nhttp://www.gamesyn.com/plugin.php?plugin=PrivateMessages&file=message_send.php&id=20&tid=1583\n\n:} have a good day
26
+ </blockquote>
27
+ </fieldset>
28
+ EOS
29
+ string.bbcode_to_html.should == result
30
+ end
31
+ end
32
+
5
33
  context "with properly formatted input" do
6
34
  it "should parse paragraph statements" do
7
35
  "[p]Text and now [p]nested.[/p][/p]".bbcode_to_html.should == "<p>Text and now <p>nested.</p></p>"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbcoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-08 00:00:00.000000000 -04:00
12
+ date: 2011-07-09 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
- requirement: &12454740 !ruby/object:Gem::Requirement
17
+ requirement: &22760480 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *12454740
25
+ version_requirements: *22760480
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rr
28
- requirement: &12454320 !ruby/object:Gem::Requirement
28
+ requirement: &22760060 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *12454320
36
+ version_requirements: *22760060
37
37
  description: A gem for parsing bbcode that doesn't rely on regular expressions
38
38
  email:
39
39
  - machinist@asceth.com