trainbbcode 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/trainbbcode.rb +13 -5
- data/trainbbcode.gemspec +2 -2
- metadata +2 -2
data/Rakefile
CHANGED
data/lib/trainbbcode.rb
CHANGED
@@ -63,6 +63,7 @@ class TBBC
|
|
63
63
|
#Url
|
64
64
|
[/\[url\](.*?)\[\/url\]/,'<a href="\1" target="' + @config[:url_target] +'">\1</a>',@config[:url_enabled]],
|
65
65
|
[/\[url=(.*?)\](.*?)\[\/url\]/,'<a href="\1" target="' + @config[:url_target] + '">\2</a>',@config[:url_enabled]],
|
66
|
+
[/\[url=(.*?) target=(.*?)\](.*?)\[\/url\]/,'<a href="\1" target="\2">\3</a>',@config[:url_enabled]],
|
66
67
|
#Image
|
67
68
|
[/\[img\](.*?)\[\/img\]/,'<img src="\1" alt="'+ @config[:image_alt] + '" />',@config[:image_enabled]],
|
68
69
|
[/\[img alt=(.*?)\](.*?)\[\/img\]/,'<img src="\2" alt="\1" />',@config[:image_enabled]],
|
@@ -76,16 +77,21 @@ class TBBC
|
|
76
77
|
[/\[quote\](.*?)\[\/quote\]/,'<blockquote>\1</blockquote>',@config[:quote_enabled]],
|
77
78
|
[/\[quote=(.*?)\](.*?)\[\/quote\]/,'<blockquote><i>Posted by <b>\1</b></i><br />\2</blockquote>',@config[:quote_enabled]],
|
78
79
|
#Color
|
79
|
-
[/\[color=(.*?)\](.*?)\[\/color\]/,'<span style="color:\1;">\2</span>',@config[:color_enabled]]
|
80
|
+
[/\[color=(.*?)\](.*?)\[\/color\]/,'<span style="color:\1;">\2</span>',@config[:color_enabled]],
|
81
|
+
#Alignment
|
82
|
+
[/\[center\](.*?)\[\/center\]/,'<div style="text-align:center">\1</div>',@config[:alignment_enabled]],
|
83
|
+
[/\[left\](.*?)\[\/left\]/,'<div style="text-align:left">\1</div>',@config[:alignment_enabled]],
|
84
|
+
[/\[right\](.*?)\[\/right\]/,'<div style="text-align:right">\1</div>',@config[:alignment_enabled]],
|
85
|
+
#Acronym
|
86
|
+
[/\[acronym=(.*?)\](.*?)\[\/acronym\]/,'<acronym title="\1">\2</acronym>',@config[:acronym_enabled]]
|
80
87
|
]
|
81
88
|
end
|
82
89
|
def nobbc(s)
|
83
90
|
find=s.scan(/\[nobbc\](.*?)\[\/nobbc\]/)
|
84
91
|
find.each do |f|
|
85
92
|
replace=f[0].gsub("[","[").gsub("]","]")
|
86
|
-
s=s.gsub(f[0],replace)
|
93
|
+
s=s.gsub("[nobbc]#{f[0]}[/nobbc]",replace)
|
87
94
|
end
|
88
|
-
s=s.gsub("[nobbc]","").gsub("[/nobbc]","")
|
89
95
|
return s
|
90
96
|
end
|
91
97
|
def css
|
@@ -99,7 +105,8 @@ class TBBC
|
|
99
105
|
end
|
100
106
|
def uv(s)
|
101
107
|
find=s.scan(/\[code lang=(.*?)\](.*?)\[\/code\]/)
|
102
|
-
|
108
|
+
find.each do |f|
|
109
|
+
#parse=nobbc "[nobbc]" + f[1] + "[/nobbc]"
|
103
110
|
r=Uv.parse(f[1], @config[:syntax_output], f[0], @config[:syntax_line_numbers], @config[:syntax_theme])
|
104
111
|
end
|
105
112
|
s=s.gsub(/\[code lang=(.*?)\]/,'').gsub("[/code]",'')
|
@@ -109,8 +116,9 @@ end
|
|
109
116
|
|
110
117
|
#Add .tbbc to Strings
|
111
118
|
class String
|
112
|
-
def tbbc
|
119
|
+
def tbbc(conf = nil)
|
113
120
|
bbc=TBBC.new
|
121
|
+
bbc.conf(conf) if conf
|
114
122
|
bbc.parse(self)
|
115
123
|
end
|
116
124
|
end
|
data/trainbbcode.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{trainbbcode}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Adam \"Arcath\" Laycock"]
|
9
|
-
s.date = %q{2009-12-
|
9
|
+
s.date = %q{2009-12-30}
|
10
10
|
s.description = %q{Provides BBCode for Ruby.}
|
11
11
|
s.email = %q{adam@arcath.net}
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "lib/trainbbcode.rb"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trainbbcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam "Arcath" Laycock
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-30 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|