bb-ruby 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 890a3b596d2881b1e153b7517156830f7825d927
4
- data.tar.gz: 22584247d6b69600a05bea1f975cef76dd4e93f2
3
+ metadata.gz: e31c71c0e04a0e39dd877eb21f930b6e9d59e73c
4
+ data.tar.gz: 099517c2a493ac393be6383c8be976900ebad682
5
5
  SHA512:
6
- metadata.gz: 05ced520bf0cf1c2c980541c4a561d3f014ad53f143c92397c4e53d1dd19ab6d84d6f994159cdfb44c87448465ab36283efb94e3486fb36a8b1332c3568af310
7
- data.tar.gz: e4e10c20c73427e80561aac51a4e8bc491e209198d3bbc2b23353affa8c4dcd59aec07936c58d5c7878e8c32a905472eb26f52de9a705110839cd0a0b54539a5
6
+ metadata.gz: 58d201f94138d9a169d2d22458752759818f130446be6768885a0e0fafbc3d72ddca130dbc9e25c8717f6e37d0071110ed7cb5dadb0413bba1e4dc16b29e9503
7
+ data.tar.gz: 6bfceb073c0e463b4df6186a0988969e4cbfed4a4b93cefed00944f180e205e4b9809dfb9bce836c0ebdc57863db97261bcfb3247a5f7c4a95ddfd3fdf2ba26b
data/.travis.yml CHANGED
@@ -1,4 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.1.0
4
+ - 2.0.0
3
5
  - 1.9.3
4
6
  - 1.8.7
data/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ == 1.1.0 2014-12-1
2
+
3
+ * Added left, right, center, br tags
4
+
5
+ == 1.0.5 2014-08-28
6
+
7
+ * Added support for parsing multiple [email] fields
8
+ * Added support for parsing multiple [youtube] fields
9
+
1
10
  == 1.0.4 2014-01-17
2
11
 
3
12
  * Fix handling of nested tags
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bb-ruby (1.0.3)
4
+ bb-ruby (1.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -99,6 +99,7 @@ The following is the list of BBCode tags processed by BBRuby and their associate
99
99
  [url=link] :link
100
100
  [url] :link
101
101
  [img size=] :image
102
+ [img align=] :image
102
103
  [img=] :image
103
104
  [img] :image
104
105
  [youtube] :video
@@ -106,3 +107,7 @@ The following is the list of BBCode tags processed by BBRuby and their associate
106
107
  [vimeo] :video
107
108
  [email] :email
108
109
  [align] :align
110
+ [left] :left
111
+ [center] :center
112
+ [right] :right
113
+ [br] :br
data/lib/bb-ruby.rb CHANGED
@@ -124,13 +124,13 @@ module BBRuby
124
124
  /\[quote(:.*)?=(?:")?(.*?)(?:")?\](.*?)\[\/quote\1?\]/mi,
125
125
  '<fieldset><legend>\2</legend><blockquote>\3</blockquote></fieldset>',
126
126
  'Quote with citation',
127
- "[quote=mike]Now is the time...[/quote]",
127
+ '[quote=mike]Now is the time...[/quote]',
128
128
  :quote],
129
129
  'Quote (Sourceless)' => [
130
130
  /\[quote(:.*)?\](.*?)\[\/quote\1?\]/mi,
131
131
  '<fieldset><blockquote>\2</blockquote></fieldset>',
132
132
  'Quote (sourceclass)',
133
- "[quote]Now is the time...[/quote]",
133
+ '[quote]Now is the time...[/quote]',
134
134
  :quote],
135
135
  'Link' => [
136
136
  /\[url=(?:&quot;)?(.*?)(?:&quot;)?\](.*?)\[\/url\]/mi,
@@ -142,10 +142,10 @@ module BBRuby
142
142
  /\[url\](.*?)\[\/url\]/mi,
143
143
  '<a href="\1">\1</a>',
144
144
  'Hyperlink (implied)',
145
- "Maybe try looking on [url]http://google.com[/url]",
145
+ 'Maybe try looking on [url]http://google.com[/url]',
146
146
  :link],
