bbcodeizer 0.1.5 → 0.2.0

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.
@@ -21,8 +21,8 @@ module BBCodeizer
21
21
  :strike => [ /\[strike\](.+?)\[\/strike\]/im, '<del>\1</del>' ],
22
22
  :email_with_name => [ /\[email=(.+?)\](.+?)\[\/email\]/i, '<a href="mailto:\1">\2</a>' ],
23
23
  :email_sans_name => [ /\[email\](.+?)\[\/email\]/i, '<a href="mailto:\1">\1</a>' ],
24
- :url_with_title => [ /\[url=(.+?)\](.+?)\[\/url\]/i, '<a href="\1">\2</a>' ],
25
- :url_sans_title => [ /\[url\](.+?)\[\/url\]/i, '<a href="\1">\1</a>' ],
24
+ :url_with_title => [ /\[url=(.+?)\](.+?)\[\/url\]/i, '<a href="\1" target="_blank">\2</a>' ],
25
+ :url_sans_title => [ /\[url\](.+?)\[\/url\]/i, '<a href="\1" target="_blank">\1</a>' ],
26
26
  :image => [ /\[img\](.+?)\[\/img\]/i, '<img src="\1" alt="\1" />' ],
27
27
  :size => [ /\[size=(\d{1,2})\](.+?)\[\/size\]/im, '<span style="font-size: \1px">\2</span>' ],
28
28
  :color => [ /\[color=([^;]+?)\](.+?)\[\/color\]/im, '<span style="color: \1">\2</span>' ],
@@ -50,7 +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
+ :auto_link => [ /(\A|\s|>)((https?:\/\/|www\.)[^\s<]+)/, '\1<a href="\2" target="_blank">\2</a>' ],
54
54
  }
55
55
 
56
56
  # Tags in this list are invoked. To deactivate a particular tag, call BBCodeizer.deactivate.
@@ -1,3 +1,3 @@
1
1
  module Bbcodeizer
2
- VERSION = "0.1.5"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -60,22 +60,25 @@ class BbcodeizerTest < Test::Unit::TestCase
60
60
 
61
61
  def test_url_with_title
62
62
  assert_equal(
63
- "Check out <a href=\"http://www.rubyonrails.com\">Ruby on Rails</a>!",
63
+ "Check out <a href=\"http://www.rubyonrails.com\" target=\"_blank\">Ruby on Rails</a>!",
64
64
  bbcodeize("Check out [url=http://www.rubyonrails.com]Ruby on Rails[/url]!"))
65
65
  end
66
66
 
67
67
  def test_url_sans_title
68
68
  assert_equal(
69
- "My homepage is <a href=\"http://www.example.com\">http://www.example.com</a>.",
69
+ "My homepage is <a href=\"http://www.example.com\" target=\"_blank\">http://www.example.com</a>.",
70
70
  bbcodeize("My homepage is [url]http://www.example.com[/url]."))
71
71
  end
72
72
 
73
73
  def test_auto_link
74
74
  assert_equal(
75
- "Check out this site: <a href=\"http://google.com\">http://google.com</a>",
75
+ "Check out this site: <a href=\"http://google.com\" target=\"_blank\">http://google.com</a>",
76
76
  bbcodeize("Check out this site: http://google.com"))
77
+ end
78
+
79
+ def test_auto_link_nested
77
80
  assert_equal(
78
- "<b><a href=\"http://google.com\">http://google.com</a></b>",
81
+ "<b><a href=\"http://google.com\" target=\"_blank\">http://google.com</a></b>",
79
82
  bbcodeize("<b>http://google.com</b>"))
80
83
  end
81
84
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: bbcodeizer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.5
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jonathan Dance
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-09-11 00:00:00 -07:00
14
+ date: 2011-09-18 00:00:00 -07:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency