bbcoder 0.1.2 → 0.1.3

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.1)
4
+ bbcoder (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/lib/bbcoder/tag.rb CHANGED
@@ -8,7 +8,7 @@ class BBCoder
8
8
  end
9
9
 
10
10
  def to_html(meta, content)
11
- return self.class.reform(name, meta, content) unless content_valid?(content)
11
+ return self.class.reform(name, meta, content, true) unless content_valid?(content)
12
12
 
13
13
 
14
14
  if options[:block].nil?
@@ -23,6 +23,7 @@ class BBCoder
23
23
  end
24
24
 
25
25
  def content_valid?(content)
26
+ return false if content.nil?
26
27
  return true if options[:match].nil?
27
28
 
28
29
  return !content.match(options[:match]).nil?
@@ -37,8 +38,8 @@ class BBCoder
37
38
  BBCoder.configuration[tag].to_html(meta, content)
38
39
  end
39
40
 
40
- def reform(tag, meta, content = nil)
41
- if content.nil?
41
+ def reform(tag, meta, content = nil, force_end = false)
42
+ if content.nil? && !force_end
42
43
  %(#{reform_open(tag, meta)})
43
44
  else
44
45
  %(#{reform_open(tag, meta)}#{content}#{reform_end(tag)})
@@ -1,3 +1,3 @@
1
1
  class BBCoder
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/spec/bbcoder_spec.rb CHANGED
@@ -28,6 +28,10 @@ describe BBCoder do
28
28
  EOS
29
29
  string.bbcode_to_html.should == result
30
30
  end
31
+
32
+ it "should return tags as text on blank content" do
33
+ '[img][/img]'.bbcode_to_html.should == '[img][/img]'
34
+ end
31
35
  end
32
36
 
33
37
  context "with properly formatted input" do
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.2
4
+ version: 0.1.3
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-09 00:00:00.000000000 -04:00
12
+ date: 2011-07-21 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: &22760480 !ruby/object:Gem::Requirement
17
+ requirement: &15548820 !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: *22760480
25
+ version_requirements: *15548820
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rr
28
- requirement: &22760060 !ruby/object:Gem::Requirement
28
+ requirement: &15548280 !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: *22760060
36
+ version_requirements: *15548280
37
37
  description: A gem for parsing bbcode that doesn't rely on regular expressions
38
38
  email:
39
39
  - machinist@asceth.com