Permalink
Browse files

Allow quotes in URL

  • Loading branch information...
1 parent 2a0e5ac commit 77a4b3c63e06e053cfbaf04331d9dc31f505c247 @marcandre committed May 28, 2012
Showing with 4 additions and 2 deletions.
  1. +1 −1 lib/bb-ruby.rb
  2. +1 −1 lib/bb-ruby/version.rb
  3. +2 −0 test/bb-ruby_test.rb
View
@@ -135,7 +135,7 @@ module BBRuby
"[quote]Now is the time...[/quote]",
:quote],
'Link' => [
- /\[url=(.*?)\](.*?)\[\/url\]/mi,
+ /\[url=(?:")?(.*?)(?:")?\](.*?)\[\/url\]/mi,
'<a href="\1">\2</a>',
'Hyperlink to somewhere else',
'Maybe try looking on [url=http://google.com]Google[/url]?',
View
@@ -1,3 +1,3 @@
module BBRuby
- VERSION = "0.9.6"
+ VERSION = "0.9.7"
end
View
@@ -123,6 +123,8 @@ def test_link
assert_equal '<a href="http://www.altctrlsupr.com/dmstk/kdd070803/00.html"> ABRIR ALBUM </a>','[URL=http://www.altctrlsupr.com/dmstk/kdd070803/00.html] ABRIR ALBUM [/URL]'.bbcode_to_html
assert_equal %Q(<a href="http://www.altctrlsupr.com/dmstk/kdd070803/00.html"> ABRIR<br />\nALBUM </a>),"[URL=http://www.altctrlsupr.com/dmstk/kdd070803/00.html] ABRIR\nALBUM [/URL]".bbcode_to_html
assert_equal '<a href="http://www.urimalet.com/cadaverex.mp3">aha</a>', "[URL=http://www.urimalet.com/cadaverex.mp3]aha[/URL]".bbcode_to_html
+ # allow quoted urls:
+ assert_equal '<a href="http://www.apple.com">aha</a>', '[URL="http://www.apple.com"]aha[/URL]'.bbcode_to_html
end
def test_image

0 comments on commit 77a4b3c

Please sign in to comment.