cbot-bbcodeizer 0.2.0
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/.gitignore +4 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README +128 -0
- data/Rakefile +22 -0
- data/bbcodeizer.gemspec +23 -0
- data/init.rb +4 -0
- data/lib/bbcodeizer.rb +171 -0
- data/lib/bbcodeizer/version.rb +3 -0
- data/lib/bbcodeizer_helper.rb +8 -0
- data/rdoc/BBCodeizeHelper.html +182 -0
- data/rdoc/Bbcodeizer.html +146 -0
- data/rdoc/README.html +214 -0
- data/rdoc/created.rid +5 -0
- data/rdoc/images/brick.png +0 -0
- data/rdoc/images/brick_link.png +0 -0
- data/rdoc/images/bug.png +0 -0
- data/rdoc/images/bullet_black.png +0 -0
- data/rdoc/images/bullet_toggle_minus.png +0 -0
- data/rdoc/images/bullet_toggle_plus.png +0 -0
- data/rdoc/images/date.png +0 -0
- data/rdoc/images/find.png +0 -0
- data/rdoc/images/loadingAnimation.gif +0 -0
- data/rdoc/images/macFFBgHack.png +0 -0
- data/rdoc/images/package.png +0 -0
- data/rdoc/images/page_green.png +0 -0
- data/rdoc/images/page_white_text.png +0 -0
- data/rdoc/images/page_white_width.png +0 -0
- data/rdoc/images/plugin.png +0 -0
- data/rdoc/images/ruby.png +0 -0
- data/rdoc/images/tag_green.png +0 -0
- data/rdoc/images/wrench.png +0 -0
- data/rdoc/images/wrench_orange.png +0 -0
- data/rdoc/images/zoom.png +0 -0
- data/rdoc/index.html +60 -0
- data/rdoc/js/darkfish.js +116 -0
- data/rdoc/js/jquery.js +32 -0
- data/rdoc/js/quicksearch.js +114 -0
- data/rdoc/js/thickbox-compressed.js +10 -0
- data/rdoc/lib/bbcodeize_helper_rb.html +54 -0
- data/rdoc/lib/bbcodeizer/version_rb.html +52 -0
- data/rdoc/lib/bbcodeizer_helper_rb.html +54 -0
- data/rdoc/lib/bbcodeizer_rb.html +52 -0
- data/rdoc/rdoc.css +763 -0
- data/test/bbcodeizer_test.rb +145 -0
- metadata +125 -0
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'bbcodeizer_helper'
|
3
|
+
|
4
|
+
class BbcodeizerTest < Test::Unit::TestCase
|
5
|
+
include BBCodeizeHelper
|
6
|
+
|
7
|
+
def test_quote_with_cite
|
8
|
+
assert_equal(
|
9
|
+
"<blockquote><p><cite>\"JD\" wrote:</cite></p>\nBBCode is great!\n</blockquote>",
|
10
|
+
bbcodeize("[quote=\"JD\"]\nBBCode is great!\n[/quote]"))
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_quote_sans_cite
|
14
|
+
assert_equal(
|
15
|
+
"<blockquote>\nBBCode is great!\n</blockquote>",
|
16
|
+
bbcodeize("[quote]\nBBCode is great!\n[/quote]"))
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_nested_quote_sans_cite
|
20
|
+
assert_equal(
|
21
|
+
"<blockquote>\n<blockquote>\nBBCode is great!</blockquote>\nYes it is!\n</blockquote>",
|
22
|
+
bbcodeize("[quote]\n[quote]\nBBCode is great![/quote]\nYes it is!\n[/quote]"))
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_code
|
26
|
+
assert_equal(
|
27
|
+
"<pre><code>\ncode goes here\n</code></pre>",
|
28
|
+
bbcodeize("[code]\ncode goes here\n[/code]"))
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_bold
|
32
|
+
assert_equal(
|
33
|
+
"I am <strong>really</strong> happy!",
|
34
|
+
bbcodeize("I am [b]really[/b] happy!"))
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_italic
|
38
|
+
assert_equal(
|
39
|
+
"Have you read <em>Catcher in the Rye</em>?",
|
40
|
+
bbcodeize("Have you read [i]Catcher in the Rye[/i]?"))
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_underline
|
44
|
+
assert_equal(
|
45
|
+
"<u>Please note</u>:",
|
46
|
+
bbcodeize("[u]Please note[/u]:"))
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_email_with_name
|
50
|
+
assert_equal(
|
51
|
+
"You can also <a href=\"mailto:jd@example.com\">contact me by e-mail</a>.",
|
52
|
+
bbcodeize("You can also [email=jd@example.com]contact me by e-mail[/email]."))
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_email_sans_name
|
56
|
+
assert_equal(
|
57
|
+
"My email address is <a href=\"mailto:jd@example.com\">jd@example.com</a>",
|
58
|
+
bbcodeize("My email address is [email]jd@example.com[/email]"))
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_url_with_title
|
62
|
+
assert_equal(
|
63
|
+
"Check out <a href=\"http://www.rubyonrails.com\" target=\"_blank\">Ruby on Rails</a>!",
|
64
|
+
bbcodeize("Check out [url=http://www.rubyonrails.com]Ruby on Rails[/url]!"))
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_url_sans_title
|
68
|
+
assert_equal(
|
69
|
+
"My homepage is <a href=\"http://www.example.com\" target=\"_blank\">http://www.example.com</a>.",
|
70
|
+
bbcodeize("My homepage is [url]http://www.example.com[/url]."))
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_auto_link
|
74
|
+
assert_equal(
|
75
|
+
"Check out this site: <a href=\"http://google.com\" target=\"_blank\">http://google.com</a>",
|
76
|
+
bbcodeize("Check out this site: http://google.com"))
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_auto_link_nested
|
80
|
+
assert_equal(
|
81
|
+
"<b><a href=\"http://google.com\" target=\"_blank\">http://google.com</a></b>",
|
82
|
+
bbcodeize("<b>http://google.com</b>"))
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_image
|
86
|
+
assert_equal(
|
87
|
+
"<img src=\"http://example.com/example.gif\" alt=\"http://example.com/example.gif\" />",
|
88
|
+
bbcodeize("[img]http://example.com/example.gif[/img]"))
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_uneven_quotes
|
92
|
+
assert_equal(
|
93
|
+
"[quote]A[quote]B[/quote]C[quote]D[/quote]",
|
94
|
+
bbcodeize("[quote]A[quote]B[/quote]C[quote]D[/quote]"))
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_even_nesting
|
98
|
+
assert_equal(
|
99
|
+
"<u><strong>Very important!</strong></u>",
|
100
|
+
bbcodeize("[u][b]Very important![/b][/u]"))
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_uneven_nesting
|
104
|
+
assert_equal(
|
105
|
+
"<u><strong>Very</u> important!</strong>",
|
106
|
+
bbcodeize("[u][b]Very[/u] important![/b]"))
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_size
|
110
|
+
assert_equal(
|
111
|
+
"<span style=\"font-size: 32px\">Big Text</span>",
|
112
|
+
bbcodeize("[size=32]Big Text[/size]"))
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_color
|
116
|
+
assert_equal(
|
117
|
+
"<span style=\"color: red\">Red Text</span>",
|
118
|
+
bbcodeize("[color=red]Red Text[/color]"))
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_disable
|
122
|
+
assert_equal(
|
123
|
+
"I am [b]really[/b] happy!",
|
124
|
+
bbcodeize("I am [b]really[/b] happy!", :disabled => [ :bold ]))
|
125
|
+
assert_equal(
|
126
|
+
"I am <strong>really</strong> happy!",
|
127
|
+
bbcodeize("I am [b]really[/b] happy!", :disabled => [ :video ]))
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_deactivation
|
131
|
+
BBCodeizer.deactivate(:bold)
|
132
|
+
assert_equal(
|
133
|
+
"I am [b]really[/b] happy!",
|
134
|
+
bbcodeize("I am [b]really[/b] happy!"))
|
135
|
+
BBCodeizer.activate(:bold) # for future tests
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_activation
|
139
|
+
BBCodeizer.deactivate(:bold)
|
140
|
+
BBCodeizer.activate(:bold)
|
141
|
+
assert_equal(
|
142
|
+
"I am <strong>really</strong> happy!",
|
143
|
+
bbcodeize("I am [b]really[/b] happy!"))
|
144
|
+
end
|
145
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cbot-bbcodeizer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jonathan Dance
|
9
|
+
- Luke Curley
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-12-20 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: rdoc
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
description:
|
48
|
+
email:
|
49
|
+
- jd+bbcodeizer@wuputah.com
|
50
|
+
- luke@box.net
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- Gemfile
|
57
|
+
- LICENSE
|
58
|
+
- README
|
59
|
+
- Rakefile
|
60
|
+
- bbcodeizer.gemspec
|
61
|
+
- init.rb
|
62
|
+
- lib/bbcodeizer.rb
|
63
|
+
- lib/bbcodeizer/version.rb
|
64
|
+
- lib/bbcodeizer_helper.rb
|
65
|
+
- rdoc/BBCodeizeHelper.html
|
66
|
+
- rdoc/Bbcodeizer.html
|
67
|
+
- rdoc/README.html
|
68
|
+
- rdoc/created.rid
|
69
|
+
- rdoc/images/brick.png
|
70
|
+
- rdoc/images/brick_link.png
|
71
|
+
- rdoc/images/bug.png
|
72
|
+
- rdoc/images/bullet_black.png
|
73
|
+
- rdoc/images/bullet_toggle_minus.png
|
74
|
+
- rdoc/images/bullet_toggle_plus.png
|
75
|
+
- rdoc/images/date.png
|
76
|
+
- rdoc/images/find.png
|
77
|
+
- rdoc/images/loadingAnimation.gif
|
78
|
+
- rdoc/images/macFFBgHack.png
|
79
|
+
- rdoc/images/package.png
|
80
|
+
- rdoc/images/page_green.png
|
81
|
+
- rdoc/images/page_white_text.png
|
82
|
+
- rdoc/images/page_white_width.png
|
83
|
+
- rdoc/images/plugin.png
|
84
|
+
- rdoc/images/ruby.png
|
85
|
+
- rdoc/images/tag_green.png
|
86
|
+
- rdoc/images/wrench.png
|
87
|
+
- rdoc/images/wrench_orange.png
|
88
|
+
- rdoc/images/zoom.png
|
89
|
+
- rdoc/index.html
|
90
|
+
- rdoc/js/darkfish.js
|
91
|
+
- rdoc/js/jquery.js
|
92
|
+
- rdoc/js/quicksearch.js
|
93
|
+
- rdoc/js/thickbox-compressed.js
|
94
|
+
- rdoc/lib/bbcodeize_helper_rb.html
|
95
|
+
- rdoc/lib/bbcodeizer/version_rb.html
|
96
|
+
- rdoc/lib/bbcodeizer_helper_rb.html
|
97
|
+
- rdoc/lib/bbcodeizer_rb.html
|
98
|
+
- rdoc/rdoc.css
|
99
|
+
- test/bbcodeizer_test.rb
|
100
|
+
homepage: https://github.com/qpingu/bbcodeizer
|
101
|
+
licenses: []
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project: bbcodeizer
|
120
|
+
rubygems_version: 1.8.23
|
121
|
+
signing_key:
|
122
|
+
specification_version: 3
|
123
|
+
summary: BBCodeizer is a simple gem that translates BBCode to HTML
|
124
|
+
test_files:
|
125
|
+
- test/bbcodeizer_test.rb
|