147
147
  'Link (Automatic)' => [
148
- /(\A|\s)(https?:\/\/[^\s<]+)/,
148
+ %r{(\A|\s)(https?://[^\s<]+)},
149
149
  ' <a href="\2">\2</a>',
150
150
  'Hyperlink (automatic)',
151
151
  'Maybe try looking on http://www.google.com',
@@ -168,6 +168,12 @@ module BBRuby
168
168
  'Display an image (alternative format)',
169
169
  '[img=http://myimage.com/logo.gif]',
170
170
  :image],
171
+ 'Image (Aligned)' => [
172
+ /\[img(:.+)? align=(left|right)\](.*?)\[\/img\1?\]/im,
173
+ '<img src="\3" alt="" style="float: \2;" />',
174
+ 'Display an aligned image',
175
+ '[img align=right]http://catsweekly.com/crazycat.jpg[/img]',
176
+ :image],
171
177
  'Image' => [
172
178
  /\[img(:.+)?\]([^\[\]].*?)\.(#{@@imageformats})\[\/img\1?\]/im,
173
179
  '<img src="\2.\3" alt="" />',
@@ -175,7 +181,7 @@ module BBRuby
175
181
  'Check out this crazy cat: [img]http://catsweekly.com/crazycat.jpg[/img]',
176
182
  :image],
177
183
  'YouTube' => [
178
- /\[youtube\](.*?)\?v=([\w\d\-]+).*\[\/youtube\]/im,
184
+ /\[youtube\](.*?)\?v=([\w\d\-]+).*?\[\/youtube\]/im,
179
185
  # '<object width="400" height="330"><param name="movie" value="http://www.youtube.com/v/\2"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/\2" type="application/x-shockwave-flash" wmode="transparent" width="400" height="330"></embed></object>',
180
186
  '<object width="320" height="265"><param name="movie" value="http://www.youtube.com/v/\2"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/\2" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object>',
181
187
  'Display a video from YouTube.com',
@@ -201,17 +207,47 @@ module BBRuby
201
207
  '[gvideo]http://video.google.com/videoplay?docid=-2200109535941088987[/gvideo]',
202
208
  :video],
203
209
  'Email' => [
204
- /\[email(:.+)?\](.+)\[\/email\1?\]/i,
205
- '<a href="mailto:\2">\2</a>',
210
+ %r{\[email[^:=]?\](((?!\[/email\]).)*)\[/email\]}mi,
211
+ '<a href="mailto:\1">\1</a>',
206
212
  'Link to email address',
207
213
  '[email]wadus@wadus.com[/email]',
208
214
  :email],
215
+ 'Email (alternative)' => [
216
+ %r{\[email[:=]([^\]]+)\](((?!\[/email\]).)*)(\[/email\1?\])?}mi,
217
+ '<a href="mailto:\1">\2</a>',
218
+ 'Link to email address',
219
+ '[email:wadus@wadus.com]Email Me[/email]',
220
+ :email],
209
221
  'Align' => [
210
222
  /\[align=(.*?)\](.*?)\[\/align\]/mi,
211
223
  "<span class=\"bb-ruby_align_\\1\" style=\"float:\\1;\">\\2</span>",
212
224
  'Align this object using float',
213
225
  'Here\'s a wrapped image: [align=right][img]image.png[/img][/align]',
214
- :align]
226
+ :align],
227
+ 'Left' => [
228
+ /\[left(:.+)?\](.*?)\[\/left\1?\]/mi,
229
+ "<div style=\"text-align: left;\">\\2</div>",
230
+ 'Aligns contents along the left side',
231
+ '[left]Left-aligned content[/left]',
232
+ :left],
233
+ 'Center' => [
234
+ /\[center(:.+)?\](.*?)\[\/center\1?\]/mi,
235
+ "<div style=\"text-align: center;\">\\2</div>",
236
+ 'Aligns contents on the center',
237
+ '[center]Centered content[/center]',
238
+ :center],
239
+ 'Right' => [
240
+ /\[right(:.+)?\](.*?)\[\/right\1?\]/mi,
241
+ "<div style=\"text-align: right;\">\\2</div>",
242
+ 'Aligns contents along the right side',
243
+ '[right]Right-aligned content[/right]',
244
+ :right],
245
+ 'Line break' => [
246
+ /\[br\]/mi,
247
+ "<br />",
248
+ 'Inserts line break tag',
249
+ 'One[br]Two[br]Three lines!',
250
+ :br]
215
251
  }
