Agile Web Development

Build it. Launch it. Love it.

BBCodeizer

BBCodeizer is a Rails plugin to translate BBCode to HTML. The main interface is provided through the helper method "bbcodeize." Use of it is as simple as passing a string to bbcodeize:

  <%= bbcodeize post.body %>

You can also invoke the BBCodeizer directly without the helper:

  render :text => BBCodeizer.bbcodeize(post.body)

All settings are centralized so you can very quickly deactivate any tag or modify the HTML that is generated. You can modify these settings by adding lines to the end of your environment.rb. For example:

  # deactivate [color], [size], and [code] tags
  BBCodeizer.deactivate(:color, :size, :code)

These changes should be considered one-time configuration, e.g. tags cannot be deactivated then activated again.

Vitals

Home http://agtools.rubyforge.org/bbcodeizer/
Repository svn://rubyforge.org/var/svn/agtools/plugins/bbcodeizer
License Rails' (MIT)
Tags Tag_red bbcode escape filter
Rating (15 votes)
Created 11 October 2006

Comments

  • Avatar
    John Fredrickson
    30 September 2008

    The README recommends passing the text through the h() function before passing it to the bbcodeize function, i.e.:

    bbcodeize(h(text))

    The h() function however changes any quotation marks to their html equivalent therefore causing any bbcode strings to with quotation marks to no longer match.

    This currently only affects the quotation tag with a citation, but for now that one is broken if you use the h() function.

Add a comment