Skip to content

Latest commit

 

History

History
52 lines (30 loc) · 1.26 KB

README.rdoc

File metadata and controls

52 lines (30 loc) · 1.26 KB

Train BBCode

Rails Gem for BBCode

Install

As a Gem

gem install trainbbcode

For rails you will need to add:

gem "trainbbcode"

to your Gemfile and then install the gem using:

bundle install

As a Plugin

rails plugin install git://github.com/Arcath/TrainBBCode

Usage

The easiest way to use tbbc is with the string method provided, for example

>> "[b]Bold[/b]".tbbc
=> "<strong>Bold</strong>"

Configuration

On the fly

If you want to quickly change something, e.g. disable a tag for a specific .tbbc call then you can configure it in the call:

>> "[b]Bold[/b] [i]Italic[/i]".tbbc(:strong_enabled => false)
=> "[b]Bold[/b] <i>Italic</i>"

Whilst this method works its not the cleanest way of doing it. Its fine for simple things like disabling a single tag (e.g. tables in signatures) but when defining custom tags or the coderay css its better to use the other config method

Globaly

This is done using config/tbbc.rb, this file needs to look like this:

class TBBC
    def user_config
        #Change the Config here
        @config[:strong_enabled] = false
    end
end

That would produce the same output as the on the fly config but would work when ever you used .tbbc in the project.