216
252
 
217
253
  class << self
@@ -331,7 +367,7 @@ module BBRuby
331
367
  text.gsub!(/\n\n+/, "</p>\n\n#{start_tag}") # 2+ newline => paragraph
332
368
  text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline => br
333
369
  text.insert 0, start_tag
334
- text << "</p>"
370
+ text << '</p>'
335
371
  end
336
372
  end # class << self
337
373
 
@@ -1,3 +1,3 @@
1
1
  module BBRuby
2
- VERSION = "1.0.4"
2
+ VERSION = '1.1.0'
3
3
  end
data/test/bb-ruby_test.rb CHANGED
@@ -117,7 +117,7 @@ class TestBBRuby < Test::Unit::TestCase
117
117
  assert_equal '<a href="http://google.com">http://google.com</a>', '[url]http://google.com[/url]'.bbcode_to_html
118
118
  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
119
119
  assert_equal %Q(<a href="http://www.altctrlsupr.com/dmstk/kdd070803/00.html"> ABRIR\nALBUM </a>),"[URL=http://www.altctrlsupr.com/dmstk/kdd070803/00.html] ABRIR\nALBUM [/URL]".bbcode_to_html
120
- assert_equal '<a href="http://www.urimalet.com/cadaverex.mp3">aha</a>', "[URL=http://www.urimalet.com/cadaverex.mp3]aha[/URL]".bbcode_to_html
120
+ assert_equal '<a href="http://www.urimalet.com/cadaverex.mp3">aha</a>', '[URL=http://www.urimalet.com/cadaverex.mp3]aha[/URL]'.bbcode_to_html
121
121
  # allow quoted urls:
122
122
  assert_equal '<a href="http://www.apple.com">aha</a>', '[URL="http://www.apple.com"]aha[/URL]'.bbcode_to_html
123
123
  end
@@ -131,6 +131,8 @@ class TestBBRuby < Test::Unit::TestCase
131
131
  assert_equal '<img src="http://zoople/hochzeit.png" style="width: 95px; height: 96px;" />', '[img:7a9ca2c5c3 size="95x96"]http://zoople/hochzeit.png[/img:7a9ca2c5c3]'.bbcode_to_html
132
132
  assert_equal '<img src="http://zoople/hochzeit.png" style="width: 95px; height: 96px;" />', '[img:7a9ca2c5c3 size=\'95x96\']http://zoople/hochzeit.png[/img:7a9ca2c5c3]'.bbcode_to_html
133
133
  assert_equal '<img src="http://www.marcodigital.com/sitanddie/sitanddiepequeño.jpg" alt="" />', '[img:post_uid0]http://www.marcodigital.com/sitanddie/sitanddiepequeño.jpg[/img:post_uid0]'.bbcode_to_html
134
+ assert_equal '<img src="http://foo.bar/baz.png" alt="" style="float: left;" />', '[img align=left]http://foo.bar/baz.png[/img]'.bbcode_to_html
135
+ assert_equal '<img src="http://foo.bar/baz.png" alt="" style="float: right;" />', '[img align=right]http://foo.bar/baz.png[/img]'.bbcode_to_html
134
136
  end
135
137
 
136
138
  def test_image_link
@@ -142,6 +144,7 @@ class TestBBRuby < Test::Unit::TestCase
142
144
  # Uncomment below if using 4:3 format youtube video embed
143
145
  # assert_equal '<object width="320" height="265"><param name="movie" value="http://www.youtube.com/v/E4Fbk52Mk1w"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/E4Fbk52Mk1w" type="application/x-shockwave-flash" wmode="transparent" width="320" height="265"></embed></object>','[youtube]http://youtube.com/watch?v=E4Fbk52Mk1w[/youtube]'.bbcode_to_html
144
146
  assert_equal '<object width="320" height="265"><param name="movie" value="http://www.youtube.com/v/E4Fbk52Mk1w"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/E4Fbk52Mk1w" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object>', '[youtube]http://youtube.com/watch?v=E4Fbk52Mk1w[/youtube]'.bbcode_to_html
