bbcodeizer 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bbcodeizer/version.rb +1 -1
- data/lib/bbcodeizer.rb +6 -6
- data/test/bbcodeizer_test.rb +9 -6
- metadata +1 -1
data/lib/bbcodeizer/version.rb
CHANGED
data/lib/bbcodeizer.rb
CHANGED
@@ -50,18 +50,18 @@ module BBCodeizer
|
|
50
50
|
:grooveshark => [ /\[grooveshark\](.+?)\[\/grooveshark\]/i, '<object width="250" height="40"> <param name="movie" value="http://listen.grooveshark.com/songWidget.swf"></param> <param name="wmode" value="window"></param> <param name="allowScriptAccess" value="always"></param> <param name="flashvars" value="hostname=cowbell.grooveshark.com&widgetID=\1&style=grass&p=0"></param> <embed src="http://listen.grooveshark.com/songWidget.swf" type="application/x-shockwave-flash" width="250" height="40" flashvars="hostname=cowbell.grooveshark.com&widgetID=\1&style=grass&p=0" allowScriptAccess="always" wmode="window"></embed></object>'],
|
51
51
|
:sup => [ /\[sup\](.+?)\[\/sup\]/im, '<sup>\1</sup>' ],
|
52
52
|
:sub => [ /\[sub\](.+?)\[\/sub\]/im, '<sub>\1</sub>' ],
|
53
|
-
:auto_link => [ /(\A|\s)((https?:\/\/|www\.)[^\s<]+)/, '\1<a href="\2">\2</a>' ],
|
53
|
+
:auto_link => [ /(\A|\s|>)((https?:\/\/|www\.)[^\s<]+)/, '\1<a href="\2">\2</a>' ],
|
54
54
|
}
|
55
55
|
|
56
56
|
# Tags in this list are invoked. To deactivate a particular tag, call BBCodeizer.deactivate.
|
57
57
|
# These names correspond to either names above or methods in this module.
|
58
58
|
# The ':literal' tag MUST be first for it to work correctly
|
59
59
|
TagList = [ :literal, :bold, :italic, :underline, :del, :strike, :email_with_name,
|
60
|
-
:email_sans_name, :
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
60
|
+
:email_sans_name, :image, :size, :color, :code, :quote, :youtube, :googlevid,
|
61
|
+
:flash, :spoiler, :nsfw, :hide, :mp3, :superdeluxe, :comedycentral, :revver,
|
62
|
+
:myspacetv, :collegehumor, :hulu, :metacafe, :yahoovid, :flickr, :gametrailers,
|
63
|
+
:slideshare, :funnyordie, :atomfilms, :vimeo, :li, :list, :current, :auto_link,
|
64
|
+
:url_with_title, :url_sans_title ]
|
65
65
|
|
66
66
|
TagGroups = { :video => [ :youtube, :googlevid, :flash, :superdeluxe, :comedycentral, :revver,
|
67
67
|
:myspacetv, :collegehumor, :hulu, :metacafe, :yahoovid, :gametrailers,
|
data/test/bbcodeizer_test.rb
CHANGED
@@ -70,6 +70,15 @@ class BbcodeizerTest < Test::Unit::TestCase
|
|
70
70
|
bbcodeize("My homepage is [url]http://www.example.com[/url]."))
|
71
71
|
end
|
72
72
|
|
73
|
+
def test_auto_link
|
74
|
+
assert_equal(
|
75
|
+
"Check out this site: <a href=\"http://google.com\">http://google.com</a>",
|
76
|
+
bbcodeize("Check out this site: http://google.com"))
|
77
|
+
assert_equal(
|
78
|
+
"<b><a href=\"http://google.com\">http://google.com</a></b>",
|
79
|
+
bbcodeize("<b>http://google.com</b>"))
|
80
|
+
end
|
81
|
+
|
73
82
|
def test_image
|
74
83
|
assert_equal(
|
75
84
|
"<img src=\"http://example.com/example.gif\" alt=\"http://example.com/example.gif\" />",
|
@@ -106,12 +115,6 @@ class BbcodeizerTest < Test::Unit::TestCase
|
|
106
115
|
bbcodeize("[color=red]Red Text[/color]"))
|
107
116
|
end
|
108
117
|
|
109
|
-
def test_auto_link
|
110
|
-
assert_equal(
|
111
|
-
"Check out this site: <a href=\"http://google.com\">http://google.com</a>",
|
112
|
-
bbcodeize("Check out this site: http://google.com"))
|
113
|
-
end
|
114
|
-
|
115
118
|
def test_disable
|
116
119
|
assert_equal(
|
117
120
|
"I am [b]really[/b] happy!",
|