lib/trainbbcode.rb in trainbbcode-0.3.4 vs lib/trainbbcode.rb in trainbbcode-0.3.5

- old
+ new

@@ -154,14 +154,16 @@ #Corrects the extra brs s=s.gsub(/<br \/><(ul|li|table|tr|td|th)/,'<\1') s=s.gsub(/<br \/><\/(ul|li|table|tr|td|th)/,'</\1') end def coderay(s) + s=s.gsub("\r","") scan=s.scan(/\[code lang=(.+?)\](.+?)\[\/code\]/m) scan.each do |a| parse=a[1].gsub("&lt;","<").gsub("&gt;",">") lang=a[0] - 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]") + parsed="[nobbc]" + CodeRay.scan(parse, lang).div(:css => :class, :line_numbers => @config[:syntax_highlighting_line_numbers]) + "[/nobbc]" + s=s.gsub("[code lang=#{a[0]}]#{a[1]}[/code]",parsed) end s end end