147
+ assert_equal '<object width="320" height="265"><param name="movie" value="http://www.youtube.com/v/E4Fbk52Mk1w"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/E4Fbk52Mk1w" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object><object width="320" height="265"><param name="movie" value="http://www.youtube.com/v/abc123"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/abc123" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object>', '[youtube]http://youtube.com/watch?v=E4Fbk52Mk1w[/youtube][youtube]http://youtube.com/watch?v=abc123[/youtube]'.bbcode_to_html
145
148
  end
146
149
 
147
150
  def test_vimeo
@@ -154,6 +157,9 @@ class TestBBRuby < Test::Unit::TestCase
154
157
 
155
158
  def test_email
156
159
  assert_equal '<a href="mailto:wadus@wadus.com">wadus@wadus.com</a>', '[email]wadus@wadus.com[/email]'.bbcode_to_html
160
+ assert_equal '<a href="mailto:wadus@wadus.com">EMAIL ME</a>', '[email:wadus@wadus.com]EMAIL ME[/email]'.bbcode_to_html
161
+ assert_equal '<a href="mailto:wadus@wadus.com">EMAIL ME</a>', '[email=wadus@wadus.com]EMAIL ME[/email]'.bbcode_to_html
162
+ assert_equal '<a href="mailto:abc@example.com">abc@example.com</a><a href="mailto:xyz@example.com">xyz@example.com</a>', '[email]abc@example.com[/email][email]xyz@example.com[/email]'.bbcode_to_html
157
163
  end
158
164
 
159
165
  def test_auto_link
@@ -170,34 +176,34 @@ class TestBBRuby < Test::Unit::TestCase
170
176
  end
171
177
 
172
178
  def test_html_escaping
173
- assert_equal "<strong>&lt;i&gt;foobar&lt;/i&gt;</strong>", '[b]<i>foobar</i>[/b]'.bbcode_to_html
174
- assert_equal "<strong><i>foobar</i></strong>", '[b]<i>foobar</i>[/b]'.bbcode_to_html({}, false)
175
- assert_equal "1 is &lt; 2", '1 is < 2'.bbcode_to_html
176
- assert_equal "1 is < 2", '1 is < 2'.bbcode_to_html({}, false)
177
- assert_equal "2 is &gt; 1", '2 is > 1'.bbcode_to_html
178
- assert_equal "2 is > 1", '2 is > 1'.bbcode_to_html({}, false)
179
+ assert_equal '<strong>&lt;i&gt;foobar&lt;/i&gt;</strong>', '[b]<i>foobar</i>[/b]'.bbcode_to_html
180
+ assert_equal '<strong><i>foobar</i></strong>', '[b]<i>foobar</i>[/b]'.bbcode_to_html({}, false)
181
+ assert_equal '1 is &lt; 2', '1 is < 2'.bbcode_to_html
182
+ assert_equal '1 is < 2', '1 is < 2'.bbcode_to_html({}, false)
183
+ assert_equal '2 is &gt; 1', '2 is > 1'.bbcode_to_html
184
+ assert_equal '2 is > 1', '2 is > 1'.bbcode_to_html({}, false)
179
185
  assert_equal %Q{&quot;double quotes&quot; and &apos;single quotes&apos;}, %Q{"double quotes" and 'single quotes'}.bbcode_to_html
180
186
  assert_equal %Q{"double quotes" and 'single quotes'}, %Q{"double quotes" and 'single quotes'}.bbcode_to_html({}, false)
181
187
  end
182
188
 
183
189
  def test_disable_tags
184
- assert_equal "[b]foobar[/b]", "[b]foobar[/b]".bbcode_to_html({}, true, :disable, :bold)
185
- assert_equal "[b]<em>foobar</em>[/b]", "[b][i]foobar[/i][/b]".bbcode_to_html({}, true, :disable, :bold)
186
- assert_equal "[b][i]foobar[/i][/b]", "[b][i]foobar[/i][/b]".bbcode_to_html({}, true, :disable, :bold, :italics)
187
- assert_equal "<fieldset><blockquote>foobar</blockquote></fieldset>", "[quote]foobar[/quote]".bbcode_to_html({}, true, :disable, :underline)
190
+ assert_equal '[b]foobar[/b]', '[b]foobar[/b]'.bbcode_to_html({}, true, :disable, :bold)
191
+ assert_equal '[b]<em>foobar</em>[/b]', '[b][i]foobar[/i][/b]'.bbcode_to_html({}, true, :disable, :bold)
192
+ assert_equal '[b][i]foobar[/i][/b]', '[b][i]foobar[/i][/b]'.bbcode_to_html({}, true, :disable, :bold, :italics)
193
+ assert_equal '<fieldset><blockquote>foobar</blockquote></fieldset>', '[quote]foobar[/quote]'.bbcode_to_html({}, true, :disable, :underline)
188
194
  end
