rbbcode 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rbbcode/node_extensions.rb +10 -1
- data/lib/rbbcode/sanitize.rb +1 -1
- metadata +1 -1
@@ -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>'
|
data/lib/rbbcode/sanitize.rb
CHANGED