bb-ruby 1.1.0 → 1.2.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: e31c71c0e04a0e39dd877eb21f930b6e9d59e73c
4
- data.tar.gz: 099517c2a493ac393be6383c8be976900ebad682
3
+ metadata.gz: 70b197a69b0f2ef22f95e3c56e14803d2794a1c6
4
+ data.tar.gz: 01d37bf9261b35ebed4ce3df663554faa82bd1bc
5
5
  SHA512:
6
- metadata.gz: 58d201f94138d9a169d2d22458752759818f130446be6768885a0e0fafbc3d72ddca130dbc9e25c8717f6e37d0071110ed7cb5dadb0413bba1e4dc16b29e9503
7
- data.tar.gz: 6bfceb073c0e463b4df6186a0988969e4cbfed4a4b93cefed00944f180e205e4b9809dfb9bce836c0ebdc57863db97261bcfb3247a5f7c4a95ddfd3fdf2ba26b
6
+ metadata.gz: cf742cda44a7789f8f2d467ff4549b555312c0b59c546fe82e80eb4d8bc3e63b22d2b01899a3fe5138a11d00312467e0ac8632d0d44bd959bd5cf109b7addbdd
7
+ data.tar.gz: 0ba32520f906667ade9e77b9f73d59c3d3b94b8019994f153ec8b428193f73d96aebed8c05d233d99c6018b99f64e6ad462220336fb568c04033c056071b070b
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.2.3
3
4
  - 2.1.0
4
5
  - 2.0.0
5
6
  - 1.9.3
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.2.0 2016-01-11
2
+
3
+ * Update embed code for Vimeo and YouTube
4
+
1
5
  == 1.1.0 2014-12-1
2
6
 
