bbcodeizer 0.1.4 → 0.1.5

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.4"
2
+ VERSION = "0.1.5"
3
3
  end
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, :url_with_title, :url_sans_title, :image, :size, :color,
61
- :code, :quote, :youtube, :googlevid, :flash, :spoiler, :nsfw, :hide, :mp3,
62
- :superdeluxe, :comedycentral, :revver, :myspacetv, :collegehumor, :hulu,
63
- :metacafe, :yahoovid, :flickr, :gametrailers, :slideshare, :funnyordie,
64
- :atomfilms, :vimeo, :li, :list, :current, :auto_link ]
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,
@@ -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!",
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: bbcodeizer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.4
5
+ version: 0.1.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jonathan Dance