bbcodeizer 0.0.1
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 +20 -0
- data/README +128 -0
- data/Rakefile +22 -0
- data/bbcodeizer.gemspec +23 -0
- data/init.rb +4 -0
- data/lib/bbcodeize_helper.rb +8 -0
- data/lib/bbcodeizer/version.rb +3 -0
- data/lib/bbcodeizer.rb +77 -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_rb.html +52 -0
- data/rdoc/rdoc.css +763 -0
- data/test/bbcodeizer_test.rb +108 -0
- metadata +123 -0
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'bbcodeize_helper'
|
3
|
+
|
4
|
+
class BbcodeizerTest < Test::Unit::TestCase
|
5
|
+
include BBCodeizeHelper
|
6
|
+
|
7
|
+
def test_quote_with_cite
|
8
|
+
assert_equal(
|
9
|
+
"<blockquote><cite>JD wrote:</cite><br />\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>\ncode goes here\n</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\">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\">http://www.example.com</a>.",
|
70
|
+
bbcodeize("My homepage is [url]http://www.example.com[/url]."))
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_image
|
74
|
+
assert_equal(
|
75
|
+
"<img src=\"http://example.com/example.gif\" />",
|
76
|
+
bbcodeize("[img]http://example.com/example.gif[/img]"))
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_uneven_quotes
|
80
|
+
assert_equal(
|
81
|
+
"[quote]A[quote]B[/quote]C[quote]D[/quote]",
|
82
|
+
bbcodeize("[quote]A[quote]B[/quote]C[quote]D[/quote]"))
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_even_nesting
|
86
|
+
assert_equal(
|
87
|
+
"<u><strong>Very important!</strong></u>",
|
88
|
+
bbcodeize("[u][b]Very important![/b][/u]"))
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_uneven_nesting
|
92
|
+
assert_equal(
|
93
|
+
"<u><strong>Very</u> important!</strong>",
|
94
|
+
bbcodeize("[u][b]Very[/u] important![/b]"))
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_size
|
98
|
+
assert_equal(
|
99
|
+
"<span style=\"font-size: 32px\">Big Text</span>",
|
100
|
+
bbcodeize("[size=32]Big Text[/size]"))
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_color
|
104
|
+
assert_equal(
|
105
|
+
"<span style=\"color: red\">Red Text</span>",
|
106
|
+
bbcodeize("[color=red]Red Text[/color]"))
|
107
|
+
end
|
108
|
+
end
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bbcodeizer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jonathan Dance
|
9
|
+
- Luke Curley
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
|
14
|
+
date: 2011-09-11 00:00:00 -07:00
|
15
|
+
default_executable:
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: rake
|
19
|
+
prerelease: false
|
20
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
none: false
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: "0"
|
26
|
+
type: :development
|
27
|
+
version_requirements: *id001
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rdoc
|
30
|
+
prerelease: false
|
31
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
32
|
+
none: false
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: "0"
|
37
|
+
type: :development
|
38
|
+
version_requirements: *id002
|
39
|
+
description:
|
40
|
+
email:
|
41
|
+
- jd+bbcodeizer@wuputah.com
|
42
|
+
- luke@box.net
|
43
|
+
executables: []
|
44
|
+
|
45
|
+
extensions: []
|
46
|
+
|
47
|
+
extra_rdoc_files: []
|
48
|
+
|
49
|
+
files:
|
50
|
+
- .gitignore
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE
|
53
|
+
- README
|
54
|
+
- Rakefile
|
55
|
+
- bbcodeizer.gemspec
|
56
|
+
- init.rb
|
57
|
+
- lib/bbcodeize_helper.rb
|
58
|
+
- lib/bbcodeizer.rb
|
59
|
+
- lib/bbcodeizer/version.rb
|
60
|
+
- rdoc/BBCodeizeHelper.html
|
61
|
+
- rdoc/Bbcodeizer.html
|
62
|
+
- rdoc/README.html
|
63
|
+
- rdoc/created.rid
|
64
|
+
- rdoc/images/brick.png
|
65
|
+
- rdoc/images/brick_link.png
|
66
|
+
- rdoc/images/bug.png
|
67
|
+
- rdoc/images/bullet_black.png
|
68
|
+
- rdoc/images/bullet_toggle_minus.png
|
69
|
+
- rdoc/images/bullet_toggle_plus.png
|
70
|
+
- rdoc/images/date.png
|
71
|
+
- rdoc/images/find.png
|
72
|
+
- rdoc/images/loadingAnimation.gif
|
73
|
+
- rdoc/images/macFFBgHack.png
|
74
|
+
- rdoc/images/package.png
|
75
|
+
- rdoc/images/page_green.png
|
76
|
+
- rdoc/images/page_white_text.png
|
77
|
+
- rdoc/images/page_white_width.png
|
78
|
+
- rdoc/images/plugin.png
|
79
|
+
- rdoc/images/ruby.png
|
80
|
+
- rdoc/images/tag_green.png
|
81
|
+
- rdoc/images/wrench.png
|
82
|
+
- rdoc/images/wrench_orange.png
|
83
|
+
- rdoc/images/zoom.png
|
84
|
+
- rdoc/index.html
|
85
|
+
- rdoc/js/darkfish.js
|
86
|
+
- rdoc/js/jquery.js
|
87
|
+
- rdoc/js/quicksearch.js
|
88
|
+
- rdoc/js/thickbox-compressed.js
|
89
|
+
- rdoc/lib/bbcodeize_helper_rb.html
|
90
|
+
- rdoc/lib/bbcodeizer/version_rb.html
|
91
|
+
- rdoc/lib/bbcodeizer_rb.html
|
92
|
+
- rdoc/rdoc.css
|
93
|
+
- test/bbcodeizer_test.rb
|
94
|
+
has_rdoc: true
|
95
|
+
homepage: https://github.com/qpingu/bbcodeizer
|
96
|
+
licenses: []
|
97
|
+
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: "0"
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: "0"
|
115
|
+
requirements: []
|
116
|
+
|
117
|
+
rubyforge_project: bbcodeizer
|
118
|
+
rubygems_version: 1.6.2
|
119
|
+
signing_key:
|
120
|
+
specification_version: 3
|
121
|
+
summary: BBCodeizer is a simple gem that translates BBCode to HTML
|
122
|
+
test_files:
|
123
|
+
- test/bbcodeizer_test.rb
|