3
7
  * Added left, right, center, br tags
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bb-ruby (1.0.5)
4
+ bb-ruby (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -16,60 +16,60 @@ BBRuby is a [BBCode](http://www.bbcode.org) implementation for Ruby. It will con
16
16
  require 'bb-ruby'
17
17
 
18
18
  BBRuby has been included directly into the String class for use on any string object:
19
-
20
- text = "[b]Here is some bold text[/b] followed by some [u]underlined text[/u]"
21
- output = text.bbcode_to_html
22
- text.bbcode_to_html!
23
-
19
+ ```rb
20
+ text = "[b]Here is some bold text[/b] followed by some [u]underlined text[/u]"
21
+ output = text.bbcode_to_html
22
+ text.bbcode_to_html!
23
+ ```
24
24
  BBRuby will auto-escape HTML tags. To prevent this just pass false as the second param:
25
-
26
- output = text.bbcode_to_html({}, false)
27
-
25
+ ```rb
26
+ output = text.bbcode_to_html({}, false)
27
+ ```
28
28
  Only allow certain tags:
29
-
30
- output = text.bbcode_to_html({}, true, :enable, :image, :bold, :quote)
31
-
29
+ ```rb
30
+ output = text.bbcode_to_html({}, true, :enable, :image, :bold, :quote)
31
+ ```
32
32
  Disable certain tags:
33
-
34
- output = text.bbcode_to_html({}, true, :disable, :image, :bold, :quote)
35
-
33
+ ```rb
34
+ output = text.bbcode_to_html({}, true, :disable, :image, :bold, :quote)
35
+ ```
36
36
  Alternative Direct usage:
37
-
38
- output = BBRuby.to_html(bbcode_markup)
39
-
37
+ ```rb
38
+ output = BBRuby.to_html(bbcode_markup)
39
+ ```
40
40
  Define your own translation, in order to be more flexible:
41
-
42
- my_blockquote = {
43
- 'Quote' => [
44
- /\[quote(:.*)?=(.*?)\](.*?)\[\/quote\1?\]/mi,
45
- '<div class="quote"><p><cite>\2</cite></p><blockquote>\3</blockquote></div>',
46
- 'Quote with citation',
47
- '[quote=mike]please quote me[/quote]',
48
- :quote
49
- ],
50
- }
51
-
52
- text.bbcode_to_html(my_blockquote)
53
-
41
+ ```rb
42
+ my_blockquote = {
43
+ 'Quote' => [
44
+ /\[quote(:.*)?=(.*?)\](.*?)\[\/quote\1?\]/mi,
45
+ '<div class="quote"><p><cite>\2</cite></p><blockquote>\3</blockquote></div>',
46
+ 'Quote with citation',
47
+ '[quote=mike]please quote me[/quote]',
48
+ :quote
49
+ ],
50
+ }
51
+
52
+ text.bbcode_to_html(my_blockquote)
53
+ ```
54
54
  Define Proc as replacement:
55
-
56
- module BBRuby
57
- @@tags = @@tags.merge({
58
- 'File' => [
59
- /\[file(:.*)?=(.*?)\](.*?)\[\/file\1?\]/mi,
60
- lambda{ |e| "<div class="file"><p><cite>#{e[3]}</cite></p><blockquote>#{file_read_method(e[2])}</blockquote></div>"},
61
- 'File content with citation',
62
- '[file=script.rb]Script Caption[/file]',
63
- :file
64
- ],
65
- })
66
- end
67
-
68
- You can also use the simple_format method of ActionPack by using the *_with_formatting methods:
69
-
70
- output = text.bbcode_to_html_with_formatting
71
- output = text.bbcode_to_html_with_formatting!
72
-
55
+ ```rb
56
+ module BBRuby
57
+ @@tags = @@tags.merge({
58
+ 'File' => [
59
+ /\[file(:.*)?=(.*?)\](.*?)\[\/file\1?\]/mi,
60
+ lambda{ |e| "<div class="file"><p><cite>#{e[3]}</cite></p><blockquote>#{file_read_method(e[2])}</blockquote></div>"},
61
+ 'File content with citation',
62
+ '[file=script.rb]Script Caption[/file]',
63
+ :file
64
+ ],
65
+ })
66
+ end
67
+ ```
68
+ You can also use the `simple_format` method of ActionPack by using the *_with_formatting methods:
69
+ ```rb
70
+ output = text.bbcode_to_html_with_formatting
71
+ output = text.bbcode_to_html_with_formatting!
72
+ ```
73
73
 
74
74
  ### TAGS PROCESSED:
75
75
 
@@ -183,20 +183,20 @@ module BBRuby
183
183
  'YouTube' => [
184
184
  /\[youtube\](.*?)\?v=([\w\d\-]+).*?\[\/youtube\]/im,
185
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>',
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>',
186
+ '<iframe id="ytplayer" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/\2" frameborder="0"/>',
187
187
  'Display a video from YouTube.com',
188
188
  '[youtube]http://youtube.com/watch?v=E4Fbk52Mk1w[/youtube]',
189
189
  :video],
190
190
  'YouTube (Alternative)' => [
191
191
  /\[youtube\](.*?)\/v\/([\w\d\-]+)\[\/youtube\]/im,
192
192
  # '<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>',
193
- '<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>',
193
+ '<iframe id="ytplayer" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/\2" frameborder="0"/>',
194
194
  'Display a video from YouTube.com (alternative format)',
195
195
  '[youtube]http://youtube.com/watch/v/E4Fbk52Mk1w[/youtube]',
196
196
  :video],
197
197
  'Vimeo' => [
198
198
  /\[vimeo\](.*?)\/(\d+)\[\/vimeo\]/im,
199
- '<object type="application/x-shockwave-flash" width="500" height="350" data="http://www.vimeo.com/moogaloop.swf?clip_id=\2"><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=\2" /></object>',
199
+ '<iframe src="//player.vimeo.com/video/\2" width="640" height="390" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',
200
200
  'Display a video from Vimeo',
201
201
  '[vimeo]http://www.vimeo.com/3485239[/vimeo]',
202
202
  :video],
@@ -1,3 +1,3 @@
1
1
  module BBRuby
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -142,13 +142,13 @@ class TestBBRuby < Test::Unit::TestCase
142
142
 
143
143
  def test_youtube
144
144
  # Uncomment below if using 4:3 format youtube video embed
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
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
+ # assert_equal assert_equal '<iframe id="ytplayer" type="text/html" width="320" height="265" src="http://www.youtube.com/embed/E4Fbk52Mk1w" frameborder="0"/>', '[youtube]http://youtube.com/watch?v=E4Fbk52Mk1w[/youtube]'.bbcode_to_html
146
+ assert_equal '<iframe id="ytplayer" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/E4Fbk52Mk1w" frameborder="0"/>', '[youtube]http://youtube.com/watch?v=E4Fbk52Mk1w[/youtube]'.bbcode_to_html
147
+ assert_equal '<iframe id="ytplayer" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/E4Fbk52Mk1w" frameborder="0"/><iframe id="ytplayer" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/abc123" frameborder="0"/>', '[youtube]http://youtube.com/watch?v=E4Fbk52Mk1w[/youtube][youtube]http://youtube.com/watch?v=abc123[/youtube]'.bbcode_to_html
148
148
  end
149
149
 
150
150
  def test_vimeo
151
- assert_equal '<object type="application/x-shockwave-flash" width="500" height="350" data="http://www.vimeo.com/moogaloop.swf?clip_id=3485239"><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=3485239" /></object>', '[vimeo]http://www.vimeo.com/3485239[/vimeo]'.bbcode_to_html
151
+ assert_equal '<iframe src="//player.vimeo.com/video/3485239" width="640" height="390" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>', '[vimeo]http://www.vimeo.com/3485239[/vimeo]'.bbcode_to_html
152
152
  end
153
153
 
154
154
  def test_google_video
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.1.0
4
+ version: 1.2.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-12-01 00:00:00.000000000 Z
11
+ date: 2016-01-11 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.4.1
53
+ rubygems_version: 2.4.5.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