bbcoder 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/bbcoder/base.rb +1 -1
- data/lib/bbcoder/buffer_tags.rb +3 -2
- data/lib/bbcoder/version.rb +1 -1
- data/spec/bbcoder_spec.rb +14 -0
- metadata +7 -9
data/Gemfile.lock
CHANGED
data/lib/bbcoder/base.rb
CHANGED
data/lib/bbcoder/buffer_tags.rb
CHANGED
@@ -11,9 +11,9 @@ class BBCoder
|
|
11
11
|
def push(tag)
|
12
12
|
tag, meta = if tag.include?("=")
|
13
13
|
splits = tag.split("=")
|
14
|
-
[splits.shift.to_sym, splits.join]
|
14
|
+
[splits.shift.downcase.to_sym, splits.join('=')]
|
15
15
|
else
|
16
|
-
[tag.to_sym, nil]
|
16
|
+
[tag.downcase.to_sym, nil]
|
17
17
|
end
|
18
18
|
|
19
19
|
if criteria_met?(tag)
|
@@ -26,6 +26,7 @@ class BBCoder
|
|
26
26
|
|
27
27
|
# logic when popping specific tag
|
28
28
|
def pop(tag)
|
29
|
+
tag = tag.downcase.to_sym
|
29
30
|
if empty? || !include?(tag)
|
30
31
|
buffer.push("[/#{tag}]")
|
31
32
|
elsif last == tag
|
data/lib/bbcoder/version.rb
CHANGED
data/spec/bbcoder_spec.rb
CHANGED
@@ -58,6 +58,10 @@ EOS
|
|
58
58
|
it "should handle multiple nestings of b elements" do
|
59
59
|
"[b]Now I [b] am [b] extremely [b] bold![/b][/b][/b][/b]".bbcode_to_html.should == "<strong>Now I <strong> am <strong> extremely <strong> bold!</strong></strong></strong></strong>"
|
60
60
|
end
|
61
|
+
|
62
|
+
it "should not drop the equal sign in meta" do
|
63
|
+
"[url=http://example.com/?Foo=Bar]Link[/url]".bbcode_to_html.should == "<a href=\"http://example.com/?Foo=Bar\">Link</a>"
|
64
|
+
end
|
61
65
|
end
|
62
66
|
|
63
67
|
context "with incorrectly formatted input" do
|
@@ -89,5 +93,15 @@ EOS
|
|
89
93
|
"[p]Text and [/b] with a [p] and [quote='Hahah'] a [/p] care in sight oh [i=nometaforyou] my [/b].".bbcode_to_html.should == "[p]Text and [/b] with a <p> and [quote='Hahah'] a </p> care in sight oh [i=nometaforyou] my [/b]."
|
90
94
|
end
|
91
95
|
end
|
96
|
+
|
97
|
+
context "with case-insensitive input" do
|
98
|
+
it "should handle upper case tags" do
|
99
|
+
"[P]Text and now [B]nested.[/B][/P]".bbcode_to_html.should == "<p>Text and now <strong>nested.</strong></p>"
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should handle mixed upper and lower case tags" do
|
103
|
+
"[p]Text and now [B]nested.[/b][/P]".bbcode_to_html.should == "<p>Text and now <strong>nested.</strong></p>"
|
104
|
+
end
|
105
|
+
end
|
92
106
|
end
|
93
107
|
|
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.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-10-19 00:00:00.000000000Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rspec
|
17
|
-
requirement: &
|
16
|
+
requirement: &21553860 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ! '>='
|
@@ -22,10 +21,10 @@ dependencies:
|
|
22
21
|
version: '0'
|
23
22
|
type: :development
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *21553860
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
26
|
name: rr
|
28
|
-
requirement: &
|
27
|
+
requirement: &21553440 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
29
|
requirements:
|
31
30
|
- - ! '>='
|
@@ -33,7 +32,7 @@ dependencies:
|
|
33
32
|
version: '0'
|
34
33
|
type: :development
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
35
|
+
version_requirements: *21553440
|
37
36
|
description: A gem for parsing bbcode that doesn't rely on regular expressions
|
38
37
|
email:
|
39
38
|
- machinist@asceth.com
|
@@ -62,7 +61,6 @@ files:
|
|
62
61
|
- spec/buffer_spec.rb
|
63
62
|
- spec/buffer_tags_spec.rb
|
64
63
|
- spec/spec_helper.rb
|
65
|
-
has_rdoc: true
|
66
64
|
homepage: http://github.com/asceth/bbcoder
|
67
65
|
licenses: []
|
68
66
|
post_install_message:
|
@@ -83,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
81
|
version: '0'
|
84
82
|
requirements: []
|
85
83
|
rubyforge_project: bbcoder
|
86
|
-
rubygems_version: 1.
|
84
|
+
rubygems_version: 1.8.8
|
87
85
|
signing_key:
|
88
86
|
specification_version: 3
|
89
87
|
summary: BBCode parser
|