bbcodeizer 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Bbcodeizer
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
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,
@@ -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!",
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: bbcodeizer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.3
5
+ version: 0.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jonathan Dance