bbcodeizer 0.1.3 → 0.1.4
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/lib/bbcodeizer/version.rb +1 -1
- data/lib/bbcodeizer.rb +2 -1
- data/test/bbcodeizer_test.rb +6 -0
- metadata +1 -1
data/lib/bbcodeizer/version.rb
CHANGED
data/lib/bbcodeizer.rb
CHANGED
|
@@ -50,6 +50,7 @@ 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
54
|
}
|
|
54
55
|
|
|
55
56
|
# Tags in this list are invoked. To deactivate a particular tag, call BBCodeizer.deactivate.
|
|
@@ -60,7 +61,7 @@ module BBCodeizer
|
|
|
60
61
|
:code, :quote, :youtube, :googlevid, :flash, :spoiler, :nsfw, :hide, :mp3,
|
|
61
62
|
:superdeluxe, :comedycentral, :revver, :myspacetv, :collegehumor, :hulu,
|
|
62
63
|
:metacafe, :yahoovid, :flickr, :gametrailers, :slideshare, :funnyordie,
|
|
63
|
-
:atomfilms, :vimeo, :li, :list, :current ]
|
|
64
|
+
:atomfilms, :vimeo, :li, :list, :current, :auto_link ]
|
|
64
65
|
|
|
65
66
|
TagGroups = { :video => [ :youtube, :googlevid, :flash, :superdeluxe, :comedycentral, :revver,
|
|
66
67
|
:myspacetv, :collegehumor, :hulu, :metacafe, :yahoovid, :gametrailers,
|
data/test/bbcodeizer_test.rb
CHANGED
|
@@ -106,6 +106,12 @@ class BbcodeizerTest < Test::Unit::TestCase
|
|
|
106
106
|
bbcodeize("[color=red]Red Text[/color]"))
|
|
107
107
|
end
|
|
108
108
|
|
|
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
|
+
|
|
109
115
|
def test_disable
|
|
110
116
|
assert_equal(
|
|
111
117
|
"I am [b]really[/b] happy!",
|