189
195
 
190
196
  def test_enable_tags
191
- assert_equal "<strong>foobar</strong>", "[b]foobar[/b]".bbcode_to_html({}, true, :enable, :bold)
192
- assert_equal "<strong>[i]foobar[/i]</strong>", "[b][i]foobar[/i][/b]".bbcode_to_html({}, true, :enable, :bold)
193
- assert_equal "<strong><em>foobar</em></strong>", "[b][i]foobar[/i][/b]".bbcode_to_html({}, true, :enable, :bold, :italics)
194
- assert_equal "[quote]foobar[/quote]", "[quote]foobar[/quote]".bbcode_to_html({}, true, :enable, :underline)
197
+ assert_equal '<strong>foobar</strong>', '[b]foobar[/b]'.bbcode_to_html({}, true, :enable, :bold)
198
+ assert_equal '<strong>[i]foobar[/i]</strong>', '[b][i]foobar[/i][/b]'.bbcode_to_html({}, true, :enable, :bold)
199
+ assert_equal '<strong><em>foobar</em></strong>', '[b][i]foobar[/i][/b]'.bbcode_to_html({}, true, :enable, :bold, :italics)
200
+ assert_equal '[quote]foobar[/quote]', '[quote]foobar[/quote]'.bbcode_to_html({}, true, :enable, :underline)
195
201
  end
196
202
 
197
203
  def test_to_html_bang_method
198
- foo = "[b]foobar[/b]"
199
- assert_equal "<strong>foobar</strong>", foo.bbcode_to_html!
200
- assert_equal "<strong>foobar</strong>", foo
204
+ foo = '[b]foobar[/b]'
205
+ assert_equal '<strong>foobar</strong>', foo.bbcode_to_html!
206
+ assert_equal '<strong>foobar</strong>', foo
201
207
  end
202
208
 
203
209
  def test_to_html_with_no_markup
@@ -211,7 +217,7 @@ class TestBBRuby < Test::Unit::TestCase
211
217
  end
212
218
 
213
219
  def test_self_tag_list
214
- assert_equal 34, BBRuby.tag_list.size
220
+ assert_equal 40, BBRuby.tag_list.size
215
221
  end
216
222
 
217
223
  def test_redefinition_of_tag_html
@@ -247,20 +253,20 @@ class TestBBRuby < Test::Unit::TestCase
247
253
  end
248
254
 
249
255
  def test_multiple_tag_test
250
- assert_equal "<strong>bold</strong><em>italic</em><span style=\"text-decoration:underline;\">underline</span><fieldset><blockquote>quote</blockquote></fieldset><a href=\"foobar\">link</a>", "[b]bold[/b][i]italic[/i][u]underline[/u][quote]quote[/quote][url=foobar]link[/url]".bbcode_to_html
251
- assert_equal "<strong>bold</strong><em>italic</em><span style=\"text-decoration:underline;\">underline</span><fieldset><blockquote>quote</blockquote></fieldset><a href=\"foobar\">link</a>", "[b]bold[/b][i]italic[/i][u]underline[/u][quote]quote[/quote][url=foobar]link[/url]".bbcode_to_html({}, true, :enable, :bold, :italics, :underline, :link, :quote)
256
+ assert_equal "<strong>bold</strong><em>italic</em><span style=\"text-decoration:underline;\">underline</span><fieldset><blockquote>quote</blockquote></fieldset><a href=\"foobar\">link</a>", '[b]bold[/b][i]italic[/i][u]underline[/u][quote]quote[/quote][url=foobar]link[/url]'.bbcode_to_html
257
+ assert_equal "<strong>bold</strong><em>italic</em><span style=\"text-decoration:underline;\">underline</span><fieldset><blockquote>quote</blockquote></fieldset><a href=\"foobar\">link</a>", '[b]bold[/b][i]italic[/i][u]underline[/u][quote]quote[/quote][url=foobar]link[/url]'.bbcode_to_html({}, true, :enable, :bold, :italics, :underline, :link, :quote)
252
258
  end
