Sha256: a38ffe158b629e397836e9d33981529ed48ee71333766770d1d3ff547c79f0bd

Contents?: true

Size: 335 Bytes

Versions: 1

Compression:

Stored size: 335 Bytes

Contents

class TBBC
	def parse(s)
		#First off remove the < and > which will disable all HTML
		s=s.gsub("<","&lt;").gsub(">","&gt;")
		#Convert new lines to <br />'s
		s=s.gsub(/\n/,'<br />')
		#Tags
		s=s.gsub(/\[b\](.*?)\[\/b\]/,'<strong>\1</strong>')
		
		return s
	end
end

class String
	def tbbc
		bbc=TBBC.new
		bbc.parse(self)
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trainbbcode-0.1.0 lib/trainbbcode.rb