trainbbcode 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('trainbbcode','0.3.2') do |p|
5
+ Echoe.new('trainbbcode','0.3.3') do |p|
6
6
  p.description = "Provides BBCode for Ruby."
7
7
  p.url = "http://www.arcath.net/pages/2"
8
8
  p.author = "Adam \"Arcath\" Laycock"
data/lib/trainbbcode.rb CHANGED
@@ -157,9 +157,12 @@ class TBBC
157
157
  end
158
158
  def coderay(s)
159
159
  scan=s.scan(/\[code lang=(.+?)\](.+?)\[\/code\]/m)
160
- parse=scan[0][1].gsub("&lt;","<").gsub("&gt;",">")
161
- lang=scan[0][0]
162
- "[nobbc]" + CodeRay.scan(parse, lang).div(:css => :class, :line_numbers => @config[:syntax_highlighting_line_numbers]) + "[/nobbc]"
160
+ scan.each do |a|
161
+ parse=a[1].gsub("&lt;","<").gsub("&gt;",">")
162
+ lang=a[0]
163
+ s=s.gsub(/\[code lang=.+?\]#{a[1]}\[\/code\]/m,"[nobbc]" + CodeRay.scan(parse, lang).div(:css => :class, :line_numbers => @config[:syntax_highlighting_line_numbers]) + "[/nobbc]")
164
+ end
165
+ s
163
166
  end
164
167
  end
165
168
 
@@ -171,3 +174,6 @@ class String
171
174
  bbc.parse(self)
172
175
  end
173
176
  end
177
+
178
+ t=TBBC.new
179
+ puts t.parse("[code lang=ruby]def test\nputs \"MMMMMMMUlti Line\"\nend[/code]\nThis is a bit more text\n[code lang=ruby]a=\"TESTING\"[/code]")
data/trainbbcode.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{trainbbcode}
5
- s.version = "0.3.2"
5
+ s.version = "0.3.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"]
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.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam "Arcath" Laycock