253
259
 
254
260
  def test_no_ending_tag
255
- assert_equal "this [b]should not be bold", "this [b]should not be bold".bbcode_to_html
261
+ assert_equal 'this [b]should not be bold', 'this [b]should not be bold'.bbcode_to_html
256
262
  end
257
263
 
258
264
  def test_no_start_tag
259
- assert_equal "this should not be bold[/b]", "this should not be bold[/b]".bbcode_to_html
265
+ assert_equal 'this should not be bold[/b]', 'this should not be bold[/b]'.bbcode_to_html
260
266
  end
261
267
 
262
268
  def test_different_start_and_ending_tags
263
- assert_equal "this [b]should not do formatting[/i]", "this [b]should not do formatting[/i]".bbcode_to_html
269
+ assert_equal 'this [b]should not do formatting[/i]', 'this [b]should not do formatting[/i]'.bbcode_to_html
264
270
  end
265
271
 
266
272
  ## proc tests below
@@ -289,7 +295,7 @@ class TestBBRuby < Test::Unit::TestCase
289
295
  end
290
296
 
291
297
  # for next test
292
- def sum a, b; a + b end
298
+ def sum(a, b); a + b end
293
299
 
294
300
  def test_proc_include_method # sum as example
295
301
  mydef = {
@@ -305,7 +311,7 @@ class TestBBRuby < Test::Unit::TestCase
305
311
 
306
312
  # Proc.new{} as opposed to lambda{} may have not params
307
313
  def test_proc_instead_of_lambda # copyright
308
- copyright = "2913-3013 The Company, Ltd."
314
+ copyright = '2913-3013 The Company, Ltd.'
309
315
  mydef = {
310
316
  'copy' => [
311
317
  /\[copy\/\]/mi,
@@ -324,4 +330,23 @@ class TestBBRuby < Test::Unit::TestCase
324
330
  assert_equal '<fieldset><legend>Kitten</legend><blockquote><fieldset><legend>creatiu</legend><blockquote>f1</blockquote></fieldset>f2</blockquote></fieldset>', '[quote:26fe26a6a9="Kitten"][quote:26fe26a6a93="creatiu"]f1[/quote:26fe26a6a93]f2[/quote:26fe26a6a9]'.bbcode_to_html.bbcode_to_html({}, false, :disable)
325
331
  end
326
332
 
333
+ def test_left
334
+ assert_equal '<div style="text-align: left;">simple</div>', '[left]simple[/left]'.bbcode_to_html
335
+ assert_equal '<div style="text-align: left;">simple</div>', '[left:7a9ca2c5c3]simple[/left:7a9ca2c5c3]'.bbcode_to_html
336
+ end
337
+
338
+ def test_center
339
+ assert_equal '<div style="text-align: center;">simple</div>', '[center]simple[/center]'.bbcode_to_html
340
+ assert_equal '<div style="text-align: center;">simple</div>', '[center:7a9ca2c5c3]simple[/center:7a9ca2c5c3]'.bbcode_to_html
341
+ end
342
+
343
+ def test_right
344
+ assert_equal '<div style="text-align: right;">simple</div>', '[right]simple[/right]'.bbcode_to_html
345
+ assert_equal '<div style="text-align: right;">simple</div>', '[right:7a9ca2c5c3]simple[/right:7a9ca2c5c3]'.bbcode_to_html
346
+ end
347
+
348
+ def test_br
349
+ assert_equal 'One<br />Two<br />Three lines!', 'One[br]Two[br]Three lines!'.bbcode_to_html
350
+ end
351
+
327
352
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bb-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig P. Jolicoeur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-17 00:00:00.000000000 Z
11
+ date: 2014-12-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: BBCode for Ruby
14
14
  email:
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  version: '0'
51
51
  requirements: []
52
52
  rubyforge_project:
53
- rubygems_version: 2.2.1
53
+ rubygems_version: 2.4.1
54
54
  signing_key:
55
55
  specification_version: 4
56
56
  summary: BBRuby is a BBCode implementation for Ruby. It will convert strings with