A Ruby Gem which parses ubb code to html.
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
README.md
Rakefile
ubbparser.gemspec

README.md

UBBParser

A Ruby Gem which parses ubb code to html. After installing the gem use the following code:

require 'ubbparser'
UBBParser.parse("This is an [b]example[/b]")
# Result => "This is an <b>example</b>"

The parse method allow a second parameter parse_options. It's an hash containing a few options.

  • :convert_newlines => A boolean whether newlines should be convert into <br /> tags (default: true).

  • :protect_email => A boolean whether email addresses should be protected from spoofing using embedded JavaScript (default: true).

  • :class_xxx => A string with css class(es) that are embedded in the html attribute class='' for the tag xxx. Not all tags supports this.

    Example:

      require 'ubbparser'
      UBBParser.parse("Check the website [url]http://ubbparser.mojura.nl[/url]", {:class_url => "my_url_class"})
      # Result => "Check the website <a href='http://ubbparser.mojura.nl' class='my_url_class'>http://ubbparser.mojura.nl</a>"
    

More (RDoc) documentation can be found on http://ubbparser.mojura.nl.