rbbcode 1.0.3 → 1.0.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.
@@ -1,4 +1,11 @@
1
1
  class RbbCode
2
+ module Attributes
3
+ # Strips any number of double quotes from the beginning and end of the string
4
+ def strip_quotes(str)
5
+ str.sub(/^"+/, '').sub(/"+$/, '')
6
+ end
7
+ end
8
+
2
9
  module RecursiveConversion
3
10
  def recursively_convert(node, depth = 0)
4
11
  if node.terminal?
@@ -61,10 +68,12 @@ class RbbCode
61
68
  end
62
69
 
63
70
  module URLTagNode
71
+ include Attributes
72
+
64
73
  def url_to_html
65
74
  if respond_to?(:url) and respond_to?(:text)
66
75
  # A URL tag formatted like [url=http://example.com]Example[/url]
67
- '<a href="' + url.text_value + '">' + text.text_value + '</a>'
76
+ '<a href="' + strip_quotes(url.text_value) + '">' + text.text_value + '</a>'
68
77
  else
69
78
  # A URL tag formatted like [url]http://example.com[/url]
70
79
  '<a href="' + inner_bbcode + '">' + inner_bbcode + '</a>'
@@ -2,7 +2,7 @@ class RbbCode
2
2
  DEFAULT_SANITIZE_CONFIG = {
3
3
  :elements => %w[a blockquote br code del em img li p pre strong ul u],
4
4
  :attributes => {
5
- 'a' => %w[href],
5
+ 'a' => %w[href target],
6
6
  'img' => %w[alt src]
7
7
  },
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: